maestro-python-sdk


Namemaestro-python-sdk JSON
Version 1.0.7 PyPI version JSON
download
home_page
SummarySDK for facilitating the communication with Maestro for all Pythonic components.
upload_time2024-03-01 12:39:27
maintainer
docs_urlNone
authormaestrocloudcontrol
requires_python
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Maestro-python-sdk

`The 'Maestro Python SDK'` is an SDK created for facilitating  the communication with Maestro for all Pythonic components including: WSBA, SFTA, Consumption Module, Automover BA etc.

Contents
========
    
 * [Requirements](#requirements)
 * [Installation and configuration](#installation)
 * [Usage](#usage)
 * [Examples](#examples)

# Requirements
> Python 3.10 required

# Installation

> First of all you need to install m3-python-sdk to your project, you can use next command to do it:
- `pip install maestro-python-sdk`

> After you installed maestro-python-sdk to your project, you should set ENV variables,
> this step is optional, because you would be able to pass those params while creating instances, but we highly recommend you to do this, because it will make your use more pleasant and flexible, and also such a method is more secure.
 - SDK_ACCESS_KEY,
 - SDK_SECRET_KEY,
 - MAESTRO_USER,
> This is first required variables you should set, the following variables depend on the way you will be using the SDK.
 
### `Rabbit`
 - RABBIT_EXCHANGE, 
 - DEFAULT_MAESTRO_REQUEST_QUEUE, DEFAULT_MAESTRO_RESPONSE_QUEUE, 
 - DEFAULT_ADMIN_REQUEST_QUEUE, DEFAULT_ADMIN_RESPONSE_QUEUE,
 - DEFAULT_KPI_REQUEST_QUEUE, DEFAULT_KPI_RESPONSE_QUEUE  
### `HTTP`
 - API_LINK


# USAGE

To start using Maestro Python SDK you need to create either an HTTP client or a RabbitMQ client. The difference between them is not significant. If you need to send asynchronous requests, use only the RabbitMQ client, as it is the only one that supports such functionality. In other cases, use whichever is more convenient for you.

## RabbiMQ

**There are two ways to create RabbitMQ client:**

+ Create client using ```__init__``` method of a RabbitMqStrategy class:
+ Create client using ```build``` method of a RabbitMqStrategy class:

### ```__init__``` method Example
>Step 1: Create a RabbitMqStrategy object. This step requires the following information: rabbit connection url for maestro server, your personal sdk access and secret keys, maestro user and names of rabbit queues, more information about parameters is described inside RabbitMqStrategy class. Below is an example of how to create a client:
1. ```python 
   from m3_python_sdk.strategies.rabbitmq import RabbitMqStrategy
   rabbit_client = RabbitMqStrategy(
        connection_url='<connection url>',
        request_queue='<request_queue>',
        response_queue='<response_queue>',
        sdk_access_key='<sdk_access_key>',
        sdk_secret_key='<sdk_secret_key>',
        maestro_user='<maestro_user>'
   )
   # For your information, request/response queues, sdk keys and maestro user
   # could be set as ENV varibles, if you dont provide them while creating class,
   # they would be searched in env variables automatically.

>Step 2: If you provided sdk with correct credentials and parameters you are good to go to use SDK. An examples is provided in the "Examples" topic.

### ```BUILD``` method Example
>Step 1: Create a RabbitMqStrategy object. This step requires the following information: host, username and password, stage, amqps and everything that takes basic __init__ method. Below is an example of how to create a client:
1. ```python 
   rabbit_client = RabbitMqStrategy(
        host='<host123.eu.amazon>',
        stage='<mstrdev>',
        username='<username>',
        password='<password>',
        request_queue='<request_queue>',
        response_queue='<response_queue>',
        sdk_access_key='<sdk_access_key>',
        sdk_secret_key='<sdk_secret_key>',
        maestro_user='<maestro_user>'
   )
   
   #as result you will get next rabbit_url:  
    'amqps://username:password@host123.eu.amazon:5671/mstrdev'
   
   # For your information, request/response queues, sdk keys and maestro user'
   # could be set as ENV varibles, if you dont provide them while creating class,
   # they would be searched in env variables automatically.


> Step 2: If you provided sdk with correct credentials and parameters you are good to go to use SDK. An examples is provided in the "Examples" topic.
> Now that you have created the client, you can use it to interact with the SDK. An example is provided in the "Examples" topic.


## HTTP

**There are two ways to create HTTP client:**

+ Create client using ```__init__``` method of a HTTPStrategy class:
+ Create client using ```build``` method of a HTTPStrategy class:

### ```__init__``` method Example
>Step 1: Create a HTTPStrategy object. This step requires the following information: api_link for maestro server, your personal sdk access and secret keys and maestro user, more information about parameters is described inside HTTPStrategy class. Below is an example of how to create a client:
1. ```python 
   from m3_python_sdk.strategies.http import HTTPStrategy
   http_client = HTTPStrategy(
        api_link='<api link>',
        sdk_access_key='<sdk_access_key>',
        sdk_secret_key='<sdk_secret_key>',
        maestro_user='<maestro_user>'
   )
   # For your information, sdk keys and maestro user could be set as ENV varibles,
   # if you dont provide them while creating class,
   # they would be searched in env variables automatically.
   # Namings for ENV variables:

>Step 2: If you provided sdk with correct credentials and parameters you are good to go to use SDK. An examples is provided in the "Examples" topic.

### ```BUILD``` method Example
>Step 1: Create a HTTPStrategy object. This step requires the following information: host, port, stage, htpps, and everything that takes basic __init__ method except api_link. Below is an example of how to create a client:
1. ```python 
   http_client = HTTPStrategy(
        host='<m3.cloud.com>',
        stage='<maestro/api/v3>',
        port='8000',
        https='True',
        sdk_access_key='<sdk_access_key>',
        sdk_secret_key='<sdk_secret_key>',
        maestro_user='<maestro_user>'
   )
   
   #as result you will get next api_link:  
    https://m3.cloud.com:8000/maestro/api/v3
   
   # For your information, request/response queues, sdk keys and maestro user'
   # could be set as ENV varibles, if you dont provide them while creating class,
   # they would be searched in env variables automatically.
   # SDK_ACCESS_KEY, SDK_SECRET_KEY, MAESTRO_USER, API_LINK

> Step 2: If you provided sdk with correct credentials and parameters you are good to go to use SDK. An examples is provided in the "Examples" topic.
> Now that you have created the client, you can use it to interact with the SDK. An example is provided in the "Examples" topic.
> 
## EXAMPLES

> When you create a basic HTTP ot RabbitMQ clients using one of provided ways, you can use it to call some methods.
>
> In general, methods are separated into next categories:
> - Consumptions
>   - add_consumption
>   - get_consumption
>   - delete_consumption
>   - add_consumption_details
>   - get_consumption_details
>   - delete_consumption_details
>   - check_tenant_status
> - Adjustments
>   - add_adjustment
>   - get_adjustment
>   - delete_adjustment
>   - total_report
> - Billing
>   - describe_billing_month
>   - describe_currency
>   - get_top_account_reports
>   - add_cost_center
>   - archive_big_query
>   - billing_configure


> Here are examples of how to call one method from each category.

> 1. ```python
>    # You need to create Http ot Rabbit client, after that create ConsumptionResource class object and pass your client inside init method
>    from m3_python_sdk.strategies.http import HttpStrategy
>    from m3_python_sdk.resources.consumption.consumption import ConsumptionResource
>    http = HttpStrategy(#the example is given above.)
>    consumption = ConsumptionResource(client=http)
>    consumption.get_consumption(
>           source_project='example',
>           target_project='example',
>           target_region='example',
>           year=example,
>           month=example,
>           description='example'
>    )
>    
>    response: {'status_code': status_code, 'status': status, 'message': message}
>    # Remember that response could also have next params: data, items, table_title, warnings, code

> 2. ```python
>    # You need to create Http ot Rabbit client, after that create AdjustmentResource class object and pass your client inside init method
>    from m3_python_sdk.strategies.rabbitmq import RabbitMqStrategy
>    from m3_python_sdk.resources.consumption.adjustment import AdjustmentResource
>    rabbit = RabbitMqStrategy(#the example is given above.)
>    adjustment = AdjustmentResource(client=rabbit)
>    adjustment.get_adjustment(
>           target_project='example',
>           target_account_number='example',
>           target_region='example',
>           #target_cloud='example',
>           month='example',
>           year='example',
>           description='example',
>           credit_type='example',
>           currency_native='example',
>           value='example'
>    )
>    
>    response: {'status_code': status_code, 'status': status, 'message': message}
>    # Remember that response could also have next params: data, items, table_title, warnings, code

> 3. ```python
>    # You need to create Http ot Rabbit client, after that create BillingResource class object and pass your client inside init method
>    ## Also if you already have some strategy created and you used it for consumptions or adjustment, you need to change Queues using properties.
>    from m3_python_sdk.strategies.rabbitmq import RabbitMqStrategy
>    from m3_python_sdk.resources.billing.billing import BillingResource
>    rabbit = RabbitMqStrategy(#the example is given above.)
>    billing = BillingResource(client=rabbit)
>    billing.describe_billing_month(year=2023, month=11)
>    
>    response: {'status_code': status_code, 'status': status, 'message': message}
>    # Remember that response could also have next params: data, items, table_title, warnings, code

##### Remember, the full list of endpoints can be found inside the consumption.py, adjustment.py and billing.py files. Additionally, greater amount of the endpoints can accept additional arguments, which can also be found inside those files.




            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "maestro-python-sdk",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "maestrocloudcontrol",
    "author_email": "support@maestrocontrol.cloud",
    "download_url": "https://files.pythonhosted.org/packages/84/19/f6d3cec15f6785958adc7cfda4742e1175162ea1777c9918ab72dc62cff9/maestro-python-sdk-1.0.7.tar.gz",
    "platform": null,
    "description": "# Maestro-python-sdk\n\n`The 'Maestro Python SDK'` is an SDK created for facilitating  the communication with Maestro for all Pythonic components including: WSBA, SFTA, Consumption Module, Automover BA etc.\n\nContents\n========\n    \n * [Requirements](#requirements)\n * [Installation and configuration](#installation)\n * [Usage](#usage)\n * [Examples](#examples)\n\n# Requirements\n> Python 3.10 required\n\n# Installation\n\n> First of all you need to install m3-python-sdk to your project, you can use next command to do it:\n- `pip install maestro-python-sdk`\n\n> After you installed maestro-python-sdk to your project, you should set ENV variables,\n> this step is optional, because you would be able to pass those params while creating instances, but we highly recommend you to do this, because it will make your use more pleasant and flexible, and also such a method is more secure.\n - SDK_ACCESS_KEY,\n - SDK_SECRET_KEY,\n - MAESTRO_USER,\n> This is first required variables you should set, the following variables depend on the way you will be using the SDK.\n \n### `Rabbit`\n - RABBIT_EXCHANGE, \n - DEFAULT_MAESTRO_REQUEST_QUEUE, DEFAULT_MAESTRO_RESPONSE_QUEUE, \n - DEFAULT_ADMIN_REQUEST_QUEUE, DEFAULT_ADMIN_RESPONSE_QUEUE,\n - DEFAULT_KPI_REQUEST_QUEUE, DEFAULT_KPI_RESPONSE_QUEUE  \n### `HTTP`\n - API_LINK\n\n\n# USAGE\n\nTo start using Maestro Python SDK you need to create either an HTTP client or a RabbitMQ client. The difference between them is not significant. If you need to send asynchronous requests, use only the RabbitMQ client, as it is the only one that supports such functionality. In other cases, use whichever is more convenient for you.\n\n## RabbiMQ\n\n**There are two ways to create RabbitMQ client:**\n\n+ Create client using ```__init__``` method of a RabbitMqStrategy class:\n+ Create client using ```build``` method of a RabbitMqStrategy class:\n\n### ```__init__``` method Example\n>Step 1: Create a RabbitMqStrategy object. This step requires the following information: rabbit connection url for maestro server, your personal sdk access and secret keys, maestro user and names of rabbit queues, more information about parameters is described inside RabbitMqStrategy class. Below is an example of how to create a client:\n1. ```python \n   from m3_python_sdk.strategies.rabbitmq import RabbitMqStrategy\n   rabbit_client = RabbitMqStrategy(\n        connection_url='<connection url>',\n        request_queue='<request_queue>',\n        response_queue='<response_queue>',\n        sdk_access_key='<sdk_access_key>',\n        sdk_secret_key='<sdk_secret_key>',\n        maestro_user='<maestro_user>'\n   )\n   # For your information, request/response queues, sdk keys and maestro user\n   # could be set as ENV varibles, if you dont provide them while creating class,\n   # they would be searched in env variables automatically.\n\n>Step 2: If you provided sdk with correct credentials and parameters you are good to go to use SDK. An examples is provided in the \"Examples\" topic.\n\n### ```BUILD``` method Example\n>Step 1: Create a RabbitMqStrategy object. This step requires the following information: host, username and password, stage, amqps and everything that takes basic __init__ method. Below is an example of how to create a client:\n1. ```python \n   rabbit_client = RabbitMqStrategy(\n        host='<host123.eu.amazon>',\n        stage='<mstrdev>',\n        username='<username>',\n        password='<password>',\n        request_queue='<request_queue>',\n        response_queue='<response_queue>',\n        sdk_access_key='<sdk_access_key>',\n        sdk_secret_key='<sdk_secret_key>',\n        maestro_user='<maestro_user>'\n   )\n   \n   #as result you will get next rabbit_url:  \n    'amqps://username:password@host123.eu.amazon:5671/mstrdev'\n   \n   # For your information, request/response queues, sdk keys and maestro user'\n   # could be set as ENV varibles, if you dont provide them while creating class,\n   # they would be searched in env variables automatically.\n\n\n> Step 2: If you provided sdk with correct credentials and parameters you are good to go to use SDK. An examples is provided in the \"Examples\" topic.\n> Now that you have created the client, you can use it to interact with the SDK. An example is provided in the \"Examples\" topic.\n\n\n## HTTP\n\n**There are two ways to create HTTP client:**\n\n+ Create client using ```__init__``` method of a HTTPStrategy class:\n+ Create client using ```build``` method of a HTTPStrategy class:\n\n### ```__init__``` method Example\n>Step 1: Create a HTTPStrategy object. This step requires the following information: api_link for maestro server, your personal sdk access and secret keys and maestro user, more information about parameters is described inside HTTPStrategy class. Below is an example of how to create a client:\n1. ```python \n   from m3_python_sdk.strategies.http import HTTPStrategy\n   http_client = HTTPStrategy(\n        api_link='<api link>',\n        sdk_access_key='<sdk_access_key>',\n        sdk_secret_key='<sdk_secret_key>',\n        maestro_user='<maestro_user>'\n   )\n   # For your information, sdk keys and maestro user could be set as ENV varibles,\n   # if you dont provide them while creating class,\n   # they would be searched in env variables automatically.\n   # Namings for ENV variables:\n\n>Step 2: If you provided sdk with correct credentials and parameters you are good to go to use SDK. An examples is provided in the \"Examples\" topic.\n\n### ```BUILD``` method Example\n>Step 1: Create a HTTPStrategy object. This step requires the following information: host, port, stage, htpps, and everything that takes basic __init__ method except api_link. Below is an example of how to create a client:\n1. ```python \n   http_client = HTTPStrategy(\n        host='<m3.cloud.com>',\n        stage='<maestro/api/v3>',\n        port='8000',\n        https='True',\n        sdk_access_key='<sdk_access_key>',\n        sdk_secret_key='<sdk_secret_key>',\n        maestro_user='<maestro_user>'\n   )\n   \n   #as result you will get next api_link:  \n    https://m3.cloud.com:8000/maestro/api/v3\n   \n   # For your information, request/response queues, sdk keys and maestro user'\n   # could be set as ENV varibles, if you dont provide them while creating class,\n   # they would be searched in env variables automatically.\n   # SDK_ACCESS_KEY, SDK_SECRET_KEY, MAESTRO_USER, API_LINK\n\n> Step 2: If you provided sdk with correct credentials and parameters you are good to go to use SDK. An examples is provided in the \"Examples\" topic.\n> Now that you have created the client, you can use it to interact with the SDK. An example is provided in the \"Examples\" topic.\n> \n## EXAMPLES\n\n> When you create a basic HTTP ot RabbitMQ clients using one of provided ways, you can use it to call some methods.\n>\n> In general, methods are separated into next categories:\n> - Consumptions\n>   - add_consumption\n>   - get_consumption\n>   - delete_consumption\n>   - add_consumption_details\n>   - get_consumption_details\n>   - delete_consumption_details\n>   - check_tenant_status\n> - Adjustments\n>   - add_adjustment\n>   - get_adjustment\n>   - delete_adjustment\n>   - total_report\n> - Billing\n>   - describe_billing_month\n>   - describe_currency\n>   - get_top_account_reports\n>   - add_cost_center\n>   - archive_big_query\n>   - billing_configure\n\n\n> Here are examples of how to call one method from each category.\n\n> 1. ```python\n>    # You need to create Http ot Rabbit client, after that create ConsumptionResource class object and pass your client inside init method\n>    from m3_python_sdk.strategies.http import HttpStrategy\n>    from m3_python_sdk.resources.consumption.consumption import ConsumptionResource\n>    http = HttpStrategy(#the example is given above.)\n>    consumption = ConsumptionResource(client=http)\n>    consumption.get_consumption(\n>           source_project='example',\n>           target_project='example',\n>           target_region='example',\n>           year=example,\n>           month=example,\n>           description='example'\n>    )\n>    \n>    response: {'status_code': status_code, 'status': status, 'message': message}\n>    # Remember that response could also have next params: data, items, table_title, warnings, code\n\n> 2. ```python\n>    # You need to create Http ot Rabbit client, after that create AdjustmentResource class object and pass your client inside init method\n>    from m3_python_sdk.strategies.rabbitmq import RabbitMqStrategy\n>    from m3_python_sdk.resources.consumption.adjustment import AdjustmentResource\n>    rabbit = RabbitMqStrategy(#the example is given above.)\n>    adjustment = AdjustmentResource(client=rabbit)\n>    adjustment.get_adjustment(\n>           target_project='example',\n>           target_account_number='example',\n>           target_region='example',\n>           #target_cloud='example',\n>           month='example',\n>           year='example',\n>           description='example',\n>           credit_type='example',\n>           currency_native='example',\n>           value='example'\n>    )\n>    \n>    response: {'status_code': status_code, 'status': status, 'message': message}\n>    # Remember that response could also have next params: data, items, table_title, warnings, code\n\n> 3. ```python\n>    # You need to create Http ot Rabbit client, after that create BillingResource class object and pass your client inside init method\n>    ## Also if you already have some strategy created and you used it for consumptions or adjustment, you need to change Queues using properties.\n>    from m3_python_sdk.strategies.rabbitmq import RabbitMqStrategy\n>    from m3_python_sdk.resources.billing.billing import BillingResource\n>    rabbit = RabbitMqStrategy(#the example is given above.)\n>    billing = BillingResource(client=rabbit)\n>    billing.describe_billing_month(year=2023, month=11)\n>    \n>    response: {'status_code': status_code, 'status': status, 'message': message}\n>    # Remember that response could also have next params: data, items, table_title, warnings, code\n\n##### Remember, the full list of endpoints can be found inside the consumption.py, adjustment.py and billing.py files. Additionally, greater amount of the endpoints can accept additional arguments, which can also be found inside those files.\n\n\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "SDK for facilitating the communication with Maestro for all Pythonic components.",
    "version": "1.0.7",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "455e94e6a5c5fcaa5cc7c58610d979dfa7ef4e100e37f8cb40943c85981ce3ea",
                "md5": "17e177a25ee2d9d4737daca02803a242",
                "sha256": "e88d2a846d038c96335abc15f582a2967c69628f128010dada1f2d8d16906668"
            },
            "downloads": -1,
            "filename": "maestro_python_sdk-1.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "17e177a25ee2d9d4737daca02803a242",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 27926,
            "upload_time": "2024-03-01T12:39:25",
            "upload_time_iso_8601": "2024-03-01T12:39:25.639032Z",
            "url": "https://files.pythonhosted.org/packages/45/5e/94e6a5c5fcaa5cc7c58610d979dfa7ef4e100e37f8cb40943c85981ce3ea/maestro_python_sdk-1.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8419f6d3cec15f6785958adc7cfda4742e1175162ea1777c9918ab72dc62cff9",
                "md5": "b78340b454bc429a9af76d054a1ec9a0",
                "sha256": "4a4e5ecf8b6ad108d7f0c056cee50e5049d1451be38a822e237038759c91ce9a"
            },
            "downloads": -1,
            "filename": "maestro-python-sdk-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "b78340b454bc429a9af76d054a1ec9a0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 26770,
            "upload_time": "2024-03-01T12:39:27",
            "upload_time_iso_8601": "2024-03-01T12:39:27.492029Z",
            "url": "https://files.pythonhosted.org/packages/84/19/f6d3cec15f6785958adc7cfda4742e1175162ea1777c9918ab72dc62cff9/maestro-python-sdk-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-01 12:39:27",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "maestro-python-sdk"
}
        
Elapsed time: 0.23765s