Skip to content

Commit

Permalink
CodeGen from PR 11862 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 8aed8d38c63ea8711b3ce1c7510490292c97db60 into 0b03b72
  • Loading branch information
SDKAuto committed Dec 9, 2020
1 parent b85bb25 commit 1381e50
Show file tree
Hide file tree
Showing 29 changed files with 5,249 additions and 0 deletions.
16 changes: 16 additions & 0 deletions sdk/adp/azure-mgmt-adp/azure/mgmt/adp/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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 ._adp_management_client import AdpManagementClient
__all__ = ['AdpManagementClient']

try:
from ._patch import patch_sdk # type: ignore
patch_sdk()
except ImportError:
pass
136 changes: 136 additions & 0 deletions sdk/adp/azure-mgmt-adp/azure/mgmt/adp/_adp_management_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# 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 azure.mgmt.core import ARMPipelineClient
from msrest import Serializer, Deserializer

from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from ._configuration import AdpManagementClientConfiguration

class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Will be removed in final version of multiapi azure-core based client
"""
pass

class AdpManagementClient(MultiApiClientMixin, _SDKClient):
"""Microsoft Autonomous Development Platform.
This ready contains multiple API versions, to help you deal with all of the Azure clouds
(Azure Stack, Azure Government, Azure China, etc.).
By default, it uses the latest API version available on public Azure.
For production, you should stick to a particular api-version and/or profile.
The profile sets a mapping between an operation group and its API version.
The api-version parameter sets the default API version if the operation
group is not described in the profile.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str api_version: API version to use if no profile is provided, or if
missing in profile.
:param str base_url: Service URL
:param profile: A profile definition, from KnownProfiles to dict.
:type profile: azure.profiles.KnownProfiles
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

DEFAULT_API_VERSION = '2020-07-01-preview'
_PROFILE_TAG = "azure.mgmt.adp.AdpManagementClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION,
}},
_PROFILE_TAG + " latest"
)

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
api_version=None,
base_url=None,
profile=KnownProfiles.default,
**kwargs # type: Any
):
if not base_url:
base_url = 'https://management.azure.com'
self._config = AdpManagementClientConfiguration(credential, subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(AdpManagementClient, self).__init__(
api_version=api_version,
profile=profile
)

@classmethod
def _models_dict(cls, api_version):
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}

@classmethod
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 2020-07-01-preview: :mod:`v2020_07_01_preview.models<azure.mgmt.adp.v2020_07_01_preview.models>`
"""
if api_version == '2020-07-01-preview':
from .v2020_07_01_preview import models
return models
raise ValueError("API version {} is not available".format(api_version))

@property
def accounts(self):
"""Instance depends on the API version:
* 2020-07-01-preview: :class:`AccountsOperations<azure.mgmt.adp.v2020_07_01_preview.operations.AccountsOperations>`
"""
api_version = self._get_api_version('accounts')
if api_version == '2020-07-01-preview':
from .v2020_07_01_preview.operations import AccountsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'accounts'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def data_pools(self):
"""Instance depends on the API version:
* 2020-07-01-preview: :class:`DataPoolsOperations<azure.mgmt.adp.v2020_07_01_preview.operations.DataPoolsOperations>`
"""
api_version = self._get_api_version('data_pools')
if api_version == '2020-07-01-preview':
from .v2020_07_01_preview.operations import DataPoolsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'data_pools'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def operations(self):
"""Instance depends on the API version:
* 2020-07-01-preview: :class:`Operations<azure.mgmt.adp.v2020_07_01_preview.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2020-07-01-preview':
from .v2020_07_01_preview.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

def close(self):
self._client.close()
def __enter__(self):
self._client.__enter__()
return self
def __exit__(self, *exc_details):
self._client.__exit__(*exc_details)
66 changes: 66 additions & 0 deletions sdk/adp/azure-mgmt-adp/azure/mgmt/adp/_configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 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 typing import Any

from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy

from ._version import VERSION


class AdpManagementClientConfiguration(Configuration):
"""Configuration for AdpManagementClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
"""

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
**kwargs # type: Any
):
# type: (...) -> None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(AdpManagementClientConfiguration, self).__init__(**kwargs)

self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-mgmt-adp/{}'.format(VERSION))
self._configure(**kwargs)

def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
8 changes: 8 additions & 0 deletions sdk/adp/azure-mgmt-adp/azure/mgmt/adp/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# 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.
# --------------------------------------------------------------------------

VERSION = "0.1.0"
10 changes: 10 additions & 0 deletions sdk/adp/azure-mgmt-adp/azure/mgmt/adp/aio/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# 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 ._adp_management_client import AdpManagementClient
__all__ = ['AdpManagementClient']
136 changes: 136 additions & 0 deletions sdk/adp/azure-mgmt-adp/azure/mgmt/adp/aio/_adp_management_client.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# 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 azure.mgmt.core import AsyncARMPipelineClient
from msrest import Serializer, Deserializer

from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from ._configuration import AdpManagementClientConfiguration

class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Will be removed in final version of multiapi azure-core based client
"""
pass

class AdpManagementClient(MultiApiClientMixin, _SDKClient):
"""Microsoft Autonomous Development Platform.
This ready contains multiple API versions, to help you deal with all of the Azure clouds
(Azure Stack, Azure Government, Azure China, etc.).
By default, it uses the latest API version available on public Azure.
For production, you should stick to a particular api-version and/or profile.
The profile sets a mapping between an operation group and its API version.
The api-version parameter sets the default API version if the operation
group is not described in the profile.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str api_version: API version to use if no profile is provided, or if
missing in profile.
:param str base_url: Service URL
:param profile: A profile definition, from KnownProfiles to dict.
:type profile: azure.profiles.KnownProfiles
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""

DEFAULT_API_VERSION = '2020-07-01-preview'
_PROFILE_TAG = "azure.mgmt.adp.AdpManagementClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION,
}},
_PROFILE_TAG + " latest"
)

def __init__(
self,
credential, # type: "AsyncTokenCredential"
subscription_id, # type: str
api_version=None,
base_url=None,
profile=KnownProfiles.default,
**kwargs # type: Any
) -> None:
if not base_url:
base_url = 'https://management.azure.com'
self._config = AdpManagementClientConfiguration(credential, subscription_id, **kwargs)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(AdpManagementClient, self).__init__(
api_version=api_version,
profile=profile
)

@classmethod
def _models_dict(cls, api_version):
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}

@classmethod
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 2020-07-01-preview: :mod:`v2020_07_01_preview.models<azure.mgmt.adp.v2020_07_01_preview.models>`
"""
if api_version == '2020-07-01-preview':
from ..v2020_07_01_preview import models
return models
raise ValueError("API version {} is not available".format(api_version))

@property
def accounts(self):
"""Instance depends on the API version:
* 2020-07-01-preview: :class:`AccountsOperations<azure.mgmt.adp.v2020_07_01_preview.aio.operations.AccountsOperations>`
"""
api_version = self._get_api_version('accounts')
if api_version == '2020-07-01-preview':
from ..v2020_07_01_preview.aio.operations import AccountsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'accounts'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def data_pools(self):
"""Instance depends on the API version:
* 2020-07-01-preview: :class:`DataPoolsOperations<azure.mgmt.adp.v2020_07_01_preview.aio.operations.DataPoolsOperations>`
"""
api_version = self._get_api_version('data_pools')
if api_version == '2020-07-01-preview':
from ..v2020_07_01_preview.aio.operations import DataPoolsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'data_pools'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
def operations(self):
"""Instance depends on the API version:
* 2020-07-01-preview: :class:`Operations<azure.mgmt.adp.v2020_07_01_preview.aio.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2020-07-01-preview':
from ..v2020_07_01_preview.aio.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

async def close(self):
await self._client.close()
async def __aenter__(self):
await self._client.__aenter__()
return self
async def __aexit__(self, *exc_details):
await self._client.__aexit__(*exc_details)
Loading

0 comments on commit 1381e50

Please sign in to comment.