Skip to content

Commit

Permalink
[AutoRelease] t2-extendedlocation-2023-02-14-61697(can only be merged…
Browse files Browse the repository at this point in the history
… by SDK owner) (#28796)

* code and test

* update version

---------

Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
Co-authored-by: Zhenbiao Wei (WICRESOFT NORTH AMERICA LTD) <[email protected]>
  • Loading branch information
azure-sdk and Zhenbiao Wei (WICRESOFT NORTH AMERICA LTD) authored Feb 14, 2023
1 parent 4da5f96 commit d12ca3a
Show file tree
Hide file tree
Showing 86 changed files with 7,731 additions and 4,248 deletions.
7 changes: 7 additions & 0 deletions sdk/extendedlocation/azure-mgmt-extendedlocation/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release History

## 1.2.0b1 (2023-02-14)

### Other Changes

- Added generated samples in github repo
- Drop support for python<3.7.0

## 1.1.0 (2022-07-12)

**Features**
Expand Down
3 changes: 2 additions & 1 deletion sdk/extendedlocation/azure-mgmt-extendedlocation/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
include _meta.json
recursive-include tests *.py *.yaml
recursive-include tests *.py *.json
recursive-include samples *.py *.md
include *.md
include azure/__init__.py
include azure/mgmt/__init__.py
Expand Down
49 changes: 41 additions & 8 deletions sdk/extendedlocation/azure-mgmt-extendedlocation/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,59 @@
# Microsoft Azure SDK for Python

This is the Microsoft Azure Extended Location Management Client Library.
This package has been tested with Python 3.6+.
This package has been tested with Python 3.7+.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).

## _Disclaimer_

_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_

# Usage
## Getting started

### Prerequisites

To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
- Python 3.7+ is required to use this package.
- [Azure subscription](https://azure.microsoft.com/free/)

### Install the package

For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
Code samples for this package can be found at [Extended Location Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
```bash
pip install azure-mgmt-extendedlocation
pip install azure-identity
```

### Authentication

# Provide Feedback
By default, [Azure Active Directory](https://aka.ms/awps/aad) token authentication depends on correct configure of following environment variables.

- `AZURE_CLIENT_ID` for Azure client ID.
- `AZURE_TENANT_ID` for Azure tenant ID.
- `AZURE_CLIENT_SECRET` for Azure client secret.

In addition, Azure subscription ID can be configured via environment variable `AZURE_SUBSCRIPTION_ID`.

With above configuration, client can be authenticated by following code:

```python
from azure.identity import DefaultAzureCredential
from azure.mgmt.extendedlocation import CustomLocations
import os

sub_id = os.getenv("AZURE_SUBSCRIPTION_ID")
client = CustomLocations(credential=DefaultAzureCredential(), subscription_id=sub_id)
```

## Examples


Code samples for this package can be found at [Extended Location Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com and [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)


## Troubleshooting

## Next steps

## 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)
Expand Down
12 changes: 6 additions & 6 deletions sdk/extendedlocation/azure-mgmt-extendedlocation/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"autorest": "3.7.2",
"commit": "2f17a9028f33fe80cf1ae62642fe9ed63c0a17f7",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@5.16.0",
"@autorest/modelerfour@4.19.3"
"@autorest/python@6.4.0",
"@autorest/modelerfour@4.24.3"
],
"commit": "fda2db441da3f1fab31bb235e97da3e33c8e3903",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/extendedlocation/resource-manager/readme.md --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.7.2",
"autorest_command": "autorest specification/extendedlocation/resource-manager/readme.md --generate-sample=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/[email protected] --use=@autorest/[email protected] --version=3.9.2 --version-tolerant=False",
"readme": "specification/extendedlocation/resource-manager/readme.md"
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@
patch_sdk()
except ImportError:
pass

from ._version import VERSION

__version__ = VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from typing import TYPE_CHECKING
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
from azure.core.pipeline import policies
Expand All @@ -18,8 +18,6 @@

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

from azure.core.credentials import TokenCredential

class CustomLocationsConfiguration(Configuration):
Expand All @@ -28,19 +26,18 @@ class CustomLocationsConfiguration(Configuration):
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.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
"""

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
**kwargs # type: Any
credential: "TokenCredential",
subscription_id: str,
**kwargs: Any
):
# type: (...) -> None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
Expand All @@ -55,9 +52,8 @@ def __init__(

def _configure(
self,
**kwargs # type: Any
**kwargs: 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,17 @@
# regenerated.
# --------------------------------------------------------------------------

from typing import TYPE_CHECKING

from msrest import Deserializer, Serializer
from typing import Any, Optional, TYPE_CHECKING

from azure.mgmt.core import ARMPipelineClient
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin

from ._configuration import CustomLocationsConfiguration
from ._serialization import Deserializer, Serializer

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

from azure.core.credentials import TokenCredential

class _SDKClient(object):
Expand All @@ -43,9 +40,9 @@ class CustomLocations(MultiApiClientMixin, _SDKClient):
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.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription.
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param api_version: API version to use if no profile is provided, or if missing in profile.
:type api_version: str
Expand All @@ -67,12 +64,12 @@ class CustomLocations(MultiApiClientMixin, _SDKClient):

def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
api_version=None, # type: Optional[str]
base_url="https://management.azure.com", # type: str
profile=KnownProfiles.default, # type: KnownProfiles
**kwargs # type: Any
credential: "TokenCredential",
subscription_id: str,
api_version: Optional[str]=None,
base_url: str = "https://management.azure.com",
profile: KnownProfiles=KnownProfiles.default,
**kwargs: Any
):
self._config = CustomLocationsConfiguration(credential, subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
Expand Down Expand Up @@ -121,6 +118,7 @@ def custom_locations(self):
from .v2021_08_31_preview.operations import CustomLocationsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'custom_locations'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

@property
Expand All @@ -134,6 +132,7 @@ def resource_sync_rules(self):
from .v2021_08_31_preview.operations import ResourceSyncRulesOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'resource_sync_rules'".format(api_version))
self._config.api_version = api_version
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))

def close(self):
Expand Down
Loading

0 comments on commit d12ca3a

Please sign in to comment.