Merge pull request #33 from mjudeikis/python.sdk

[WIP] Add python SDK generation to submodule
This commit is contained in:
Jim Minter 2019-12-06 13:53:04 -06:00 коммит произвёл GitHub
Родитель 7bb0236a7f f2382c78cb
Коммит 1804906446
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
20 изменённых файлов: 2344 добавлений и 5 удалений

Просмотреть файл

@ -1 +1 @@
20bf138d803be1a4dbaa0804b11fca15e7a46cda4f74dd7983bcbe3a1cac98ac swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2019-12-31-preview/redhatopenshift.json
f036335f93c0f7080765ceefbb7b217be5d05e2a5abf21f3f977f13e46e1cc68 swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2019-12-31-preview/redhatopenshift.json

Просмотреть файл

@ -8,8 +8,10 @@ clean:
client:
go generate ./...
rm -rf pkg/client
rm -rf azure-python-sdk pkg/client
mkdir azure-python-sdk pkg/client
sha256sum swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2019-12-31-preview/redhatopenshift.json >.sha256sum
sudo docker run \
-v $(PWD)/pkg/client:/github.com/jim-minter/rp/pkg/client \
-v $(PWD)/swagger:/swagger \
@ -19,7 +21,18 @@ client:
--input-file=/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2019-12-31-preview/redhatopenshift.json \
--output-folder=/github.com/jim-minter/rp/pkg/client/services/preview/redhatopenshift/mgmt/2019-12-31-preview/redhatopenshift
sudo chown -R $(USER):$(USER) pkg/client
sudo docker run \
-v $(PWD)/azure-python-sdk:/azure-python-sdk \
-v $(PWD)/swagger:/swagger \
azuresdk/autorest \
--use=@microsoft.azure/autorest.python@4.0.70 \
--python \
--azure-arm \
--input-file=/swagger/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/preview/2019-12-31-preview/redhatopenshift.json \
--output-folder=/azure-python-sdk/2019-12-31-preview
sudo chown -R $(USER):$(USER) azure-python-sdk pkg/client
go run ./vendor/golang.org/x/tools/cmd/goimports -w -local=github.com/jim-minter/rp pkg/client
image: rp

Просмотреть файл

@ -0,0 +1,15 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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

Просмотреть файл

@ -0,0 +1,52 @@
# coding=utf-8
# --------------------------------------------------------------------------
# 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 ._configuration import AzureRedHatOpenShiftClientConfiguration
from .operations import Operations
from .operations import OpenShiftClustersOperations
from . import models
class AzureRedHatOpenShiftClient(SDKClient):
"""Rest API for Azure Red Hat OpenShift
:ivar config: Configuration for client.
:vartype config: AzureRedHatOpenShiftClientConfiguration
:ivar operations: Operations operations
:vartype operations: redhatopenshift.operations.Operations
:ivar open_shift_clusters: OpenShiftClusters operations
:vartype open_shift_clusters: redhatopenshift.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 subscription_id: Subscription credentials which uniquely identify
Microsoft Azure subscription. The subscription ID forms part of the URI
for every service call.
:type subscription_id: str
:param str base_url: Service URL
"""
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)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2019-12-31-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(
self._client, self.config, self._serialize, self._deserialize)

Просмотреть файл

@ -0,0 +1,46 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrestazure import AzureConfiguration
from .version import VERSION
class AzureRedHatOpenShiftClientConfiguration(AzureConfiguration):
"""Configuration for AzureRedHatOpenShiftClient
Note that all parameters used to create this instance are saved as instance
attributes.
:param credentials: Credentials needed for the client to connect to Azure.
:type credentials: :mod:`A msrestazure Credentials
object<msrestazure.azure_active_directory>`
:param subscription_id: Subscription credentials which uniquely identify
Microsoft Azure subscription. The subscription ID forms part of the URI
for every service call.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
if credentials is None:
raise ValueError("Parameter 'credentials' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
if not base_url:
base_url = 'https://management.azure.com'
super(AzureRedHatOpenShiftClientConfiguration, self).__init__(base_url)
# Starting Autorest.Python 4.0.64, make connection pool activated by default
self.keep_alive = True
self.add_user_agent('azureredhatopenshiftclient/{}'.format(VERSION))
self.add_user_agent('Azure-SDK-For-Python')
self.credentials = credentials
self.subscription_id = subscription_id

Просмотреть файл

@ -0,0 +1,9 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ._azure_red_hat_open_shift_client_async import AzureRedHatOpenShiftClient
__all__ = ['AzureRedHatOpenShiftClient']

Просмотреть файл

@ -0,0 +1,52 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.async_client import SDKClientAsync
from msrest import Serializer, Deserializer
from .._configuration import AzureRedHatOpenShiftClientConfiguration
from .operations_async import Operations
from .operations_async import OpenShiftClustersOperations
from .. import models
class AzureRedHatOpenShiftClient(SDKClientAsync):
"""Rest API for Azure Red Hat OpenShift
:ivar config: Configuration for client.
:vartype config: AzureRedHatOpenShiftClientConfiguration
:ivar operations: Operations operations
:vartype operations: redhatopenshift.operations.Operations
:ivar open_shift_clusters: OpenShiftClusters operations
:vartype open_shift_clusters: redhatopenshift.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 subscription_id: Subscription credentials which uniquely identify
Microsoft Azure subscription. The subscription ID forms part of the URI
for every service call.
:type subscription_id: str
:param str base_url: Service URL
"""
def __init__(
self, credentials, subscription_id, base_url=None):
self.config = AzureRedHatOpenShiftClientConfiguration(credentials, subscription_id, base_url)
super(AzureRedHatOpenShiftClient, self).__init__(self.config)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self.api_version = '2019-12-31-preview'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.operations = Operations(
self._client, self.config, self._serialize, self._deserialize)
self.open_shift_clusters = OpenShiftClustersOperations(
self._client, self.config, self._serialize, self._deserialize)

Просмотреть файл

@ -0,0 +1,14 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ._operations_async import Operations
from ._open_shift_clusters_operations_async import OpenShiftClustersOperations
__all__ = [
'Operations',
'OpenShiftClustersOperations',
]

Просмотреть файл

@ -0,0 +1,581 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from msrest.polling.async_poller import async_poller, AsyncNoPolling
from msrestazure.polling.async_arm_polling import AsyncARMPolling
from ... import models
class OpenShiftClustersOperations:
"""OpenShiftClustersOperations async operations.
You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Client API version. Constant value: "2019-12-31-preview".
"""
models = models
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2019-12-31-preview"
self.config = config
async def list(
self, *, custom_headers=None, raw=False, **operation_config):
"""Lists OpenShift clusters in the specified subscription.
Lists OpenShift clusters in the specified subscription. The operation
returns properties of each OpenShift cluster.
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: OpenShiftClusterList or ClientRawResponse if raw=true
:rtype: ~redhatopenshift.models.OpenShiftClusterList or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.list.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = await self._client.async_send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OpenShiftClusterList', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters'}
async def list_by_resource_group(
self, resource_group_name, *, custom_headers=None, raw=False, **operation_config):
"""Lists OpenShift clusters in the specified subscription and resource
group.
Lists OpenShift clusters in the specified subscription and resource
group. The operation returns properties of each OpenShift cluster.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: OpenShiftClusterList or ClientRawResponse if raw=true
:rtype: ~redhatopenshift.models.OpenShiftClusterList or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.list_by_resource_group.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = await self._client.async_send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OpenShiftClusterList', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters'}
async def get(
self, resource_group_name, resource_name, *, custom_headers=None, raw=False, **operation_config):
"""Gets a OpenShift cluster with the specified subscription, resource
group and resource name.
Gets a OpenShift cluster with the specified subscription, resource
group and resource name. The operation returns properties of a
OpenShift cluster.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource.
:type resource_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: OpenShiftCluster or ClientRawResponse if raw=true
:rtype: ~redhatopenshift.models.OpenShiftCluster or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.get.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'resourceName': self._serialize.url("resource_name", resource_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = await self._client.async_send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OpenShiftCluster', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}'}
async def _create_initial(
self, resource_group_name, resource_name, parameters, *, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.create.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'resourceName': self._serialize.url("resource_name", resource_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(parameters, 'OpenShiftCluster')
# Construct and send request
request = self._client.put(url, query_parameters, header_parameters, body_content)
response = await self._client.async_send(request, stream=False, **operation_config)
if response.status_code not in [200, 201]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OpenShiftCluster', response)
if response.status_code == 201:
deserialized = self._deserialize('OpenShiftCluster', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
async def create(
self, resource_group_name, resource_name, parameters, *, custom_headers=None, raw=False, polling=True, **operation_config):
"""Creates or updates a OpenShift cluster with the specified subscription,
resource group and resource name.
Creates or updates a OpenShift cluster with the specified subscription,
resource group and resource name. The operation returns properties of
a OpenShift cluster.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource.
:type resource_name: str
:param parameters: The OpenShift cluster resource.
:type parameters: ~redhatopenshift.models.OpenShiftCluster
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
:param polling: True for AsyncARMPolling, False for no polling, or a
polling object for personal polling strategy
:return: An instance of OpenShiftCluster or
ClientRawResponse<OpenShiftCluster> if raw==True
:rtype: ~~redhatopenshift.models.OpenShiftCluster or
~msrest.pipeline.ClientRawResponse[~redhatopenshift.models.OpenShiftCluster]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
raw_result = await self._create_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
parameters=parameters,
custom_headers=custom_headers,
raw=True,
**operation_config
)
def get_long_running_output(response):
deserialized = self._deserialize('OpenShiftCluster', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
lro_delay = operation_config.get(
'long_running_operation_timeout',
self.config.long_running_operation_timeout)
if polling is True: polling_method = AsyncARMPolling(lro_delay, **operation_config)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}'}
async def _delete_initial(
self, resource_group_name, resource_name, *, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.delete.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'resourceName': self._serialize.url("resource_name", resource_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
response = await self._client.async_send(request, stream=False, **operation_config)
if response.status_code not in [200, 204]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
async def delete(
self, resource_group_name, resource_name, *, custom_headers=None, raw=False, polling=True, **operation_config):
"""Deletes a OpenShift cluster with the specified subscription, resource
group and resource name.
Deletes a OpenShift cluster with the specified subscription, resource
group and resource name. The operation returns nothing.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource.
:type resource_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
:param polling: True for AsyncARMPolling, False for no polling, or a
polling object for personal polling strategy
:return: An instance of None or ClientRawResponse<None> if raw==True
:rtype: ~None or ~msrest.pipeline.ClientRawResponse[None]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
custom_headers=custom_headers,
raw=True,
**operation_config
)
def get_long_running_output(response):
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
lro_delay = operation_config.get(
'long_running_operation_timeout',
self.config.long_running_operation_timeout)
if polling is True: polling_method = AsyncARMPolling(lro_delay, **operation_config)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}'}
async def _update_initial(
self, resource_group_name, resource_name, parameters, *, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.update.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'resourceName': self._serialize.url("resource_name", resource_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(parameters, 'OpenShiftCluster')
# Construct and send request
request = self._client.patch(url, query_parameters, header_parameters, body_content)
response = await self._client.async_send(request, stream=False, **operation_config)
if response.status_code not in [200, 201]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OpenShiftCluster', response)
if response.status_code == 201:
deserialized = self._deserialize('OpenShiftCluster', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
async def update(
self, resource_group_name, resource_name, parameters, *, custom_headers=None, raw=False, polling=True, **operation_config):
"""Creates or updates a OpenShift cluster with the specified subscription,
resource group and resource name.
Creates or updates a OpenShift cluster with the specified subscription,
resource group and resource name. The operation returns properties of
a OpenShift cluster.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource.
:type resource_name: str
:param parameters: The OpenShift cluster resource.
:type parameters: ~redhatopenshift.models.OpenShiftCluster
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
:param polling: True for AsyncARMPolling, False for no polling, or a
polling object for personal polling strategy
:return: An instance of OpenShiftCluster or
ClientRawResponse<OpenShiftCluster> if raw==True
:rtype: ~~redhatopenshift.models.OpenShiftCluster or
~msrest.pipeline.ClientRawResponse[~redhatopenshift.models.OpenShiftCluster]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
raw_result = await self._update_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
parameters=parameters,
custom_headers=custom_headers,
raw=True,
**operation_config
)
def get_long_running_output(response):
deserialized = self._deserialize('OpenShiftCluster', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
lro_delay = operation_config.get(
'long_running_operation_timeout',
self.config.long_running_operation_timeout)
if polling is True: polling_method = AsyncARMPolling(lro_delay, **operation_config)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}'}
async def get_credentials(
self, resource_group_name, resource_name, *, custom_headers=None, raw=False, **operation_config):
"""Gets credentials of a OpenShift cluster with the specified
subscription, resource group and resource name.
Gets credentials of a OpenShift cluster with the specified
subscription, resource group and resource name. The operation returns
the credentials.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource.
:type resource_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: OpenShiftClusterCredentials or ClientRawResponse if raw=true
:rtype: ~redhatopenshift.models.OpenShiftClusterCredentials or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.get_credentials.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'resourceName': self._serialize.url("resource_name", resource_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.post(url, query_parameters, header_parameters)
response = await self._client.async_send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OpenShiftClusterCredentials', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/credentials'}

Просмотреть файл

@ -0,0 +1,90 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from ... import models
class Operations:
"""Operations async operations.
You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Client API version. Constant value: "2019-12-31-preview".
"""
models = models
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2019-12-31-preview"
self.config = config
async def list(
self, *, custom_headers=None, raw=False, **operation_config):
"""Lists all of the available RP operations.
Lists all of the available RP operations. The operation returns the
operations.
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: OperationList or ClientRawResponse if raw=true
:rtype: ~redhatopenshift.models.OperationList or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.list.metadata['url']
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = await self._client.async_send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OperationList', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
list.metadata = {'url': '/providers/Microsoft.RedHatOpenShift/operations'}

Просмотреть файл

@ -0,0 +1,48 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
try:
from ._models_py3 import CloudError, CloudErrorException
from ._models_py3 import CloudErrorBody
from ._models_py3 import Display
from ._models_py3 import MasterProfile
from ._models_py3 import NetworkProfile
from ._models_py3 import OpenShiftCluster
from ._models_py3 import OpenShiftClusterCredentials
from ._models_py3 import OpenShiftClusterList
from ._models_py3 import Operation
from ._models_py3 import OperationList
from ._models_py3 import ServicePrincipalProfile
from ._models_py3 import WorkerProfile
except (SyntaxError, ImportError):
from ._models import CloudError, CloudErrorException
from ._models import CloudErrorBody
from ._models import Display
from ._models import MasterProfile
from ._models import NetworkProfile
from ._models import OpenShiftCluster
from ._models import OpenShiftClusterCredentials
from ._models import OpenShiftClusterList
from ._models import Operation
from ._models import OperationList
from ._models import ServicePrincipalProfile
from ._models import WorkerProfile
__all__ = [
'CloudError', 'CloudErrorException',
'CloudErrorBody',
'Display',
'MasterProfile',
'NetworkProfile',
'OpenShiftCluster',
'OpenShiftClusterCredentials',
'OpenShiftClusterList',
'Operation',
'OperationList',
'ServicePrincipalProfile',
'WorkerProfile',
]

Просмотреть файл

@ -0,0 +1,334 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
from msrest.exceptions import HttpOperationError
class CloudError(Model):
"""CloudError represents a cloud error.
:param error: An error response from the service.
:type error: ~redhatopenshift.models.CloudErrorBody
"""
_attribute_map = {
'error': {'key': 'error', 'type': 'CloudErrorBody'},
}
def __init__(self, **kwargs):
super(CloudError, self).__init__(**kwargs)
self.error = kwargs.get('error', None)
class CloudErrorException(HttpOperationError):
"""Server responsed with exception of type: 'CloudError'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""
def __init__(self, deserialize, response, *args):
super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args)
class CloudErrorBody(Model):
"""CloudErrorBody represents the body of a cloud error.
:param code: An identifier for the error. Codes are invariant and are
intended to be consumed programmatically.
:type code: str
:param message: A message describing the error, intended to be suitable
for display in a user interface.
:type message: str
:param target: The target of the particular error. For example, the name
of the property in error.
:type target: str
:param details: A list of additional details about the error.
:type details: list[~redhatopenshift.models.CloudErrorBody]
"""
_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
'target': {'key': 'target', 'type': 'str'},
'details': {'key': 'details', 'type': '[CloudErrorBody]'},
}
def __init__(self, **kwargs):
super(CloudErrorBody, self).__init__(**kwargs)
self.code = kwargs.get('code', None)
self.message = kwargs.get('message', None)
self.target = kwargs.get('target', None)
self.details = kwargs.get('details', None)
class Display(Model):
"""Display represents the display details of an operation.
:param provider: Friendly name of the resource provider.
:type provider: str
:param resource: Resource type on which the operation is performed.
:type resource: str
:param operation: Operation type: read, write, delete, listKeys/action,
etc.
:type operation: str
:param description: Friendly name of the operation.
:type description: str
"""
_attribute_map = {
'provider': {'key': 'provider', 'type': 'str'},
'resource': {'key': 'resource', 'type': 'str'},
'operation': {'key': 'operation', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
}
def __init__(self, **kwargs):
super(Display, self).__init__(**kwargs)
self.provider = kwargs.get('provider', None)
self.resource = kwargs.get('resource', None)
self.operation = kwargs.get('operation', None)
self.description = kwargs.get('description', None)
class MasterProfile(Model):
"""MasterProfile represents a master profile.
:param vm_size: The size of the master VMs (immutable). Possible values
include: 'Standard_D2s_v3', 'Standard_D4s_v3', 'Standard_D8s_v3'
:type vm_size: str or ~redhatopenshift.models.enum
:param subnet_id: The Azure resource ID of the worker subnet (immutable).
:type subnet_id: str
"""
_attribute_map = {
'vm_size': {'key': 'vmSize', 'type': 'str'},
'subnet_id': {'key': 'subnetId', 'type': 'str'},
}
def __init__(self, **kwargs):
super(MasterProfile, self).__init__(**kwargs)
self.vm_size = kwargs.get('vm_size', None)
self.subnet_id = kwargs.get('subnet_id', None)
class NetworkProfile(Model):
"""NetworkProfile represents a network profile.
:param pod_cidr: The CIDR used for OpenShift/Kubernetes Pods (immutable).
:type pod_cidr: str
:param service_cidr: The CIDR used for OpenShift/Kubernetes Services
(immutable).
:type service_cidr: str
"""
_attribute_map = {
'pod_cidr': {'key': 'podCidr', 'type': 'str'},
'service_cidr': {'key': 'serviceCidr', 'type': 'str'},
}
def __init__(self, **kwargs):
super(NetworkProfile, self).__init__(**kwargs)
self.pod_cidr = kwargs.get('pod_cidr', None)
self.service_cidr = kwargs.get('service_cidr', None)
class OpenShiftCluster(Model):
"""OpenShiftCluster represents an Azure Red Hat OpenShift cluster.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: The resource ID (immutable).
:vartype id: str
:ivar name: The resource name (immutable).
:vartype name: str
:ivar type: The resource type (immutable).
:vartype type: str
:param location: The resource location (immutable).
:type location: str
:param tags: The resource tags.
:type tags: dict[str, str]
:param provisioning_state: The cluster provisioning state (immutable).
Possible values include: 'Creating', 'Deleting', 'Failed', 'Succeeded',
'Updating'
:type provisioning_state: str or ~redhatopenshift.models.enum
:param service_principal_profile: The cluster service principal profile.
:type service_principal_profile:
~redhatopenshift.models.ServicePrincipalProfile
:param network_profile: The cluster network profile.
:type network_profile: ~redhatopenshift.models.NetworkProfile
:param master_profile: The cluster master profile.
:type master_profile: ~redhatopenshift.models.MasterProfile
:param worker_profiles: The cluster worker profiles.
:type worker_profiles: list[~redhatopenshift.models.WorkerProfile]
:param apiserver_url: The URL to access the cluster API server
(immutable).
:type apiserver_url: str
:param console_url: The URL to access the cluster console (immutable).
:type console_url: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ServicePrincipalProfile'},
'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'},
'master_profile': {'key': 'properties.masterProfile', 'type': 'MasterProfile'},
'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'},
'apiserver_url': {'key': 'properties.apiserverUrl', 'type': 'str'},
'console_url': {'key': 'properties.consoleUrl', 'type': 'str'},
}
def __init__(self, **kwargs):
super(OpenShiftCluster, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None
self.location = kwargs.get('location', None)
self.tags = kwargs.get('tags', None)
self.provisioning_state = kwargs.get('provisioning_state', None)
self.service_principal_profile = kwargs.get('service_principal_profile', None)
self.network_profile = kwargs.get('network_profile', None)
self.master_profile = kwargs.get('master_profile', None)
self.worker_profiles = kwargs.get('worker_profiles', None)
self.apiserver_url = kwargs.get('apiserver_url', None)
self.console_url = kwargs.get('console_url', None)
class OpenShiftClusterCredentials(Model):
"""OpenShiftClusterCredentials represents an OpenShift cluster's credentials.
:param kubeadmin_password: The password for the kubeadmin user
:type kubeadmin_password: str
"""
_attribute_map = {
'kubeadmin_password': {'key': 'kubeadminPassword', 'type': 'str'},
}
def __init__(self, **kwargs):
super(OpenShiftClusterCredentials, self).__init__(**kwargs)
self.kubeadmin_password = kwargs.get('kubeadmin_password', None)
class OpenShiftClusterList(Model):
"""OpenShiftClusterList represents a list of OpenShift clusters.
:param value: The list of OpenShift clusters.
:type value: list[~redhatopenshift.models.OpenShiftCluster]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[OpenShiftCluster]'},
}
def __init__(self, **kwargs):
super(OpenShiftClusterList, self).__init__(**kwargs)
self.value = kwargs.get('value', None)
class Operation(Model):
"""Operation represents an operation.
:param name: Operation name: {provider}/{resource}/{operation}.
:type name: str
:param display: The object that describes the operation.
:type display: ~redhatopenshift.models.Display
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'display': {'key': 'display', 'type': 'Display'},
}
def __init__(self, **kwargs):
super(Operation, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.display = kwargs.get('display', None)
class OperationList(Model):
"""OperationList represents an operation list.
:param value: List of operations supported by the resource provider.
:type value: list[~redhatopenshift.models.Operation]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Operation]'},
}
def __init__(self, **kwargs):
super(OperationList, self).__init__(**kwargs)
self.value = kwargs.get('value', None)
class ServicePrincipalProfile(Model):
"""ServicePrincipalProfile represents a service principal profile.
:param client_id: The client ID used for the cluster
:type client_id: str
:param client_secret: The client secret used for the cluster
:type client_secret: str
"""
_attribute_map = {
'client_id': {'key': 'clientId', 'type': 'str'},
'client_secret': {'key': 'clientSecret', 'type': 'str'},
}
def __init__(self, **kwargs):
super(ServicePrincipalProfile, self).__init__(**kwargs)
self.client_id = kwargs.get('client_id', None)
self.client_secret = kwargs.get('client_secret', None)
class WorkerProfile(Model):
"""WorkerProfile represents a worker profile.
:param name: The worker profile name. Must be "worker" (immutable).
:type name: str
:param vm_size: The size of the worker VMs (immutable). Possible values
include: 'Standard_D2s_v3', 'Standard_D4s_v3', 'Standard_D8s_v3'
:type vm_size: str or ~redhatopenshift.models.enum
:param disk_size_gb: The disk size of the worker VMs. Must be 128 or
greater (immutable).
:type disk_size_gb: int
:param subnet_id: The Azure resource ID of the worker subnet (immutable).
:type subnet_id: str
:param count: The number of worker VMs. Must be between 3 and 20.
:type count: int
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'vm_size': {'key': 'vmSize', 'type': 'str'},
'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'},
'subnet_id': {'key': 'subnetId', 'type': 'str'},
'count': {'key': 'count', 'type': 'int'},
}
def __init__(self, **kwargs):
super(WorkerProfile, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.vm_size = kwargs.get('vm_size', None)
self.disk_size_gb = kwargs.get('disk_size_gb', None)
self.subnet_id = kwargs.get('subnet_id', None)
self.count = kwargs.get('count', None)

Просмотреть файл

@ -0,0 +1,334 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from msrest.serialization import Model
from msrest.exceptions import HttpOperationError
class CloudError(Model):
"""CloudError represents a cloud error.
:param error: An error response from the service.
:type error: ~redhatopenshift.models.CloudErrorBody
"""
_attribute_map = {
'error': {'key': 'error', 'type': 'CloudErrorBody'},
}
def __init__(self, *, error=None, **kwargs) -> None:
super(CloudError, self).__init__(**kwargs)
self.error = error
class CloudErrorException(HttpOperationError):
"""Server responsed with exception of type: 'CloudError'.
:param deserialize: A deserializer
:param response: Server response to be deserialized.
"""
def __init__(self, deserialize, response, *args):
super(CloudErrorException, self).__init__(deserialize, response, 'CloudError', *args)
class CloudErrorBody(Model):
"""CloudErrorBody represents the body of a cloud error.
:param code: An identifier for the error. Codes are invariant and are
intended to be consumed programmatically.
:type code: str
:param message: A message describing the error, intended to be suitable
for display in a user interface.
:type message: str
:param target: The target of the particular error. For example, the name
of the property in error.
:type target: str
:param details: A list of additional details about the error.
:type details: list[~redhatopenshift.models.CloudErrorBody]
"""
_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
'target': {'key': 'target', 'type': 'str'},
'details': {'key': 'details', 'type': '[CloudErrorBody]'},
}
def __init__(self, *, code: str=None, message: str=None, target: str=None, details=None, **kwargs) -> None:
super(CloudErrorBody, self).__init__(**kwargs)
self.code = code
self.message = message
self.target = target
self.details = details
class Display(Model):
"""Display represents the display details of an operation.
:param provider: Friendly name of the resource provider.
:type provider: str
:param resource: Resource type on which the operation is performed.
:type resource: str
:param operation: Operation type: read, write, delete, listKeys/action,
etc.
:type operation: str
:param description: Friendly name of the operation.
:type description: str
"""
_attribute_map = {
'provider': {'key': 'provider', 'type': 'str'},
'resource': {'key': 'resource', 'type': 'str'},
'operation': {'key': 'operation', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
}
def __init__(self, *, provider: str=None, resource: str=None, operation: str=None, description: str=None, **kwargs) -> None:
super(Display, self).__init__(**kwargs)
self.provider = provider
self.resource = resource
self.operation = operation
self.description = description
class MasterProfile(Model):
"""MasterProfile represents a master profile.
:param vm_size: The size of the master VMs (immutable). Possible values
include: 'Standard_D2s_v3', 'Standard_D4s_v3', 'Standard_D8s_v3'
:type vm_size: str or ~redhatopenshift.models.enum
:param subnet_id: The Azure resource ID of the worker subnet (immutable).
:type subnet_id: str
"""
_attribute_map = {
'vm_size': {'key': 'vmSize', 'type': 'str'},
'subnet_id': {'key': 'subnetId', 'type': 'str'},
}
def __init__(self, *, vm_size=None, subnet_id: str=None, **kwargs) -> None:
super(MasterProfile, self).__init__(**kwargs)
self.vm_size = vm_size
self.subnet_id = subnet_id
class NetworkProfile(Model):
"""NetworkProfile represents a network profile.
:param pod_cidr: The CIDR used for OpenShift/Kubernetes Pods (immutable).
:type pod_cidr: str
:param service_cidr: The CIDR used for OpenShift/Kubernetes Services
(immutable).
:type service_cidr: str
"""
_attribute_map = {
'pod_cidr': {'key': 'podCidr', 'type': 'str'},
'service_cidr': {'key': 'serviceCidr', 'type': 'str'},
}
def __init__(self, *, pod_cidr: str=None, service_cidr: str=None, **kwargs) -> None:
super(NetworkProfile, self).__init__(**kwargs)
self.pod_cidr = pod_cidr
self.service_cidr = service_cidr
class OpenShiftCluster(Model):
"""OpenShiftCluster represents an Azure Red Hat OpenShift cluster.
Variables are only populated by the server, and will be ignored when
sending a request.
:ivar id: The resource ID (immutable).
:vartype id: str
:ivar name: The resource name (immutable).
:vartype name: str
:ivar type: The resource type (immutable).
:vartype type: str
:param location: The resource location (immutable).
:type location: str
:param tags: The resource tags.
:type tags: dict[str, str]
:param provisioning_state: The cluster provisioning state (immutable).
Possible values include: 'Creating', 'Deleting', 'Failed', 'Succeeded',
'Updating'
:type provisioning_state: str or ~redhatopenshift.models.enum
:param service_principal_profile: The cluster service principal profile.
:type service_principal_profile:
~redhatopenshift.models.ServicePrincipalProfile
:param network_profile: The cluster network profile.
:type network_profile: ~redhatopenshift.models.NetworkProfile
:param master_profile: The cluster master profile.
:type master_profile: ~redhatopenshift.models.MasterProfile
:param worker_profiles: The cluster worker profiles.
:type worker_profiles: list[~redhatopenshift.models.WorkerProfile]
:param apiserver_url: The URL to access the cluster API server
(immutable).
:type apiserver_url: str
:param console_url: The URL to access the cluster console (immutable).
:type console_url: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'service_principal_profile': {'key': 'properties.servicePrincipalProfile', 'type': 'ServicePrincipalProfile'},
'network_profile': {'key': 'properties.networkProfile', 'type': 'NetworkProfile'},
'master_profile': {'key': 'properties.masterProfile', 'type': 'MasterProfile'},
'worker_profiles': {'key': 'properties.workerProfiles', 'type': '[WorkerProfile]'},
'apiserver_url': {'key': 'properties.apiserverUrl', 'type': 'str'},
'console_url': {'key': 'properties.consoleUrl', 'type': 'str'},
}
def __init__(self, *, location: str=None, tags=None, provisioning_state=None, service_principal_profile=None, network_profile=None, master_profile=None, worker_profiles=None, apiserver_url: str=None, console_url: str=None, **kwargs) -> None:
super(OpenShiftCluster, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None
self.location = location
self.tags = tags
self.provisioning_state = provisioning_state
self.service_principal_profile = service_principal_profile
self.network_profile = network_profile
self.master_profile = master_profile
self.worker_profiles = worker_profiles
self.apiserver_url = apiserver_url
self.console_url = console_url
class OpenShiftClusterCredentials(Model):
"""OpenShiftClusterCredentials represents an OpenShift cluster's credentials.
:param kubeadmin_password: The password for the kubeadmin user
:type kubeadmin_password: str
"""
_attribute_map = {
'kubeadmin_password': {'key': 'kubeadminPassword', 'type': 'str'},
}
def __init__(self, *, kubeadmin_password: str=None, **kwargs) -> None:
super(OpenShiftClusterCredentials, self).__init__(**kwargs)
self.kubeadmin_password = kubeadmin_password
class OpenShiftClusterList(Model):
"""OpenShiftClusterList represents a list of OpenShift clusters.
:param value: The list of OpenShift clusters.
:type value: list[~redhatopenshift.models.OpenShiftCluster]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[OpenShiftCluster]'},
}
def __init__(self, *, value=None, **kwargs) -> None:
super(OpenShiftClusterList, self).__init__(**kwargs)
self.value = value
class Operation(Model):
"""Operation represents an operation.
:param name: Operation name: {provider}/{resource}/{operation}.
:type name: str
:param display: The object that describes the operation.
:type display: ~redhatopenshift.models.Display
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'display': {'key': 'display', 'type': 'Display'},
}
def __init__(self, *, name: str=None, display=None, **kwargs) -> None:
super(Operation, self).__init__(**kwargs)
self.name = name
self.display = display
class OperationList(Model):
"""OperationList represents an operation list.
:param value: List of operations supported by the resource provider.
:type value: list[~redhatopenshift.models.Operation]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Operation]'},
}
def __init__(self, *, value=None, **kwargs) -> None:
super(OperationList, self).__init__(**kwargs)
self.value = value
class ServicePrincipalProfile(Model):
"""ServicePrincipalProfile represents a service principal profile.
:param client_id: The client ID used for the cluster
:type client_id: str
:param client_secret: The client secret used for the cluster
:type client_secret: str
"""
_attribute_map = {
'client_id': {'key': 'clientId', 'type': 'str'},
'client_secret': {'key': 'clientSecret', 'type': 'str'},
}
def __init__(self, *, client_id: str=None, client_secret: str=None, **kwargs) -> None:
super(ServicePrincipalProfile, self).__init__(**kwargs)
self.client_id = client_id
self.client_secret = client_secret
class WorkerProfile(Model):
"""WorkerProfile represents a worker profile.
:param name: The worker profile name. Must be "worker" (immutable).
:type name: str
:param vm_size: The size of the worker VMs (immutable). Possible values
include: 'Standard_D2s_v3', 'Standard_D4s_v3', 'Standard_D8s_v3'
:type vm_size: str or ~redhatopenshift.models.enum
:param disk_size_gb: The disk size of the worker VMs. Must be 128 or
greater (immutable).
:type disk_size_gb: int
:param subnet_id: The Azure resource ID of the worker subnet (immutable).
:type subnet_id: str
:param count: The number of worker VMs. Must be between 3 and 20.
:type count: int
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'vm_size': {'key': 'vmSize', 'type': 'str'},
'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'},
'subnet_id': {'key': 'subnetId', 'type': 'str'},
'count': {'key': 'count', 'type': 'int'},
}
def __init__(self, *, name: str=None, vm_size=None, disk_size_gb: int=None, subnet_id: str=None, count: int=None, **kwargs) -> None:
super(WorkerProfile, self).__init__(**kwargs)
self.name = name
self.vm_size = vm_size
self.disk_size_gb = disk_size_gb
self.subnet_id = subnet_id
self.count = count

Просмотреть файл

@ -0,0 +1,14 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ._operations import Operations
from ._open_shift_clusters_operations import OpenShiftClustersOperations
__all__ = [
'Operations',
'OpenShiftClustersOperations',
]

Просмотреть файл

@ -0,0 +1,587 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from msrest.polling import LROPoller, NoPolling
from msrestazure.polling.arm_polling import ARMPolling
from .. import models
class OpenShiftClustersOperations(object):
"""OpenShiftClustersOperations operations.
You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Client API version. Constant value: "2019-12-31-preview".
"""
models = models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2019-12-31-preview"
self.config = config
def list(
self, custom_headers=None, raw=False, **operation_config):
"""Lists OpenShift clusters in the specified subscription.
Lists OpenShift clusters in the specified subscription. The operation
returns properties of each OpenShift cluster.
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: OpenShiftClusterList or ClientRawResponse if raw=true
:rtype: ~redhatopenshift.models.OpenShiftClusterList or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.list.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OpenShiftClusterList', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RedHatOpenShift/openShiftClusters'}
def list_by_resource_group(
self, resource_group_name, custom_headers=None, raw=False, **operation_config):
"""Lists OpenShift clusters in the specified subscription and resource
group.
Lists OpenShift clusters in the specified subscription and resource
group. The operation returns properties of each OpenShift cluster.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: OpenShiftClusterList or ClientRawResponse if raw=true
:rtype: ~redhatopenshift.models.OpenShiftClusterList or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.list_by_resource_group.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OpenShiftClusterList', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters'}
def get(
self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
"""Gets a OpenShift cluster with the specified subscription, resource
group and resource name.
Gets a OpenShift cluster with the specified subscription, resource
group and resource name. The operation returns properties of a
OpenShift cluster.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource.
:type resource_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: OpenShiftCluster or ClientRawResponse if raw=true
:rtype: ~redhatopenshift.models.OpenShiftCluster or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.get.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'resourceName': self._serialize.url("resource_name", resource_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OpenShiftCluster', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}'}
def _create_initial(
self, resource_group_name, resource_name, parameters, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.create.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'resourceName': self._serialize.url("resource_name", resource_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(parameters, 'OpenShiftCluster')
# Construct and send request
request = self._client.put(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200, 201]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OpenShiftCluster', response)
if response.status_code == 201:
deserialized = self._deserialize('OpenShiftCluster', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def create(
self, resource_group_name, resource_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config):
"""Creates or updates a OpenShift cluster with the specified subscription,
resource group and resource name.
Creates or updates a OpenShift cluster with the specified subscription,
resource group and resource name. The operation returns properties of
a OpenShift cluster.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource.
:type resource_name: str
:param parameters: The OpenShift cluster resource.
:type parameters: ~redhatopenshift.models.OpenShiftCluster
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
:param polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:return: An instance of LROPoller that returns OpenShiftCluster or
ClientRawResponse<OpenShiftCluster> if raw==True
:rtype:
~msrestazure.azure_operation.AzureOperationPoller[~redhatopenshift.models.OpenShiftCluster]
or
~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~redhatopenshift.models.OpenShiftCluster]]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
raw_result = self._create_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
parameters=parameters,
custom_headers=custom_headers,
raw=True,
**operation_config
)
def get_long_running_output(response):
deserialized = self._deserialize('OpenShiftCluster', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
lro_delay = operation_config.get(
'long_running_operation_timeout',
self.config.long_running_operation_timeout)
if polling is True: polling_method = ARMPolling(lro_delay, **operation_config)
elif polling is False: polling_method = NoPolling()
else: polling_method = polling
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}'}
def _delete_initial(
self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.delete.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'resourceName': self._serialize.url("resource_name", resource_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.delete(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200, 204]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
def delete(
self, resource_group_name, resource_name, custom_headers=None, raw=False, polling=True, **operation_config):
"""Deletes a OpenShift cluster with the specified subscription, resource
group and resource name.
Deletes a OpenShift cluster with the specified subscription, resource
group and resource name. The operation returns nothing.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource.
:type resource_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
:param polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:return: An instance of LROPoller that returns None or
ClientRawResponse<None> if raw==True
:rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or
~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
custom_headers=custom_headers,
raw=True,
**operation_config
)
def get_long_running_output(response):
if raw:
client_raw_response = ClientRawResponse(None, response)
return client_raw_response
lro_delay = operation_config.get(
'long_running_operation_timeout',
self.config.long_running_operation_timeout)
if polling is True: polling_method = ARMPolling(lro_delay, **operation_config)
elif polling is False: polling_method = NoPolling()
else: polling_method = polling
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}'}
def _update_initial(
self, resource_group_name, resource_name, parameters, custom_headers=None, raw=False, **operation_config):
# Construct URL
url = self.update.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'resourceName': self._serialize.url("resource_name", resource_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
header_parameters['Content-Type'] = 'application/json; charset=utf-8'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct body
body_content = self._serialize.body(parameters, 'OpenShiftCluster')
# Construct and send request
request = self._client.patch(url, query_parameters, header_parameters, body_content)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200, 201]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OpenShiftCluster', response)
if response.status_code == 201:
deserialized = self._deserialize('OpenShiftCluster', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
def update(
self, resource_group_name, resource_name, parameters, custom_headers=None, raw=False, polling=True, **operation_config):
"""Creates or updates a OpenShift cluster with the specified subscription,
resource group and resource name.
Creates or updates a OpenShift cluster with the specified subscription,
resource group and resource name. The operation returns properties of
a OpenShift cluster.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource.
:type resource_name: str
:param parameters: The OpenShift cluster resource.
:type parameters: ~redhatopenshift.models.OpenShiftCluster
:param dict custom_headers: headers that will be added to the request
:param bool raw: The poller return type is ClientRawResponse, the
direct response alongside the deserialized response
:param polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:return: An instance of LROPoller that returns OpenShiftCluster or
ClientRawResponse<OpenShiftCluster> if raw==True
:rtype:
~msrestazure.azure_operation.AzureOperationPoller[~redhatopenshift.models.OpenShiftCluster]
or
~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~redhatopenshift.models.OpenShiftCluster]]
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
raw_result = self._update_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
parameters=parameters,
custom_headers=custom_headers,
raw=True,
**operation_config
)
def get_long_running_output(response):
deserialized = self._deserialize('OpenShiftCluster', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
lro_delay = operation_config.get(
'long_running_operation_timeout',
self.config.long_running_operation_timeout)
if polling is True: polling_method = ARMPolling(lro_delay, **operation_config)
elif polling is False: polling_method = NoPolling()
else: polling_method = polling
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}'}
def get_credentials(
self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config):
"""Gets credentials of a OpenShift cluster with the specified
subscription, resource group and resource name.
Gets credentials of a OpenShift cluster with the specified
subscription, resource group and resource name. The operation returns
the credentials.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The name of the OpenShift cluster resource.
:type resource_name: str
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: OpenShiftClusterCredentials or ClientRawResponse if raw=true
:rtype: ~redhatopenshift.models.OpenShiftClusterCredentials or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.get_credentials.metadata['url']
path_format_arguments = {
'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'resourceName': self._serialize.url("resource_name", resource_name, 'str')
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.post(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OpenShiftClusterCredentials', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
get_credentials.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RedHatOpenShift/openShiftClusters/{resourceName}/credentials'}

Просмотреть файл

@ -0,0 +1,90 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
import uuid
from msrest.pipeline import ClientRawResponse
from msrestazure.azure_exceptions import CloudError
from .. import models
class Operations(object):
"""Operations operations.
You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute.
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
:ivar api_version: Client API version. Constant value: "2019-12-31-preview".
"""
models = models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self.api_version = "2019-12-31-preview"
self.config = config
def list(
self, custom_headers=None, raw=False, **operation_config):
"""Lists all of the available RP operations.
Lists all of the available RP operations. The operation returns the
operations.
:param dict custom_headers: headers that will be added to the request
:param bool raw: returns the direct response alongside the
deserialized response
:param operation_config: :ref:`Operation configuration
overrides<msrest:optionsforoperations>`.
:return: OperationList or ClientRawResponse if raw=true
:rtype: ~redhatopenshift.models.OperationList or
~msrest.pipeline.ClientRawResponse
:raises: :class:`CloudError<msrestazure.azure_exceptions.CloudError>`
"""
# Construct URL
url = self.list.metadata['url']
# Construct parameters
query_parameters = {}
query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str')
# Construct headers
header_parameters = {}
header_parameters['Accept'] = 'application/json'
if self.config.generate_client_request_id:
header_parameters['x-ms-client-request-id'] = str(uuid.uuid1())
if custom_headers:
header_parameters.update(custom_headers)
if self.config.accept_language is not None:
header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str')
# Construct and send request
request = self._client.get(url, query_parameters, header_parameters)
response = self._client.send(request, stream=False, **operation_config)
if response.status_code not in [200]:
exp = CloudError(response)
exp.request_id = response.headers.get('x-ms-request-id')
raise exp
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('OperationList', response)
if raw:
client_raw_response = ClientRawResponse(deserialized, response)
return client_raw_response
return deserialized
list.metadata = {'url': '/providers/Microsoft.RedHatOpenShift/operations'}

Просмотреть файл

@ -0,0 +1,9 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
VERSION = "2019-12-31-preview"

Просмотреть файл

@ -0,0 +1,51 @@
# Azure Red Hat OpenShift CLI preview extension
ARO CLI extension code
## Configure & generate extensions
All these steps assumes you read throuth documents in useful links sections
and you are already familiar with terminology
1. Clone required dev repositories:
```
git clone https://github.com/Azure/azure-cli
git clone https://github.com/Azure/azure-cli-extensions
```
1. Setup virtual env in the repository which will unify all projects,
including `rp`. I do this on `$GOPATH/src/github.com` level.
```
python3 -m venv env
source env/bin/activate
```
1. Install pre-requisited
```
pip install azdev
azdev setup
```
1. Add external extension repistory
```
azdev extension repo add /home/mjudeiki/go/src/github.com/mjudeikis/azure-cli-aro
```
From this point, if you want develop existing extension - add extension to az:
client. Otherwise generate new from the template
```
azdev extension add aro-preview
```
### Generate extension template
1. Generate extension template
```
azdev extension create aro-preview --client-name AzureRedHatOpenShiftClient --operation-name OpenShiftClustersOperations --local-sdk /home/mjudeiki/go/src/github.com/jim-minter/rp/az/azure-python-sdk/2019-12-31-preview/redhatopenshift/ --sdk-property=resource_name --github-alias=mjudeikis --repo-name /home/mjudeiki/go/src/github.com/mjudeikis/azure-cli-aro
```
## Useful links
* https://github.com/Azure/azure-cli-dev-tools
* https://github.com/Azure/azure-cli/blob/master/doc/extensions/authoring.md

Просмотреть файл

@ -10,7 +10,7 @@ func Run(outputFile string) error {
s := &Swagger{
Swagger: "2.0",
Info: &Info{
Title: "Azure Red Hat OpenShift",
Title: "Azure Red Hat OpenShift Client",
Description: "Rest API for Azure Red Hat OpenShift",
Version: "2019-12-31-preview",
},

Просмотреть файл

@ -1,7 +1,7 @@
{
"swagger": "2.0",
"info": {
"title": "Azure Red Hat OpenShift",
"title": "Azure Red Hat OpenShift Client",
"description": "Rest API for Azure Red Hat OpenShift",
"version": "2019-12-31-preview"
},