Skip to content

Commit 94884a6

Browse files
SDKAuto00Kai0
andcommitted
CodeGen from PR 13446 in Azure/azure-rest-api-specs
Add the march public preview API version of extended location (Azure#13446) * Add the march public preview API version of extended location * Tweak: remove references to iot * Address comments from Phoenix by removing 500 references and adding back the default version tag * Revert privatepreview changes * Tweak: remove "500" from the swagger itself * Tweak: remove dash from readme * fix python pipeline * Tweak: run prettier against the repo folder * Tweak: remove 404 from customlocations.json and CustomLocationsGet.json * Tweak: csharp README sdk output folder path to fix downstream generation issue Co-authored-by: 00Kai0 <[email protected]>
1 parent 388beb9 commit 94884a6

35 files changed

+4018
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Release History
2+
3+
## 0.1.0 (1970-01-01)
4+
5+
* Initial Release
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
recursive-include tests *.py *.yaml
2+
include *.md
3+
include azure/__init__.py
4+
include azure/mgmt/__init__.py
5+
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Microsoft Azure SDK for Python
2+
3+
This is the Microsoft Azure MyService Management Client Library.
4+
This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8.
5+
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
6+
7+
8+
# Usage
9+
10+
11+
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
12+
13+
14+
15+
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
16+
Code samples for this package can be found at [MyService Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
17+
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
18+
19+
20+
# Provide Feedback
21+
22+
If you encounter any bugs or have suggestions, please file an issue in the
23+
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
24+
section of the project.
25+
26+
27+
![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-extendedlocation%2FREADME.png)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__('pkgutil').extend_path(__path__, __name__)
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from ._custom_locations import CustomLocations
10+
__all__ = ['CustomLocations']
11+
12+
try:
13+
from ._patch import patch_sdk # type: ignore
14+
patch_sdk()
15+
except ImportError:
16+
pass
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
from typing import Any
12+
13+
from azure.core.configuration import Configuration
14+
from azure.core.pipeline import policies
15+
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
16+
17+
from ._version import VERSION
18+
19+
20+
class CustomLocationsConfiguration(Configuration):
21+
"""Configuration for CustomLocations.
22+
23+
Note that all parameters used to create this instance are saved as instance
24+
attributes.
25+
26+
:param credential: Credential needed for the client to connect to Azure.
27+
:type credential: ~azure.core.credentials.TokenCredential
28+
:param subscription_id: The ID of the target subscription.
29+
:type subscription_id: str
30+
"""
31+
32+
def __init__(
33+
self,
34+
credential, # type: "TokenCredential"
35+
subscription_id, # type: str
36+
**kwargs # type: Any
37+
):
38+
# type: (...) -> None
39+
if credential is None:
40+
raise ValueError("Parameter 'credential' must not be None.")
41+
if subscription_id is None:
42+
raise ValueError("Parameter 'subscription_id' must not be None.")
43+
super(CustomLocationsConfiguration, self).__init__(**kwargs)
44+
45+
self.credential = credential
46+
self.subscription_id = subscription_id
47+
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
48+
kwargs.setdefault('sdk_moniker', 'azure-mgmt-extendedlocation/{}'.format(VERSION))
49+
self._configure(**kwargs)
50+
51+
def _configure(
52+
self,
53+
**kwargs # type: Any
54+
):
55+
# type: (...) -> None
56+
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
57+
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
58+
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
59+
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
60+
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
61+
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
62+
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
63+
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
64+
self.authentication_policy = kwargs.get('authentication_policy')
65+
if self.credential and not self.authentication_policy:
66+
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
#
7+
# Code generated by Microsoft (R) AutoRest Code Generator.
8+
# Changes may cause incorrect behavior and will be lost if the code is
9+
# regenerated.
10+
# --------------------------------------------------------------------------
11+
12+
from azure.mgmt.core import ARMPipelineClient
13+
from msrest import Serializer, Deserializer
14+
15+
from azure.profiles import KnownProfiles, ProfileDefinition
16+
from azure.profiles.multiapiclient import MultiApiClientMixin
17+
from ._configuration import CustomLocationsConfiguration
18+
19+
class _SDKClient(object):
20+
def __init__(self, *args, **kwargs):
21+
"""This is a fake class to support current implemetation of MultiApiClientMixin."
22+
Will be removed in final version of multiapi azure-core based client
23+
"""
24+
pass
25+
26+
class CustomLocations(MultiApiClientMixin, _SDKClient):
27+
"""The customLocations Rest API spec.
28+
29+
This ready contains multiple API versions, to help you deal with all of the Azure clouds
30+
(Azure Stack, Azure Government, Azure China, etc.).
31+
By default, it uses the latest API version available on public Azure.
32+
For production, you should stick to a particular api-version and/or profile.
33+
The profile sets a mapping between an operation group and its API version.
34+
The api-version parameter sets the default API version if the operation
35+
group is not described in the profile.
36+
37+
:param credential: Credential needed for the client to connect to Azure.
38+
:type credential: ~azure.core.credentials.TokenCredential
39+
:param subscription_id: The ID of the target subscription.
40+
:type subscription_id: str
41+
:param str api_version: API version to use if no profile is provided, or if
42+
missing in profile.
43+
:param str base_url: Service URL
44+
:param profile: A profile definition, from KnownProfiles to dict.
45+
:type profile: azure.profiles.KnownProfiles
46+
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
47+
"""
48+
49+
DEFAULT_API_VERSION = '2020-07-15-privatepreview'
50+
_PROFILE_TAG = "azure.mgmt.extendedlocation.CustomLocations"
51+
LATEST_PROFILE = ProfileDefinition({
52+
_PROFILE_TAG: {
53+
None: DEFAULT_API_VERSION,
54+
}},
55+
_PROFILE_TAG + " latest"
56+
)
57+
58+
def __init__(
59+
self,
60+
credential, # type: "TokenCredential"
61+
subscription_id, # type: str
62+
api_version=None,
63+
base_url=None,
64+
profile=KnownProfiles.default,
65+
**kwargs # type: Any
66+
):
67+
if not base_url:
68+
base_url = 'https://management.azure.com'
69+
self._config = CustomLocationsConfiguration(credential, subscription_id, **kwargs)
70+
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
71+
super(CustomLocations, self).__init__(
72+
api_version=api_version,
73+
profile=profile
74+
)
75+
76+
@classmethod
77+
def _models_dict(cls, api_version):
78+
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
79+
80+
@classmethod
81+
def models(cls, api_version=DEFAULT_API_VERSION):
82+
"""Module depends on the API version:
83+
84+
* 2020-07-15-privatepreview: :mod:`v2020_07_15_privatepreview.models<azure.mgmt.extendedlocation.v2020_07_15_privatepreview.models>`
85+
"""
86+
if api_version == '2020-07-15-privatepreview':
87+
from .v2020_07_15_privatepreview import models
88+
return models
89+
raise ValueError("API version {} is not available".format(api_version))
90+
91+
@property
92+
def custom_locations(self):
93+
"""Instance depends on the API version:
94+
95+
* 2020-07-15-privatepreview: :class:`CustomLocationsOperations<azure.mgmt.extendedlocation.v2020_07_15_privatepreview.operations.CustomLocationsOperations>`
96+
"""
97+
api_version = self._get_api_version('custom_locations')
98+
if api_version == '2020-07-15-privatepreview':
99+
from .v2020_07_15_privatepreview.operations import CustomLocationsOperations as OperationClass
100+
else:
101+
raise ValueError("API version {} does not have operation group 'custom_locations'".format(api_version))
102+
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
103+
104+
def close(self):
105+
self._client.close()
106+
def __enter__(self):
107+
self._client.__enter__()
108+
return self
109+
def __exit__(self, *exc_details):
110+
self._client.__exit__(*exc_details)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for
5+
# license information.
6+
# --------------------------------------------------------------------------
7+
8+
VERSION = "0.1.0"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) AutoRest Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from ._custom_locations import CustomLocations
10+
__all__ = ['CustomLocations']

0 commit comments

Comments
 (0)