Skip to content

Commit

Permalink
[AutoRelease] t2-netapp-2022-12-27-30795(can only be merged by SDK ow…
Browse files Browse the repository at this point in the history
…ner) (#28069)

* code and test

* Update CHANGELOG.md

* Update _version.py

* fix readme

* update

---------

Co-authored-by: PythonSdkPipelines <PythonSdkPipelines>
Co-authored-by: zhenbiao wei <[email protected]>
Co-authored-by: Zhenbiao Wei (WICRESOFT NORTH AMERICA LTD) <[email protected]>
Co-authored-by: msyyc <[email protected]>
  • Loading branch information
4 people authored Feb 16, 2023
1 parent a991d82 commit b265c7f
Show file tree
Hide file tree
Showing 161 changed files with 8,655 additions and 4,160 deletions.
7 changes: 7 additions & 0 deletions sdk/netapp/azure-mgmt-netapp/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release History

## 9.0.2b1 (2023-02-16)

### Other Changes

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

## 9.0.1 (2022-10-26)

### Bugs Fixed
Expand Down
49 changes: 42 additions & 7 deletions sdk/netapp/azure-mgmt-netapp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,52 @@ For a more complete view of Azure libraries, see the [azure sdk python release](

_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)

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 [NetApp Files 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)
- Python 3.7+ is required to use this package.
- [Azure subscription](https://azure.microsoft.com/free/)

### Install the package

# Provide Feedback
```bash
pip install azure-mgmt-netapp
pip install azure-identity
```

### Authentication

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` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate.

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.netapp import NetAppManagementClient
import os

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

## Examples


Code samples for this package can be found at [NetApp Files 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
8 changes: 4 additions & 4 deletions sdk/netapp/azure-mgmt-netapp/_meta.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"commit": "89a9bf17524904e7670f0fd2d62ac882ca00d85c",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest": "3.9.2",
"use": [
"@autorest/python@6.1.11",
"@autorest/python@6.2.7",
"@autorest/[email protected]"
],
"commit": "d1eee5499dbf9281debdc90c4f4cbc7470fb8d6d",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"autorest_command": "autorest specification/netapp/resource-manager/readme.md --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",
"autorest_command": "autorest specification/netapp/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/netapp/resource-manager/readme.md"
}
6 changes: 4 additions & 2 deletions sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@

try:
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = ["NetAppManagementClient"]
__all__ = [
"NetAppManagementClient",
]
__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
13 changes: 8 additions & 5 deletions sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

import sys
from typing import Any, TYPE_CHECKING

from azure.core.configuration import Configuration
Expand All @@ -14,6 +15,11 @@

from ._version import VERSION

if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
Expand All @@ -37,7 +43,7 @@ class NetAppManagementClientConfiguration(Configuration): # pylint: disable=too

def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(NetAppManagementClientConfiguration, self).__init__(**kwargs)
api_version = kwargs.pop("api_version", "2022-05-01") # type: str
api_version: Literal["2022-05-01"] = kwargs.pop("api_version", "2022-05-01")

if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
Expand All @@ -51,10 +57,7 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs
kwargs.setdefault("sdk_moniker", "mgmt-netapp/{}".format(VERSION))
self._configure(**kwargs)

def _configure(
self, **kwargs # type: Any
):
# type: (...) -> None
def _configure(self, **kwargs: Any) -> 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 @@ -12,7 +12,7 @@
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient

from . import models
from . import models as _models
from ._configuration import NetAppManagementClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
Expand Down Expand Up @@ -98,7 +98,7 @@ def __init__(
)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)

client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
Expand Down Expand Up @@ -146,15 +146,12 @@ def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)

def close(self):
# type: () -> None
def close(self) -> None:
self._client.close()

def __enter__(self):
# type: () -> NetAppManagementClient
def __enter__(self) -> "NetAppManagementClient":
self._client.__enter__()
return self

def __exit__(self, *exc_details):
# type: (Any) -> None
def __exit__(self, *exc_details) -> None:
self._client.__exit__(*exc_details)
Loading

0 comments on commit b265c7f

Please sign in to comment.