Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1649 from 25region/autorest-image
Update Python SDK to Track 2
- Loading branch information
Showing
34 changed files
with
2,806 additions
and
2,529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
FROM registry.access.redhat.com/ubi8/nodejs-14 | ||
|
||
LABEL MAINTAINER="aos-azure" | ||
|
||
ARG AUTOREST_VERSION | ||
|
||
USER 0 | ||
|
||
# Autorest prerequisites | ||
RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && \ | ||
dnf update -y && \ | ||
dnf install -y libunwind-devel libicu && \ | ||
dnf install -y python3-pip && \ | ||
dnf clean all --enablerepo=\* | ||
|
||
USER 1001 | ||
|
||
# Autorest | ||
RUN npm install -g autorest@${AUTOREST_VERSION} && \ | ||
autorest --reset --allow-no-input --csharp --ruby --python --java --go --nodejs --typescript --azure-validator --preview && \ | ||
npm cache clean -f | ||
|
||
ENTRYPOINT ["autorest"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__path__ = __import__('pkgutil').extend_path(__path__, __name__) | ||
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__path__ = __import__('pkgutil').extend_path(__path__, __name__) | ||
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__path__ = __import__('pkgutil').extend_path(__path__, __name__) | ||
__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore |
25 changes: 10 additions & 15 deletions
25
python/client/azure/mgmt/redhatopenshift/v2020_04_30/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,24 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft and contributors. All rights reserved. | ||
# | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# | ||
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from ._configuration import AzureRedHatOpenShiftClientConfiguration | ||
from ._azure_red_hat_open_shift_client import AzureRedHatOpenShiftClient | ||
__all__ = ['AzureRedHatOpenShiftClient', 'AzureRedHatOpenShiftClientConfiguration'] | ||
|
||
from .version import VERSION | ||
|
||
__version__ = VERSION | ||
__all__ = ['AzureRedHatOpenShiftClient'] | ||
|
||
try: | ||
from ._patch import patch_sdk # type: ignore | ||
patch_sdk() | ||
except ImportError: | ||
pass |
94 changes: 66 additions & 28 deletions
94
python/client/azure/mgmt/redhatopenshift/v2020_04_30/_azure_red_hat_open_shift_client.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,102 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft and contributors. All rights reserved. | ||
# | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is | ||
# regenerated. | ||
# | ||
# Code generated by Microsoft (R) AutoRest Code Generator.Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from msrest.service_client import SDKClient | ||
from msrest import Serializer, Deserializer | ||
from typing import TYPE_CHECKING | ||
|
||
from azure.mgmt.core import ARMPipelineClient | ||
from msrest import Deserializer, Serializer | ||
|
||
if TYPE_CHECKING: | ||
# pylint: disable=unused-import,ungrouped-imports | ||
from typing import Any, Optional | ||
|
||
from azure.core.credentials import TokenCredential | ||
from azure.core.pipeline.transport import HttpRequest, HttpResponse | ||
|
||
from ._configuration import AzureRedHatOpenShiftClientConfiguration | ||
from .operations import Operations | ||
from .operations import OpenShiftClustersOperations | ||
from . import models | ||
|
||
|
||
class AzureRedHatOpenShiftClient(SDKClient): | ||
"""Rest API for Azure Red Hat OpenShift 4 | ||
:ivar config: Configuration for client. | ||
:vartype config: AzureRedHatOpenShiftClientConfiguration | ||
class AzureRedHatOpenShiftClient(object): | ||
"""Rest API for Azure Red Hat OpenShift 4. | ||
:ivar operations: Operations operations | ||
:vartype operations: azure.mgmt.redhatopenshift.v2020_04_30.operations.Operations | ||
:ivar open_shift_clusters: OpenShiftClusters operations | ||
:ivar open_shift_clusters: OpenShiftClustersOperations operations | ||
:vartype open_shift_clusters: azure.mgmt.redhatopenshift.v2020_04_30.operations.OpenShiftClustersOperations | ||
:param credentials: Credentials needed for the client to connect to Azure. | ||
:type credentials: :mod:`A msrestazure Credentials | ||
object<msrestazure.azure_active_directory>` | ||
: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 base_url: Service URL | ||
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. | ||
""" | ||
|
||
def __init__( | ||
self, credentials, subscription_id, base_url=None): | ||
|
||
self.config = AzureRedHatOpenShiftClientConfiguration(credentials, subscription_id, base_url) | ||
super(AzureRedHatOpenShiftClient, self).__init__(self.config.credentials, self.config) | ||
self, | ||
credential, # type: "TokenCredential" | ||
subscription_id, # type: str | ||
base_url=None, # type: Optional[str] | ||
**kwargs # type: Any | ||
): | ||
# type: (...) -> None | ||
if not base_url: | ||
base_url = 'https://management.azure.com' | ||
self._config = AzureRedHatOpenShiftClientConfiguration(credential, subscription_id, **kwargs) | ||
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)} | ||
self.api_version = '2020-04-30' | ||
self._serialize = Serializer(client_models) | ||
self._serialize.client_side_validation = False | ||
self._deserialize = Deserializer(client_models) | ||
|
||
self.operations = Operations( | ||
self._client, self.config, self._serialize, self._deserialize) | ||
self._client, self._config, self._serialize, self._deserialize) | ||
self.open_shift_clusters = OpenShiftClustersOperations( | ||
self._client, self.config, self._serialize, self._deserialize) | ||
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 | ||
""" | ||
path_format_arguments = { | ||
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1), | ||
} | ||
http_request.url = self._client.format_url(http_request.url, **path_format_arguments) | ||
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 | ||
self._client.close() | ||
|
||
def __enter__(self): | ||
# type: () -> AzureRedHatOpenShiftClient | ||
self._client.__enter__() | ||
return self | ||
|
||
def __exit__(self, *exc_details): | ||
# type: (Any) -> None | ||
self._client.__exit__(*exc_details) |
Oops, something went wrong.