Skip to content

Commit

Permalink
CodeGen from PR 16687 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 108950b36624ae7a4f1479f66a0d7bdfe03878e6 into f2e08ab
  • Loading branch information
SDKAuto committed Nov 9, 2021
1 parent 3121554 commit 319e41b
Show file tree
Hide file tree
Showing 27 changed files with 2,155 additions and 1,165 deletions.
1 change: 1 addition & 0 deletions sdk/subscription/azure-mgmt-subscription/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include _meta.json
recursive-include tests *.py *.yaml
include *.md
include azure/__init__.py
Expand Down
11 changes: 11 additions & 0 deletions sdk/subscription/azure-mgmt-subscription/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"autorest": "3.4.5",
"use": [
"@autorest/[email protected]",
"@autorest/[email protected]"
],
"commit": "af9eeae99a8224ceb9b311692f10b39b0e642e43",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/subscription/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.4.5",
"readme": "specification/subscription/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
# --------------------------------------------------------------------------

from ._subscription_client import SubscriptionClient
from ._version import VERSION

__version__ = VERSION
__all__ = ['SubscriptionClient']

try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy

from ._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any

from azure.core.credentials import TokenCredential

VERSION = "unknown"

class SubscriptionClientConfiguration(Configuration):
"""Configuration for SubscriptionClient.
Expand All @@ -41,6 +42,7 @@ def __init__(
super(SubscriptionClientConfiguration, self).__init__(**kwargs)

self.credential = credential
self.api_version = "2021-10-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-subscription/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"chosen_version": "2021-10-01",
"total_api_version_list": ["2021-10-01"],
"client": {
"name": "SubscriptionClient",
"filename": "_subscription_client",
"description": "The subscription client.",
"base_url": "\u0027https://management.azure.com\u0027",
"custom_base_url": null,
"azure_arm": true,
"has_lro_operations": true,
"client_side_validation": false,
"sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}",
"async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"SubscriptionClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}"
},
"global_parameters": {
"sync": {
"credential": {
"signature": "credential, # type: \"TokenCredential\"",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials.TokenCredential",
"required": true
}
},
"async": {
"credential": {
"signature": "credential: \"AsyncTokenCredential\",",
"description": "Credential needed for the client to connect to Azure.",
"docstring_type": "~azure.core.credentials_async.AsyncTokenCredential",
"required": true
}
},
"constant": {
},
"call": "credential",
"service_client_specific": {
"sync": {
"api_version": {
"signature": "api_version=None, # type: Optional[str]",
"description": "API version to use if no profile is provided, or if missing in profile.",
"docstring_type": "str",
"required": false
},
"base_url": {
"signature": "base_url=None, # type: Optional[str]",
"description": "Service URL",
"docstring_type": "str",
"required": false
},
"profile": {
"signature": "profile=KnownProfiles.default, # type: KnownProfiles",
"description": "A profile definition, from KnownProfiles to dict.",
"docstring_type": "azure.profiles.KnownProfiles",
"required": false
}
},
"async": {
"api_version": {
"signature": "api_version: Optional[str] = None,",
"description": "API version to use if no profile is provided, or if missing in profile.",
"docstring_type": "str",
"required": false
},
"base_url": {
"signature": "base_url: Optional[str] = None,",
"description": "Service URL",
"docstring_type": "str",
"required": false
},
"profile": {
"signature": "profile: KnownProfiles = KnownProfiles.default,",
"description": "A profile definition, from KnownProfiles to dict.",
"docstring_type": "azure.profiles.KnownProfiles",
"required": false
}
}
}
},
"config": {
"credential": true,
"credential_scopes": ["https://management.azure.com/.default"],
"credential_default_policy_type": "BearerTokenCredentialPolicy",
"credential_default_policy_type_has_async_version": true,
"credential_key_header_name": null,
"sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}",
"async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}"
},
"operation_groups": {
"subscription": "SubscriptionOperations",
"operations": "Operations",
"alias": "AliasOperations",
"subscription_policy": "SubscriptionPolicyOperations",
"billing_account": "BillingAccountOperations"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,30 @@
from typing import Any, Optional

from azure.core.credentials import TokenCredential
from azure.core.pipeline.transport import HttpRequest, HttpResponse

from ._configuration import SubscriptionClientConfiguration
from .operations import SubscriptionsOperations
from .operations import TenantsOperations
from .operations import SubscriptionOperations
from .operations import Operations
from .operations import AliasOperations
from .operations import SubscriptionPolicyOperations
from .operations import BillingAccountOperations
from . import models


class SubscriptionClient(object):
"""The subscription client.
:ivar subscriptions: SubscriptionsOperations operations
:vartype subscriptions: subscription_client.operations.SubscriptionsOperations
:ivar tenants: TenantsOperations operations
:vartype tenants: subscription_client.operations.TenantsOperations
:ivar subscription: SubscriptionOperations operations
:vartype subscription: subscription_client.operations.SubscriptionOperations
:vartype subscription: azure.mgmt.subscription.operations.SubscriptionOperations
:ivar operations: Operations operations
:vartype operations: subscription_client.operations.Operations
:vartype operations: azure.mgmt.subscription.operations.Operations
:ivar alias: AliasOperations operations
:vartype alias: subscription_client.operations.AliasOperations
:vartype alias: azure.mgmt.subscription.operations.AliasOperations
:ivar subscription_policy: SubscriptionPolicyOperations operations
:vartype subscription_policy: azure.mgmt.subscription.operations.SubscriptionPolicyOperations
:ivar billing_account: BillingAccountOperations operations
:vartype billing_account: azure.mgmt.subscription.operations.BillingAccountOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param str base_url: Service URL
Expand All @@ -62,16 +63,31 @@ def __init__(
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.subscriptions = SubscriptionsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.tenants = TenantsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.subscription = SubscriptionOperations(
self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self._config, self._serialize, self._deserialize)
self.alias = AliasOperations(
self._client, self._config, self._serialize, self._deserialize)
self.subscription_policy = SubscriptionPolicyOperations(
self._client, self._config, self._serialize, self._deserialize)
self.billing_account = BillingAccountOperations(
self._client, self._config, self._serialize, self._deserialize)

def _send_request(self, http_request, **kwargs):
# type: (HttpRequest, Any) -> HttpResponse
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.HttpResponse
"""
http_request.url = self._client.format_url(http_request.url)
stream = kwargs.pop("stream", True)
pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

def close(self):
# type: () -> None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "1.0.0"
VERSION = "1.0.0b1"
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy

from .._version import VERSION

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential

VERSION = "unknown"

class SubscriptionClientConfiguration(Configuration):
"""Configuration for SubscriptionClient.
Expand All @@ -38,6 +39,7 @@ def __init__(
super(SubscriptionClientConfiguration, self).__init__(**kwargs)

self.credential = credential
self.api_version = "2021-10-01"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-subscription/{}'.format(VERSION))
self._configure(**kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from typing import Any, Optional, TYPE_CHECKING

from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer

Expand All @@ -16,27 +17,27 @@
from azure.core.credentials_async import AsyncTokenCredential

from ._configuration import SubscriptionClientConfiguration
from .operations import SubscriptionsOperations
from .operations import TenantsOperations
from .operations import SubscriptionOperations
from .operations import Operations
from .operations import AliasOperations
from .operations import SubscriptionPolicyOperations
from .operations import BillingAccountOperations
from .. import models


class SubscriptionClient(object):
"""The subscription client.
:ivar subscriptions: SubscriptionsOperations operations
:vartype subscriptions: subscription_client.aio.operations.SubscriptionsOperations
:ivar tenants: TenantsOperations operations
:vartype tenants: subscription_client.aio.operations.TenantsOperations
:ivar subscription: SubscriptionOperations operations
:vartype subscription: subscription_client.aio.operations.SubscriptionOperations
:vartype subscription: azure.mgmt.subscription.aio.operations.SubscriptionOperations
:ivar operations: Operations operations
:vartype operations: subscription_client.aio.operations.Operations
:vartype operations: azure.mgmt.subscription.aio.operations.Operations
:ivar alias: AliasOperations operations
:vartype alias: subscription_client.aio.operations.AliasOperations
:vartype alias: azure.mgmt.subscription.aio.operations.AliasOperations
:ivar subscription_policy: SubscriptionPolicyOperations operations
:vartype subscription_policy: azure.mgmt.subscription.aio.operations.SubscriptionPolicyOperations
:ivar billing_account: BillingAccountOperations operations
:vartype billing_account: azure.mgmt.subscription.aio.operations.BillingAccountOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param str base_url: Service URL
Expand All @@ -59,16 +60,30 @@ def __init__(
self._serialize.client_side_validation = False
self._deserialize = Deserializer(client_models)

self.subscriptions = SubscriptionsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.tenants = TenantsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.subscription = SubscriptionOperations(
self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self._config, self._serialize, self._deserialize)
self.alias = AliasOperations(
self._client, self._config, self._serialize, self._deserialize)
self.subscription_policy = SubscriptionPolicyOperations(
self._client, self._config, self._serialize, self._deserialize)
self.billing_account = BillingAccountOperations(
self._client, self._config, self._serialize, self._deserialize)

async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse:
"""Runs the network request through the client's chained policies.
:param http_request: The network request you want to make. Required.
:type http_request: ~azure.core.pipeline.transport.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to True.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.pipeline.transport.AsyncHttpResponse
"""
http_request.url = self._client.format_url(http_request.url)
stream = kwargs.pop("stream", True)
pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs)
return pipeline_response.http_response

async def close(self) -> None:
await self._client.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._subscriptions_operations import SubscriptionsOperations
from ._tenants_operations import TenantsOperations
from ._subscription_operations import SubscriptionOperations
from ._operations import Operations
from ._alias_operations import AliasOperations
from ._subscription_policy_operations import SubscriptionPolicyOperations
from ._billing_account_operations import BillingAccountOperations

__all__ = [
'SubscriptionsOperations',
'TenantsOperations',
'SubscriptionOperations',
'Operations',
'AliasOperations',
'SubscriptionPolicyOperations',
'BillingAccountOperations',
]
Loading

0 comments on commit 319e41b

Please sign in to comment.