Skip to content

Commit

Permalink
IoT Central ARM SDK (#2937)
Browse files Browse the repository at this point in the history
* Generated from a4006792c97fe0c9c295a03aadf25284b03922f1 (#2672)

Add specs for Microsoft.IoTCentral RP

Merge from private repo. PR: Azure/azure-rest-api-specs-pr#472

* Generated from a40cc7c2f4f8e9140546f47683c1fcb9b74f5442 (#2693)

Remove subscriptionId uuid format for IotCentral

* Packaging for IoTCentral

* Add IoT Central tests
  • Loading branch information
emgarten authored and lmazuel committed Jul 18, 2018
1 parent 5081613 commit df0e798
Show file tree
Hide file tree
Showing 39 changed files with 2,357 additions and 0 deletions.
9 changes: 9 additions & 0 deletions azure-mgmt-iotcentral/HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. :changelog:
Release History
===============

0.1.0 (2018-07-16)
++++++++++++++++++

* Initial Release with support for 2017-07-01-privatepreview
2 changes: 2 additions & 0 deletions azure-mgmt-iotcentral/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include *.rst
include azure_bdist_wheel.py
49 changes: 49 additions & 0 deletions azure-mgmt-iotcentral/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
Microsoft Azure SDK for Python
==============================

This is the Microsoft Azure IoTCentral Management Client Library.

Azure Resource Manager (ARM) is the next generation of management APIs that
replace the old Azure Service Management (ASM).

This package has been tested with Python 2.7, 3.4, 3.5 and 3.6.

For the older Azure Service Management (ASM) libraries, see
`azure-servicemanagement-legacy <https://pypi.python.org/pypi/azure-servicemanagement-legacy>`__ library.

For a more complete set of Azure libraries, see the `azure <https://pypi.python.org/pypi/azure>`__ bundle package.


Compatibility
=============

**IMPORTANT**: If you have an earlier version of the azure package
(version < 1.0), you should uninstall it before installing this package.

You can check the version using pip:

.. code:: shell
pip freeze
If you see azure==0.11.0 (or any version below 1.0), uninstall it first:

.. code:: shell
pip uninstall azure
Usage
=====

For code examples, see `IoTCentral Management
<https://docs.microsoft.com/python/api/overview/azure/>`__
on docs.microsoft.com.


Provide Feedback
================

If you encounter any bugs or have suggestions, please file an issue in the
`Issues <https://github.com/Azure/azure-sdk-for-python/issues>`__
section of the project.
1 change: 1 addition & 0 deletions azure-mgmt-iotcentral/azure/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
1 change: 1 addition & 0 deletions azure-mgmt-iotcentral/azure/mgmt/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
18 changes: 18 additions & 0 deletions azure-mgmt-iotcentral/azure/mgmt/iotcentral/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .iot_central_client import IotCentralClient
from .version import VERSION

__all__ = ['IotCentralClient']

__version__ = VERSION

86 changes: 86 additions & 0 deletions azure-mgmt-iotcentral/azure/mgmt/iotcentral/iot_central_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.service_client import SDKClient
from msrest import Serializer, Deserializer
from msrestazure import AzureConfiguration
from .version import VERSION
from .operations.apps_operations import AppsOperations
from .operations.operations import Operations
from . import models


class IotCentralClientConfiguration(AzureConfiguration):
"""Configuration for IotCentralClient
Note that all parameters used to create this instance are saved as instance
attributes.
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: The subscription identifier.
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):

if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'

super(IotCentralClientConfiguration, self).__init__(base_url)

self.add_user_agent('azure-mgmt-iotcentral/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')

self.credentials = credentials
self.subscription_id = subscription_id


class IotCentralClient(SDKClient):
"""Use this API to manage IoT Central Applications in your Azure subscription.
:ivar config: Configuration for client.
:vartype config: IotCentralClientConfiguration
:ivar apps: Apps operations
:vartype apps: azure.mgmt.iotcentral.operations.AppsOperations
:ivar operations: Operations operations
:vartype operations: azure.mgmt.iotcentral.operations.Operations
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: The subscription identifier.
:type subscription_id: str
:param str base_url: Service URL
"""

def __init__(
self, credentials, subscription_id, base_url=None):

self.config = IotCentralClientConfiguration(credentials, subscription_id, base_url)
super(IotCentralClient, self).__init__(self.config.credentials, self.config)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2017-07-01-privatepreview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.apps = AppsOperations(
self._client, self.config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
53 changes: 53 additions & 0 deletions azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

try:
from .app_sku_info_py3 import AppSkuInfo
from .app_py3 import App
from .app_patch_py3 import AppPatch
from .resource_py3 import Resource
from .error_details_py3 import ErrorDetails, ErrorDetailsException
from .operation_display_py3 import OperationDisplay
from .operation_py3 import Operation
from .operation_inputs_py3 import OperationInputs
from .app_name_availability_info_py3 import AppNameAvailabilityInfo
except (SyntaxError, ImportError):
from .app_sku_info import AppSkuInfo
from .app import App
from .app_patch import AppPatch
from .resource import Resource
from .error_details import ErrorDetails, ErrorDetailsException
from .operation_display import OperationDisplay
from .operation import Operation
from .operation_inputs import OperationInputs
from .app_name_availability_info import AppNameAvailabilityInfo
from .app_paged import AppPaged
from .operation_paged import OperationPaged
from .iot_central_client_enums import (
AppSku,
AppNameUnavailabilityReason,
)

__all__ = [
'AppSkuInfo',
'App',
'AppPatch',
'Resource',
'ErrorDetails', 'ErrorDetailsException',
'OperationDisplay',
'Operation',
'OperationInputs',
'AppNameAvailabilityInfo',
'AppPaged',
'OperationPaged',
'AppSku',
'AppNameUnavailabilityReason',
]
78 changes: 78 additions & 0 deletions azure-mgmt-iotcentral/azure/mgmt/iotcentral/models/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from .resource import Resource


class App(Resource):
"""The IoT Central application.
Variables are only populated by the server, and will be ignored when
sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: The ARM resource identifier.
:vartype id: str
:ivar name: The ARM resource name.
:vartype name: str
:ivar type: The resource type.
:vartype type: str
:param location: Required. The resource location.
:type location: str
:param tags: The resource tags.
:type tags: dict[str, str]
:ivar application_id: The ID of the application.
:vartype application_id: str
:param display_name: The display name of the application.
:type display_name: str
:param subdomain: The subdomain of the application.
:type subdomain: str
:param template: The ID of the application template, which is a blueprint
that defines the characteristics and behaviors of an application.
Optional; if not specified, defaults to a blank blueprint and allows the
application to be defined from scratch.
:type template: str
:param sku: Required. A valid instance SKU.
:type sku: ~azure.mgmt.iotcentral.models.AppSkuInfo
"""

_validation = {
'id': {'readonly': True},
'name': {'readonly': True, 'pattern': r'^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,99}[a-zA-Z0-9]$'},
'type': {'readonly': True},
'location': {'required': True},
'application_id': {'readonly': True},
'display_name': {'pattern': r'^.{1,200}$'},
'subdomain': {'pattern': r'^[a-z0-9-]{1,63}$'},
'sku': {'required': True},
}

_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'application_id': {'key': 'properties.applicationId', 'type': 'str'},
'display_name': {'key': 'properties.displayName', 'type': 'str'},
'subdomain': {'key': 'properties.subdomain', 'type': 'str'},
'template': {'key': 'properties.template', 'type': 'str'},
'sku': {'key': 'sku', 'type': 'AppSkuInfo'},
}

def __init__(self, **kwargs):
super(App, self).__init__(**kwargs)
self.application_id = None
self.display_name = kwargs.get('display_name', None)
self.subdomain = kwargs.get('subdomain', None)
self.template = kwargs.get('template', None)
self.sku = kwargs.get('sku', None)
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------

from msrest.serialization import Model


class AppNameAvailabilityInfo(Model):
"""The properties indicating whether a given IoT Central application name is
available.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar name_available: The value which indicates whether the provided name
is available.
:vartype name_available: bool
:ivar reason: The reason for unavailability. Possible values include:
'Invalid', 'AlreadyExists'
:vartype reason: str or
~azure.mgmt.iotcentral.models.AppNameUnavailabilityReason
:param message: The detailed reason message.
:type message: str
"""

_validation = {
'name_available': {'readonly': True},
'reason': {'readonly': True},
}

_attribute_map = {
'name_available': {'key': 'nameAvailable', 'type': 'bool'},
'reason': {'key': 'reason', 'type': 'AppNameUnavailabilityReason'},
'message': {'key': 'message', 'type': 'str'},
}

def __init__(self, **kwargs):
super(AppNameAvailabilityInfo, self).__init__(**kwargs)
self.name_available = None
self.reason = None
self.message = kwargs.get('message', None)
Loading

0 comments on commit df0e798

Please sign in to comment.