Skip to content

Commit

Permalink
CodeGen from PR 13213 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
[Hub Generated] Review request for Microsoft.DeviceUpdate to add version preview/2020-09-01 (Azure#13213)

* New Readme Config File

* New Go Language Readme Config File

* New Azure AZ Readme Config File

* New Azure CLI Readme Config File

* New Typescript Language Readme Config File

* New Python Language Readme Config File

* New C# Language Readme Config File

* New AzureResourceSchema Readme Config File

* New Swagger Spec File

* New Swagger Example Spec File

* Release of Device Update for IoT Hub data plane specification.

* Fixing prettier issues.

* Fixing spellcheck issues.

* Fixing spellcheck in spec examples.

Co-authored-by: David Pokluda <david.pokluda@microsoft.com>
  • Loading branch information
SDKAuto and David Pokluda committed Mar 2, 2021
1 parent 19efd8c commit f64f2f5
Show file tree
Hide file tree
Showing 12 changed files with 4,826 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
# --------------------------------------------------------------------------

from ._configuration import DeviceUpdateClientConfiguration
from ._device_update_client import DeviceUpdateClient
__all__ = ['DeviceUpdateClient', 'DeviceUpdateClientConfiguration']

from .version import VERSION

__version__ = VERSION

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
# --------------------------------------------------------------------------

from msrest import Configuration

from .version import VERSION


class DeviceUpdateClientConfiguration(Configuration):
"""Configuration for DeviceUpdateClient
Note that all parameters used to create this instance are saved as instance
attributes.
:param account_endpoint: Account endpoint.
:type account_endpoint: str
:param instance_id: Account instance identifier.
:type instance_id: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""

def __init__(
self, account_endpoint, instance_id, credentials):

if account_endpoint is None:
raise ValueError("Parameter 'account_endpoint' must not be None.")
if instance_id is None:
raise ValueError("Parameter 'instance_id' must not be None.")
if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
base_url = 'https://{accountEndpoint}'

super(DeviceUpdateClientConfiguration, self).__init__(base_url)

# Starting Autorest.Python 4.0.64, make connection pool activated by default
self.keep_alive = True

self.add_user_agent('azure-deviceupdate/{}'.format(VERSION))

self.account_endpoint = account_endpoint
self.instance_id = instance_id
self.credentials = credentials
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
# --------------------------------------------------------------------------

from msrest.service_client import SDKClient
from msrest import Serializer, Deserializer

from ._configuration import DeviceUpdateClientConfiguration
from msrest.exceptions import HttpOperationError
from .operations import UpdatesOperations
from .operations import DevicesOperations
from .operations import DeploymentsOperations
from . import models


class DeviceUpdateClient(SDKClient):
"""Device Update for IoT Hub is an Azure service that enables customers to publish update for their IoT devices to the cloud, and then deploy that update to their devices (approve updates to groups of devices managed and provisioned in IoT Hub). It leverages the proven security and reliability of the Windows Update platform, optimized for IoT devices. It works globally and knows when and how to update devices, enabling customers to focus on their business goals and let Device Update for IoT Hub handle the updates.
:ivar config: Configuration for client.
:vartype config: DeviceUpdateClientConfiguration
:ivar updates: Updates operations
:vartype updates: azure.deviceupdate.operations.UpdatesOperations
:ivar devices: Devices operations
:vartype devices: azure.deviceupdate.operations.DevicesOperations
:ivar deployments: Deployments operations
:vartype deployments: azure.deviceupdate.operations.DeploymentsOperations
:param account_endpoint: Account endpoint.
:type account_endpoint: str
:param instance_id: Account instance identifier.
:type instance_id: str
:param credentials: Subscription credentials which uniquely identify
client subscription.
:type credentials: None
"""

def __init__(
self, account_endpoint, instance_id, credentials):

self.config = DeviceUpdateClientConfiguration(account_endpoint, instance_id, credentials)
super(DeviceUpdateClient, 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 = '2020-09-01'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)

self.updates = UpdatesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.devices = DevicesOperations(
self._client, self.config, self._serialize, self._deserialize)
self.deployments = DeploymentsOperations(
self._client, self.config, self._serialize, self._deserialize)
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
# --------------------------------------------------------------------------

try:
from ._models_py3 import AccessCondition
from ._models_py3 import AccountOptions
from ._models_py3 import Compatibility
from ._models_py3 import Deployment
from ._models_py3 import DeploymentDeviceState
from ._models_py3 import DeploymentDeviceStatesFilter
from ._models_py3 import DeploymentFilter
from ._models_py3 import DeploymentStatus
from ._models_py3 import Device
from ._models_py3 import DeviceClass
from ._models_py3 import DeviceFilter
from ._models_py3 import DeviceTag
from ._models_py3 import Error
from ._models_py3 import File
from ._models_py3 import FileImportMetadata
from ._models_py3 import Group
from ._models_py3 import GroupBestUpdatesFilter
from ._models_py3 import ImportManifestMetadata
from ._models_py3 import ImportUpdateInput
from ._models_py3 import InnerError
from ._models_py3 import Operation
from ._models_py3 import OperationFilter
from ._models_py3 import PageableListOfDeploymentDeviceStates
from ._models_py3 import PageableListOfDeployments
from ._models_py3 import PageableListOfDeviceClasses
from ._models_py3 import PageableListOfDevices
from ._models_py3 import PageableListOfDeviceTags
from ._models_py3 import PageableListOfGroups
from ._models_py3 import PageableListOfOperations
from ._models_py3 import PageableListOfStrings
from ._models_py3 import PageableListOfUpdatableDevices
from ._models_py3 import PageableListOfUpdateIds
from ._models_py3 import UpdatableDevices
from ._models_py3 import Update
from ._models_py3 import UpdateCompliance
from ._models_py3 import UpdateId
except (SyntaxError, ImportError):
from ._models import AccessCondition
from ._models import AccountOptions
from ._models import Compatibility
from ._models import Deployment
from ._models import DeploymentDeviceState
from ._models import DeploymentDeviceStatesFilter
from ._models import DeploymentFilter
from ._models import DeploymentStatus
from ._models import Device
from ._models import DeviceClass
from ._models import DeviceFilter
from ._models import DeviceTag
from ._models import Error
from ._models import File
from ._models import FileImportMetadata
from ._models import Group
from ._models import GroupBestUpdatesFilter
from ._models import ImportManifestMetadata
from ._models import ImportUpdateInput
from ._models import InnerError
from ._models import Operation
from ._models import OperationFilter
from ._models import PageableListOfDeploymentDeviceStates
from ._models import PageableListOfDeployments
from ._models import PageableListOfDeviceClasses
from ._models import PageableListOfDevices
from ._models import PageableListOfDeviceTags
from ._models import PageableListOfGroups
from ._models import PageableListOfOperations
from ._models import PageableListOfStrings
from ._models import PageableListOfUpdatableDevices
from ._models import PageableListOfUpdateIds
from ._models import UpdatableDevices
from ._models import Update
from ._models import UpdateCompliance
from ._models import UpdateId
from ._device_update_client_enums import (
DeploymentState,
DeploymentType,
DeviceDeploymentState,
DeviceGroupType,
DeviceState,
GroupType,
OperationFilterStatus,
OperationStatus,
)

__all__ = [
'AccessCondition',
'AccountOptions',
'Compatibility',
'Deployment',
'DeploymentDeviceState',
'DeploymentDeviceStatesFilter',
'DeploymentFilter',
'DeploymentStatus',
'Device',
'DeviceClass',
'DeviceFilter',
'DeviceTag',
'Error',
'File',
'FileImportMetadata',
'Group',
'GroupBestUpdatesFilter',
'ImportManifestMetadata',
'ImportUpdateInput',
'InnerError',
'Operation',
'OperationFilter',
'PageableListOfDeploymentDeviceStates',
'PageableListOfDeployments',
'PageableListOfDeviceClasses',
'PageableListOfDevices',
'PageableListOfDeviceTags',
'PageableListOfGroups',
'PageableListOfOperations',
'PageableListOfStrings',
'PageableListOfUpdatableDevices',
'PageableListOfUpdateIds',
'UpdatableDevices',
'Update',
'UpdateCompliance',
'UpdateId',
'OperationStatus',
'DeviceDeploymentState',
'GroupType',
'DeploymentType',
'DeviceGroupType',
'DeploymentState',
'OperationFilterStatus',
'DeviceState',
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
#
# --------------------------------------------------------------------------

from enum import Enum


class OperationStatus(str, Enum):

undefined = "Undefined" #: Undefined operation status.
not_started = "NotStarted" #: Background operation created but not started yet.
running = "Running" #: Background operation is currently running.
succeeded = "Succeeded" #: Background operation finished with success.
failed = "Failed" #: Background operation finished with failure.


class DeviceDeploymentState(str, Enum):

succeeded = "Succeeded" #: Deployment has completed with success.
in_progress = "InProgress" #: Deployment is in progress.
failed = "Failed" #: Deployment has completed with failure.
canceled = "Canceled" #: Deployment was canceled.
incompatible = "Incompatible" #: Deployment is not compatible with the device.


class GroupType(str, Enum):

io_thub_tag = "IoTHubTag" #: IoT Hub tag based group.


class DeploymentType(str, Enum):

complete = "Complete" #: A complete deployment including download, install, and apply actions.
download = "Download" #: A download-only deployment that does not include any install or apply actions. Not currently supported.
install = "Install" #: An install-only rollout that does not include any download actions, only install and complete. Not currently supported.


class DeviceGroupType(str, Enum):

all = "All" #: The deployment should be sent to all devices in the device class.
devices = "Devices" #: The deployment should be sent to the list of devices in the device group definition.
device_group_definitions = "DeviceGroupDefinitions" #: The deployment should be sent to the list of devices returned by the union of all the device group definition queries.


class DeploymentState(str, Enum):

active = "Active" #: The deployment can be sent to devices targeted in the deployment.
superseded = "Superseded" #: A newer deployment with the same targeting exists and no devices will receive this deployment.
canceled = "Canceled" #: The deployment has been canceled and no devices will receive it.


class OperationFilterStatus(str, Enum):

running = "Running"
not_started = "NotStarted"


class DeviceState(str, Enum):

not_started = "NotStarted" #: Not started (or uninitialized)
incompatible = "Incompatible" #: Deployment incompatible for this device.
already_in_deployment = "AlreadyInDeployment" #: Another Deployment is underway for this device.
canceled = "Canceled" #: Deployment has been canceled for this device.
in_progress = "InProgress" #: Deployment underway.
failed = "Failed" #: Deployment failed.
succeeded = "Succeeded" #: Deployment completed successfully.
Loading

0 comments on commit f64f2f5

Please sign in to comment.