code
stringlengths 501
4.91M
| package
stringlengths 2
88
| path
stringlengths 11
291
| filename
stringlengths 4
197
| parsed_code
stringlengths 0
4.91M
| quality_prob
float64 0
0.99
| learning_prob
float64 0.02
1
|
---|---|---|---|---|---|---|
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
class AutomationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for AutomationClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure
subscription. The subscription ID forms part of the URI for every service call.
:type subscription_id: str
"""
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
super(AutomationClientConfiguration, self).__init__(**kwargs)
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-automation/{}'.format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs: Any
) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/_configuration.py
|
_configuration.py
|
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
class AutomationClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for AutomationClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Gets subscription credentials which uniquely identify Microsoft Azure
subscription. The subscription ID forms part of the URI for every service call.
:type subscription_id: str
"""
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
super(AutomationClientConfiguration, self).__init__(**kwargs)
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-automation/{}'.format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs: Any
) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)
| 0.825308 | 0.074299 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._node_reports_operations import build_get_content_request, build_get_request, build_list_by_node_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class NodeReportsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`node_reports` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_by_node(
self,
resource_group_name: str,
automation_account_name: str,
node_id: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.DscNodeReportListResult]:
"""Retrieve the Dsc node report list by node id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_id: The parameters supplied to the list operation.
:type node_id: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DscNodeReportListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscNodeReportListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNodeReportListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_node_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_node.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_node_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DscNodeReportListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_node.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
node_id: str,
report_id: str,
**kwargs: Any
) -> _models.DscNodeReport:
"""Retrieve the Dsc node report data by node id and report id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_id: The Dsc node id.
:type node_id: str
:param report_id: The report id.
:type report_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscNodeReport, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscNodeReport
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNodeReport]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
report_id=report_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscNodeReport', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}"} # type: ignore
@distributed_trace_async
async def get_content(
self,
resource_group_name: str,
automation_account_name: str,
node_id: str,
report_id: str,
**kwargs: Any
) -> Any:
"""Retrieve the Dsc node reports by node id and report id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_id: The Dsc node id.
:type node_id: str
:param report_id: The report id.
:type report_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: any, or the result of cls(response)
:rtype: any
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[Any]
request = build_get_content_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
report_id=report_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_content.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('object', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}/content"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_node_reports_operations.py
|
_node_reports_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._node_reports_operations import build_get_content_request, build_get_request, build_list_by_node_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class NodeReportsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`node_reports` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_by_node(
self,
resource_group_name: str,
automation_account_name: str,
node_id: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.DscNodeReportListResult]:
"""Retrieve the Dsc node report list by node id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_id: The parameters supplied to the list operation.
:type node_id: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DscNodeReportListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscNodeReportListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNodeReportListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_node_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_node.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_node_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DscNodeReportListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_node.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
node_id: str,
report_id: str,
**kwargs: Any
) -> _models.DscNodeReport:
"""Retrieve the Dsc node report data by node id and report id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_id: The Dsc node id.
:type node_id: str
:param report_id: The report id.
:type report_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscNodeReport, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscNodeReport
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNodeReport]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
report_id=report_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscNodeReport', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}"} # type: ignore
@distributed_trace_async
async def get_content(
self,
resource_group_name: str,
automation_account_name: str,
node_id: str,
report_id: str,
**kwargs: Any
) -> Any:
"""Retrieve the Dsc node reports by node id and report id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_id: The Dsc node id.
:type node_id: str
:param report_id: The report id.
:type report_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: any, or the result of cls(response)
:rtype: any
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[Any]
request = build_get_content_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
report_id=report_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_content.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('object', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}/reports/{reportId}/content"} # type: ignore
| 0.836788 | 0.110423 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._source_control_sync_job_streams_operations import build_get_request, build_list_by_sync_job_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SourceControlSyncJobStreamsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`source_control_sync_job_streams` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_by_sync_job(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
source_control_sync_job_id: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.SourceControlSyncJobStreamsListBySyncJob]:
"""Retrieve a list of sync job streams identified by sync job id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param source_control_sync_job_id: The source control sync job id.
:type source_control_sync_job_id: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either SourceControlSyncJobStreamsListBySyncJob or the
result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.SourceControlSyncJobStreamsListBySyncJob]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlSyncJobStreamsListBySyncJob]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_sync_job_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
source_control_sync_job_id=source_control_sync_job_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_sync_job.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_sync_job_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
source_control_sync_job_id=source_control_sync_job_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlSyncJobStreamsListBySyncJob", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_sync_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
source_control_sync_job_id: str,
stream_id: str,
**kwargs: Any
) -> _models.SourceControlSyncJobStreamById:
"""Retrieve a sync job stream identified by stream id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param source_control_sync_job_id: The source control sync job id.
:type source_control_sync_job_id: str
:param stream_id: The id of the sync job stream.
:type stream_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlSyncJobStreamById, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SourceControlSyncJobStreamById
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlSyncJobStreamById]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
source_control_sync_job_id=source_control_sync_job_id,
stream_id=stream_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SourceControlSyncJobStreamById', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams/{streamId}"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_source_control_sync_job_streams_operations.py
|
_source_control_sync_job_streams_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._source_control_sync_job_streams_operations import build_get_request, build_list_by_sync_job_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SourceControlSyncJobStreamsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`source_control_sync_job_streams` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_by_sync_job(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
source_control_sync_job_id: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.SourceControlSyncJobStreamsListBySyncJob]:
"""Retrieve a list of sync job streams identified by sync job id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param source_control_sync_job_id: The source control sync job id.
:type source_control_sync_job_id: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either SourceControlSyncJobStreamsListBySyncJob or the
result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.SourceControlSyncJobStreamsListBySyncJob]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlSyncJobStreamsListBySyncJob]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_sync_job_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
source_control_sync_job_id=source_control_sync_job_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_sync_job.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_sync_job_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
source_control_sync_job_id=source_control_sync_job_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlSyncJobStreamsListBySyncJob", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_sync_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
source_control_sync_job_id: str,
stream_id: str,
**kwargs: Any
) -> _models.SourceControlSyncJobStreamById:
"""Retrieve a sync job stream identified by stream id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param source_control_sync_job_id: The source control sync job id.
:type source_control_sync_job_id: str
:param stream_id: The id of the sync job stream.
:type stream_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlSyncJobStreamById, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SourceControlSyncJobStreamById
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlSyncJobStreamById]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
source_control_sync_job_id=source_control_sync_job_id,
stream_id=stream_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SourceControlSyncJobStreamById', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}/streams/{streamId}"} # type: ignore
| 0.828488 | 0.07353 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._watcher_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_start_request, build_stop_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class WatcherOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`watcher` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
watcher_name: str,
parameters: _models.Watcher,
**kwargs: Any
) -> _models.Watcher:
"""Create the watcher identified by watcher name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param watcher_name: The watcher name.
:type watcher_name: str
:param parameters: The create or update parameters for watcher.
:type parameters: ~azure.mgmt.automation.models.Watcher
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Watcher, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Watcher
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Watcher]
_json = self._serialize.body(parameters, 'Watcher')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
watcher_name=watcher_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Watcher', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Watcher', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
watcher_name: str,
**kwargs: Any
) -> _models.Watcher:
"""Retrieve the watcher identified by watcher name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param watcher_name: The watcher name.
:type watcher_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Watcher, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Watcher
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Watcher]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
watcher_name=watcher_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Watcher', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
watcher_name: str,
parameters: _models.WatcherUpdateParameters,
**kwargs: Any
) -> _models.Watcher:
"""Update the watcher identified by watcher name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param watcher_name: The watcher name.
:type watcher_name: str
:param parameters: The update parameters for watcher.
:type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Watcher, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Watcher
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Watcher]
_json = self._serialize.body(parameters, 'WatcherUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
watcher_name=watcher_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Watcher', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
watcher_name: str,
**kwargs: Any
) -> None:
"""Delete the watcher by name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param watcher_name: The watcher name.
:type watcher_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
watcher_name=watcher_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}"} # type: ignore
@distributed_trace_async
async def start( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
watcher_name: str,
**kwargs: Any
) -> None:
"""Resume the watcher identified by watcher name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param watcher_name: The watcher name.
:type watcher_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_start_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
watcher_name=watcher_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.start.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/start"} # type: ignore
@distributed_trace_async
async def stop( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
watcher_name: str,
**kwargs: Any
) -> None:
"""Resume the watcher identified by watcher name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param watcher_name: The watcher name.
:type watcher_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_stop_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
watcher_name=watcher_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.stop.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/stop"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.WatcherListResult]:
"""Retrieve a list of watchers.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WatcherListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.WatcherListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.WatcherListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WatcherListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_watcher_operations.py
|
_watcher_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._watcher_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_start_request, build_stop_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class WatcherOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`watcher` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
watcher_name: str,
parameters: _models.Watcher,
**kwargs: Any
) -> _models.Watcher:
"""Create the watcher identified by watcher name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param watcher_name: The watcher name.
:type watcher_name: str
:param parameters: The create or update parameters for watcher.
:type parameters: ~azure.mgmt.automation.models.Watcher
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Watcher, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Watcher
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Watcher]
_json = self._serialize.body(parameters, 'Watcher')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
watcher_name=watcher_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Watcher', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Watcher', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
watcher_name: str,
**kwargs: Any
) -> _models.Watcher:
"""Retrieve the watcher identified by watcher name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param watcher_name: The watcher name.
:type watcher_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Watcher, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Watcher
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Watcher]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
watcher_name=watcher_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Watcher', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
watcher_name: str,
parameters: _models.WatcherUpdateParameters,
**kwargs: Any
) -> _models.Watcher:
"""Update the watcher identified by watcher name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param watcher_name: The watcher name.
:type watcher_name: str
:param parameters: The update parameters for watcher.
:type parameters: ~azure.mgmt.automation.models.WatcherUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Watcher, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Watcher
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Watcher]
_json = self._serialize.body(parameters, 'WatcherUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
watcher_name=watcher_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Watcher', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
watcher_name: str,
**kwargs: Any
) -> None:
"""Delete the watcher by name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param watcher_name: The watcher name.
:type watcher_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
watcher_name=watcher_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}"} # type: ignore
@distributed_trace_async
async def start( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
watcher_name: str,
**kwargs: Any
) -> None:
"""Resume the watcher identified by watcher name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param watcher_name: The watcher name.
:type watcher_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_start_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
watcher_name=watcher_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.start.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/start"} # type: ignore
@distributed_trace_async
async def stop( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
watcher_name: str,
**kwargs: Any
) -> None:
"""Resume the watcher identified by watcher name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param watcher_name: The watcher name.
:type watcher_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_stop_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
watcher_name=watcher_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.stop.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers/{watcherName}/stop"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.WatcherListResult]:
"""Retrieve a list of watchers.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WatcherListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.WatcherListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.WatcherListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WatcherListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/watchers"} # type: ignore
| 0.844649 | 0.090695 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._schedule_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ScheduleOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`schedule` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
schedule_name: str,
parameters: _models.ScheduleCreateOrUpdateParameters,
**kwargs: Any
) -> Optional[_models.Schedule]:
"""Create a schedule.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param schedule_name: The schedule name.
:type schedule_name: str
:param parameters: The parameters supplied to the create or update schedule operation.
:type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Schedule, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Schedule or None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.Schedule]]
_json = self._serialize.body(parameters, 'ScheduleCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
schedule_name=schedule_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201, 409]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('Schedule', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Schedule', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
schedule_name: str,
parameters: _models.ScheduleUpdateParameters,
**kwargs: Any
) -> _models.Schedule:
"""Update the schedule identified by schedule name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param schedule_name: The schedule name.
:type schedule_name: str
:param parameters: The parameters supplied to the update schedule operation.
:type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Schedule, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Schedule
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Schedule]
_json = self._serialize.body(parameters, 'ScheduleUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
schedule_name=schedule_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Schedule', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
schedule_name: str,
**kwargs: Any
) -> _models.Schedule:
"""Retrieve the schedule identified by schedule name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param schedule_name: The schedule name.
:type schedule_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Schedule, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Schedule
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Schedule]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
schedule_name=schedule_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Schedule', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
schedule_name: str,
**kwargs: Any
) -> None:
"""Delete the schedule identified by schedule name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param schedule_name: The schedule name.
:type schedule_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
schedule_name=schedule_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.ScheduleListResult]:
"""Retrieve a list of schedules.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScheduleListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ScheduleListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ScheduleListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ScheduleListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_schedule_operations.py
|
_schedule_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._schedule_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ScheduleOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`schedule` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
schedule_name: str,
parameters: _models.ScheduleCreateOrUpdateParameters,
**kwargs: Any
) -> Optional[_models.Schedule]:
"""Create a schedule.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param schedule_name: The schedule name.
:type schedule_name: str
:param parameters: The parameters supplied to the create or update schedule operation.
:type parameters: ~azure.mgmt.automation.models.ScheduleCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Schedule, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Schedule or None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.Schedule]]
_json = self._serialize.body(parameters, 'ScheduleCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
schedule_name=schedule_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201, 409]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('Schedule', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Schedule', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
schedule_name: str,
parameters: _models.ScheduleUpdateParameters,
**kwargs: Any
) -> _models.Schedule:
"""Update the schedule identified by schedule name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param schedule_name: The schedule name.
:type schedule_name: str
:param parameters: The parameters supplied to the update schedule operation.
:type parameters: ~azure.mgmt.automation.models.ScheduleUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Schedule, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Schedule
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Schedule]
_json = self._serialize.body(parameters, 'ScheduleUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
schedule_name=schedule_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Schedule', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
schedule_name: str,
**kwargs: Any
) -> _models.Schedule:
"""Retrieve the schedule identified by schedule name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param schedule_name: The schedule name.
:type schedule_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Schedule, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Schedule
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Schedule]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
schedule_name=schedule_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Schedule', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
schedule_name: str,
**kwargs: Any
) -> None:
"""Delete the schedule identified by schedule name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param schedule_name: The schedule name.
:type schedule_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
schedule_name=schedule_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules/{scheduleName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.ScheduleListResult]:
"""Retrieve a list of schedules.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScheduleListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ScheduleListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ScheduleListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ScheduleListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/schedules"} # type: ignore
| 0.855565 | 0.095898 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._dsc_node_operations import build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class DscNodeOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`dsc_node` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
node_id: str,
**kwargs: Any
) -> None:
"""Delete the dsc node identified by node id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_id: The node id.
:type node_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
node_id: str,
**kwargs: Any
) -> _models.DscNode:
"""Retrieve the dsc node identified by node id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_id: The node id.
:type node_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscNode, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscNode
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNode]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscNode', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
node_id: str,
dsc_node_update_parameters: _models.DscNodeUpdateParameters,
**kwargs: Any
) -> _models.DscNode:
"""Update the dsc node.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_id: Parameters supplied to the update dsc node.
:type node_id: str
:param dsc_node_update_parameters: Parameters supplied to the update dsc node.
:type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscNode, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscNode
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNode]
_json = self._serialize.body(dsc_node_update_parameters, 'DscNodeUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscNode', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
skip: Optional[int] = None,
top: Optional[int] = None,
inlinecount: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.DscNodeListResult]:
"""Retrieve a list of dsc nodes.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:param skip: The number of rows to skip. Default value is None.
:type skip: int
:param top: The number of rows to take. Default value is None.
:type top: int
:param inlinecount: Return total rows. Default value is None.
:type inlinecount: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DscNodeListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscNodeListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNodeListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
skip=skip,
top=top,
inlinecount=inlinecount,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
skip=skip,
top=top,
inlinecount=inlinecount,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DscNodeListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_dsc_node_operations.py
|
_dsc_node_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._dsc_node_operations import build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class DscNodeOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`dsc_node` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
node_id: str,
**kwargs: Any
) -> None:
"""Delete the dsc node identified by node id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_id: The node id.
:type node_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
node_id: str,
**kwargs: Any
) -> _models.DscNode:
"""Retrieve the dsc node identified by node id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_id: The node id.
:type node_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscNode, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscNode
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNode]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscNode', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
node_id: str,
dsc_node_update_parameters: _models.DscNodeUpdateParameters,
**kwargs: Any
) -> _models.DscNode:
"""Update the dsc node.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_id: Parameters supplied to the update dsc node.
:type node_id: str
:param dsc_node_update_parameters: Parameters supplied to the update dsc node.
:type dsc_node_update_parameters: ~azure.mgmt.automation.models.DscNodeUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscNode, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscNode
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNode]
_json = self._serialize.body(dsc_node_update_parameters, 'DscNodeUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_id=node_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscNode', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes/{nodeId}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
skip: Optional[int] = None,
top: Optional[int] = None,
inlinecount: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.DscNodeListResult]:
"""Retrieve a list of dsc nodes.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:param skip: The number of rows to skip. Default value is None.
:type skip: int
:param top: The number of rows to take. Default value is None.
:type top: int
:param inlinecount: Return total rows. Default value is None.
:type inlinecount: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DscNodeListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscNodeListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNodeListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
skip=skip,
top=top,
inlinecount=inlinecount,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
skip=skip,
top=top,
inlinecount=inlinecount,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DscNodeListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodes"} # type: ignore
| 0.831827 | 0.089654 |
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._node_count_information_operations import build_get_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class NodeCountInformationOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`node_count_information` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
count_type: Union[str, "_models.CountType"],
**kwargs: Any
) -> _models.NodeCounts:
"""Retrieve counts for Dsc Nodes.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param count_type: The type of counts to retrieve.
:type count_type: str or ~azure.mgmt.automation.models.CountType
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NodeCounts, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.NodeCounts
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeCounts]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
count_type=count_type,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('NodeCounts', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodecounts/{countType}"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_node_count_information_operations.py
|
_node_count_information_operations.py
|
from typing import Any, Callable, Dict, Optional, TypeVar, Union
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._node_count_information_operations import build_get_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class NodeCountInformationOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`node_count_information` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
count_type: Union[str, "_models.CountType"],
**kwargs: Any
) -> _models.NodeCounts:
"""Retrieve counts for Dsc Nodes.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param count_type: The type of counts to retrieve.
:type count_type: str or ~azure.mgmt.automation.models.CountType
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NodeCounts, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.NodeCounts
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.NodeCounts]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
count_type=count_type,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('NodeCounts', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodecounts/{countType}"} # type: ignore
| 0.860486 | 0.098947 |
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._linked_workspace_operations import build_get_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class LinkedWorkspaceOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`linked_workspace` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> _models.LinkedWorkspace:
"""Retrieve the linked workspace for the account id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: LinkedWorkspace, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.LinkedWorkspace
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.LinkedWorkspace]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('LinkedWorkspace', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/linkedWorkspace"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_linked_workspace_operations.py
|
_linked_workspace_operations.py
|
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._linked_workspace_operations import build_get_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class LinkedWorkspaceOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`linked_workspace` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> _models.LinkedWorkspace:
"""Retrieve the linked workspace for the account id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: LinkedWorkspace, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.LinkedWorkspace
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.LinkedWorkspace]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('LinkedWorkspace', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/linkedWorkspace"} # type: ignore
| 0.851891 | 0.095687 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._hybrid_runbook_workers_operations import build_create_request, build_delete_request, build_get_request, build_list_by_hybrid_runbook_worker_group_request, build_move_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class HybridRunbookWorkersOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`hybrid_runbook_workers` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
hybrid_runbook_worker_id: str,
**kwargs: Any
) -> None:
"""Delete a hybrid runbook worker.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param hybrid_runbook_worker_id: The hybrid runbook worker id.
:type hybrid_runbook_worker_id: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
hybrid_runbook_worker_id=hybrid_runbook_worker_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
hybrid_runbook_worker_id: str,
**kwargs: Any
) -> _models.HybridRunbookWorker:
"""Retrieve a hybrid runbook worker.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param hybrid_runbook_worker_id: The hybrid runbook worker id.
:type hybrid_runbook_worker_id: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HybridRunbookWorker, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.HybridRunbookWorker
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorker]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
hybrid_runbook_worker_id=hybrid_runbook_worker_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('HybridRunbookWorker', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}"} # type: ignore
@distributed_trace_async
async def create(
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
hybrid_runbook_worker_id: str,
hybrid_runbook_worker_creation_parameters: _models.HybridRunbookWorkerCreateParameters,
**kwargs: Any
) -> _models.HybridRunbookWorker:
"""Create a hybrid runbook worker.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param hybrid_runbook_worker_id: The hybrid runbook worker id.
:type hybrid_runbook_worker_id: str
:param hybrid_runbook_worker_creation_parameters: The create or update parameters for hybrid
runbook worker.
:type hybrid_runbook_worker_creation_parameters:
~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HybridRunbookWorker, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.HybridRunbookWorker
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorker]
_json = self._serialize.body(hybrid_runbook_worker_creation_parameters, 'HybridRunbookWorkerCreateParameters')
request = build_create_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
hybrid_runbook_worker_id=hybrid_runbook_worker_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('HybridRunbookWorker', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}"} # type: ignore
@distributed_trace_async
async def move( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
hybrid_runbook_worker_id: str,
hybrid_runbook_worker_move_parameters: _models.HybridRunbookWorkerMoveParameters,
**kwargs: Any
) -> None:
"""Move a hybrid worker to a different group.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param hybrid_runbook_worker_id: The hybrid runbook worker id.
:type hybrid_runbook_worker_id: str
:param hybrid_runbook_worker_move_parameters: The hybrid runbook worker move parameters.
:type hybrid_runbook_worker_move_parameters:
~azure.mgmt.automation.models.HybridRunbookWorkerMoveParameters
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[None]
_json = self._serialize.body(hybrid_runbook_worker_move_parameters, 'HybridRunbookWorkerMoveParameters')
request = build_move_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
hybrid_runbook_worker_id=hybrid_runbook_worker_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.move.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
move.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}/move"} # type: ignore
@distributed_trace
def list_by_hybrid_runbook_worker_group(
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.HybridRunbookWorkersListResult]:
"""Retrieve a list of hybrid runbook workers.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either HybridRunbookWorkersListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.HybridRunbookWorkersListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorkersListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_hybrid_runbook_worker_group_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_hybrid_runbook_worker_group.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_hybrid_runbook_worker_group_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("HybridRunbookWorkersListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_hybrid_runbook_worker_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_hybrid_runbook_workers_operations.py
|
_hybrid_runbook_workers_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._hybrid_runbook_workers_operations import build_create_request, build_delete_request, build_get_request, build_list_by_hybrid_runbook_worker_group_request, build_move_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class HybridRunbookWorkersOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`hybrid_runbook_workers` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
hybrid_runbook_worker_id: str,
**kwargs: Any
) -> None:
"""Delete a hybrid runbook worker.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param hybrid_runbook_worker_id: The hybrid runbook worker id.
:type hybrid_runbook_worker_id: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
hybrid_runbook_worker_id=hybrid_runbook_worker_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
hybrid_runbook_worker_id: str,
**kwargs: Any
) -> _models.HybridRunbookWorker:
"""Retrieve a hybrid runbook worker.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param hybrid_runbook_worker_id: The hybrid runbook worker id.
:type hybrid_runbook_worker_id: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HybridRunbookWorker, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.HybridRunbookWorker
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorker]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
hybrid_runbook_worker_id=hybrid_runbook_worker_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('HybridRunbookWorker', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}"} # type: ignore
@distributed_trace_async
async def create(
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
hybrid_runbook_worker_id: str,
hybrid_runbook_worker_creation_parameters: _models.HybridRunbookWorkerCreateParameters,
**kwargs: Any
) -> _models.HybridRunbookWorker:
"""Create a hybrid runbook worker.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param hybrid_runbook_worker_id: The hybrid runbook worker id.
:type hybrid_runbook_worker_id: str
:param hybrid_runbook_worker_creation_parameters: The create or update parameters for hybrid
runbook worker.
:type hybrid_runbook_worker_creation_parameters:
~azure.mgmt.automation.models.HybridRunbookWorkerCreateParameters
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HybridRunbookWorker, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.HybridRunbookWorker
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorker]
_json = self._serialize.body(hybrid_runbook_worker_creation_parameters, 'HybridRunbookWorkerCreateParameters')
request = build_create_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
hybrid_runbook_worker_id=hybrid_runbook_worker_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('HybridRunbookWorker', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}"} # type: ignore
@distributed_trace_async
async def move( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
hybrid_runbook_worker_id: str,
hybrid_runbook_worker_move_parameters: _models.HybridRunbookWorkerMoveParameters,
**kwargs: Any
) -> None:
"""Move a hybrid worker to a different group.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param hybrid_runbook_worker_id: The hybrid runbook worker id.
:type hybrid_runbook_worker_id: str
:param hybrid_runbook_worker_move_parameters: The hybrid runbook worker move parameters.
:type hybrid_runbook_worker_move_parameters:
~azure.mgmt.automation.models.HybridRunbookWorkerMoveParameters
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[None]
_json = self._serialize.body(hybrid_runbook_worker_move_parameters, 'HybridRunbookWorkerMoveParameters')
request = build_move_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
hybrid_runbook_worker_id=hybrid_runbook_worker_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.move.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
move.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers/{hybridRunbookWorkerId}/move"} # type: ignore
@distributed_trace
def list_by_hybrid_runbook_worker_group(
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.HybridRunbookWorkersListResult]:
"""Retrieve a list of hybrid runbook workers.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either HybridRunbookWorkersListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.HybridRunbookWorkersListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorkersListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_hybrid_runbook_worker_group_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_hybrid_runbook_worker_group.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_hybrid_runbook_worker_group_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("HybridRunbookWorkersListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_hybrid_runbook_worker_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}/hybridRunbookWorkers"} # type: ignore
| 0.835919 | 0.09886 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._dsc_node_configuration_operations import build_create_or_update_request_initial, build_delete_request, build_get_request, build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class DscNodeConfigurationOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`dsc_node_configuration` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
node_configuration_name: str,
**kwargs: Any
) -> None:
"""Delete the Dsc node configurations by node configuration.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_configuration_name: The Dsc node configuration name.
:type node_configuration_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_configuration_name=node_configuration_name,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
node_configuration_name: str,
**kwargs: Any
) -> _models.DscNodeConfiguration:
"""Retrieve the Dsc node configurations by node configuration.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_configuration_name: The Dsc node configuration name.
:type node_configuration_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscNodeConfiguration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscNodeConfiguration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNodeConfiguration]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_configuration_name=node_configuration_name,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscNodeConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}"} # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
automation_account_name: str,
node_configuration_name: str,
parameters: _models.DscNodeConfigurationCreateOrUpdateParameters,
**kwargs: Any
) -> Optional[_models.DscNodeConfiguration]:
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.DscNodeConfiguration]]
_json = self._serialize.body(parameters, 'DscNodeConfigurationCreateOrUpdateParameters')
request = build_create_or_update_request_initial(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_configuration_name=node_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self._create_or_update_initial.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 201:
deserialized = self._deserialize('DscNodeConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}"} # type: ignore
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
node_configuration_name: str,
parameters: _models.DscNodeConfigurationCreateOrUpdateParameters,
**kwargs: Any
) -> AsyncLROPoller[_models.DscNodeConfiguration]:
"""Create the node configuration identified by node configuration name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_configuration_name: The Dsc node configuration name.
:type node_configuration_name: str
:param parameters: The create or update parameters for configuration.
:type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either DscNodeConfiguration or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscNodeConfiguration]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNodeConfiguration]
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._create_or_update_initial( # type: ignore
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_configuration_name=node_configuration_name,
parameters=parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x,y,z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop('error_map', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('DscNodeConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method = cast(AsyncPollingMethod, AsyncARMPolling(
lro_delay,
**kwargs
)) # type: AsyncPollingMethod
elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
skip: Optional[int] = None,
top: Optional[int] = None,
inlinecount: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.DscNodeConfigurationListResult]:
"""Retrieve a list of dsc node configurations.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:param skip: The number of rows to skip. Default value is None.
:type skip: int
:param top: The number of rows to take. Default value is None.
:type top: int
:param inlinecount: Return total rows. Default value is None.
:type inlinecount: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DscNodeConfigurationListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscNodeConfigurationListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNodeConfigurationListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
skip=skip,
top=top,
inlinecount=inlinecount,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
skip=skip,
top=top,
inlinecount=inlinecount,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DscNodeConfigurationListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_dsc_node_configuration_operations.py
|
_dsc_node_configuration_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._dsc_node_configuration_operations import build_create_or_update_request_initial, build_delete_request, build_get_request, build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class DscNodeConfigurationOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`dsc_node_configuration` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
node_configuration_name: str,
**kwargs: Any
) -> None:
"""Delete the Dsc node configurations by node configuration.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_configuration_name: The Dsc node configuration name.
:type node_configuration_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_configuration_name=node_configuration_name,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
node_configuration_name: str,
**kwargs: Any
) -> _models.DscNodeConfiguration:
"""Retrieve the Dsc node configurations by node configuration.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_configuration_name: The Dsc node configuration name.
:type node_configuration_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscNodeConfiguration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscNodeConfiguration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNodeConfiguration]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_configuration_name=node_configuration_name,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscNodeConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}"} # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
automation_account_name: str,
node_configuration_name: str,
parameters: _models.DscNodeConfigurationCreateOrUpdateParameters,
**kwargs: Any
) -> Optional[_models.DscNodeConfiguration]:
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.DscNodeConfiguration]]
_json = self._serialize.body(parameters, 'DscNodeConfigurationCreateOrUpdateParameters')
request = build_create_or_update_request_initial(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_configuration_name=node_configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self._create_or_update_initial.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 201:
deserialized = self._deserialize('DscNodeConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}"} # type: ignore
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
node_configuration_name: str,
parameters: _models.DscNodeConfigurationCreateOrUpdateParameters,
**kwargs: Any
) -> AsyncLROPoller[_models.DscNodeConfiguration]:
"""Create the node configuration identified by node configuration name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param node_configuration_name: The Dsc node configuration name.
:type node_configuration_name: str
:param parameters: The create or update parameters for configuration.
:type parameters: ~azure.mgmt.automation.models.DscNodeConfigurationCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either DscNodeConfiguration or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscNodeConfiguration]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNodeConfiguration]
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._create_or_update_initial( # type: ignore
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
node_configuration_name=node_configuration_name,
parameters=parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x,y,z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop('error_map', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('DscNodeConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method = cast(AsyncPollingMethod, AsyncARMPolling(
lro_delay,
**kwargs
)) # type: AsyncPollingMethod
elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations/{nodeConfigurationName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
skip: Optional[int] = None,
top: Optional[int] = None,
inlinecount: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.DscNodeConfigurationListResult]:
"""Retrieve a list of dsc node configurations.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:param skip: The number of rows to skip. Default value is None.
:type skip: int
:param top: The number of rows to take. Default value is None.
:type top: int
:param inlinecount: Return total rows. Default value is None.
:type inlinecount: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DscNodeConfigurationListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscNodeConfigurationListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscNodeConfigurationListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
skip=skip,
top=top,
inlinecount=inlinecount,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
skip=skip,
top=top,
inlinecount=inlinecount,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DscNodeConfigurationListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/nodeConfigurations"} # type: ignore
| 0.846483 | 0.089893 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._job_stream_operations import build_get_request, build_list_by_job_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class JobStreamOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`job_stream` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
job_stream_id: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.JobStream:
"""Retrieve the job stream identified by job stream id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param job_stream_id: The job stream id.
:type job_stream_id: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: JobStream, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.JobStream
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobStream]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
job_stream_id=job_stream_id,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('JobStream', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams/{jobStreamId}"} # type: ignore
@distributed_trace
def list_by_job(
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
filter: Optional[str] = None,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.JobStreamListResult]:
"""Retrieve a list of jobs streams identified by job name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either JobStreamListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobStreamListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobStreamListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_job_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
client_request_id=client_request_id,
template_url=self.list_by_job.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_job_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
client_request_id=client_request_id,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("JobStreamListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_job_stream_operations.py
|
_job_stream_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._job_stream_operations import build_get_request, build_list_by_job_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class JobStreamOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`job_stream` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
job_stream_id: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.JobStream:
"""Retrieve the job stream identified by job stream id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param job_stream_id: The job stream id.
:type job_stream_id: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: JobStream, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.JobStream
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobStream]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
job_stream_id=job_stream_id,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('JobStream', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams/{jobStreamId}"} # type: ignore
@distributed_trace
def list_by_job(
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
filter: Optional[str] = None,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.JobStreamListResult]:
"""Retrieve a list of jobs streams identified by job name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either JobStreamListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobStreamListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobStreamListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_job_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
client_request_id=client_request_id,
template_url=self.list_by_job.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_job_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
client_request_id=client_request_id,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("JobStreamListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/streams"} # type: ignore
| 0.84039 | 0.074838 |
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._keys_operations import build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class KeysOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`keys` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> _models.KeyListResult:
"""Retrieve the automation keys for an account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyListResult, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.KeyListResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult]
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('KeyListResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listKeys"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_keys_operations.py
|
_keys_operations.py
|
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._keys_operations import build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class KeysOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`keys` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> _models.KeyListResult:
"""Retrieve the automation keys for an account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: KeyListResult, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.KeyListResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.KeyListResult]
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('KeyListResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/listKeys"} # type: ignore
| 0.843186 | 0.088072 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._source_control_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SourceControlOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`source_control` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
parameters: _models.SourceControlCreateOrUpdateParameters,
**kwargs: Any
) -> _models.SourceControl:
"""Create a source control.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param parameters: The parameters supplied to the create or update source control operation.
:type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControl, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SourceControl
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl]
_json = self._serialize.body(parameters, 'SourceControlCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('SourceControl', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('SourceControl', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
parameters: _models.SourceControlUpdateParameters,
**kwargs: Any
) -> _models.SourceControl:
"""Update a source control.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param parameters: The parameters supplied to the update source control operation.
:type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControl, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SourceControl
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl]
_json = self._serialize.body(parameters, 'SourceControlUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SourceControl', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
**kwargs: Any
) -> None:
"""Delete the source control.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The name of source control.
:type source_control_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
**kwargs: Any
) -> _models.SourceControl:
"""Retrieve the source control identified by source control name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The name of source control.
:type source_control_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControl, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SourceControl
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SourceControl', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.SourceControlListResult]:
"""Retrieve a list of source controls.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either SourceControlListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.SourceControlListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_source_control_operations.py
|
_source_control_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._source_control_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SourceControlOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`source_control` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
parameters: _models.SourceControlCreateOrUpdateParameters,
**kwargs: Any
) -> _models.SourceControl:
"""Create a source control.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param parameters: The parameters supplied to the create or update source control operation.
:type parameters: ~azure.mgmt.automation.models.SourceControlCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControl, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SourceControl
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl]
_json = self._serialize.body(parameters, 'SourceControlCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('SourceControl', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('SourceControl', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
parameters: _models.SourceControlUpdateParameters,
**kwargs: Any
) -> _models.SourceControl:
"""Update a source control.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param parameters: The parameters supplied to the update source control operation.
:type parameters: ~azure.mgmt.automation.models.SourceControlUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControl, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SourceControl
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl]
_json = self._serialize.body(parameters, 'SourceControlUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SourceControl', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
**kwargs: Any
) -> None:
"""Delete the source control.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The name of source control.
:type source_control_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
**kwargs: Any
) -> _models.SourceControl:
"""Retrieve the source control identified by source control name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The name of source control.
:type source_control_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControl, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SourceControl
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControl]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SourceControl', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.SourceControlListResult]:
"""Retrieve a list of source controls.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either SourceControlListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.SourceControlListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls"} # type: ignore
| 0.850624 | 0.090053 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._dsc_configuration_operations import build_create_or_update_request, build_delete_request, build_get_content_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class DscConfigurationOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`dsc_configuration` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
configuration_name: str,
**kwargs: Any
) -> None:
"""Delete the dsc configuration identified by configuration name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param configuration_name: The configuration name.
:type configuration_name: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
configuration_name=configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
configuration_name: str,
**kwargs: Any
) -> _models.DscConfiguration:
"""Retrieve the configuration identified by configuration name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param configuration_name: The configuration name.
:type configuration_name: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscConfiguration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscConfiguration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscConfiguration]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
configuration_name=configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
configuration_name: str,
parameters: Union[str, _models.DscConfigurationCreateOrUpdateParameters],
*,
content_type: Optional[str] = "application/json",
**kwargs: Any
) -> _models.DscConfiguration:
"""Create the configuration identified by configuration name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param configuration_name: The create or update parameters for configuration.
:type configuration_name: str
:param parameters: The create or update parameters for configuration.
:type parameters: str or ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters
:keyword content_type: Media type of the body sent to the API. Known values are: "text/plain;
charset=utf-8" or "application/json". Default value is "application/json".
:paramtype content_type: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscConfiguration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscConfiguration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscConfiguration]
_json = None
_content = None
content_type = content_type or ""
if content_type.split(";")[0] in ['application/json']:
_json = parameters
elif content_type.split(";")[0] in ['text/plain']:
_content = parameters
else:
raise ValueError(
"The content_type '{}' is not one of the allowed values: "
"['text/plain; charset=utf-8', 'application/json']".format(content_type)
)
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
configuration_name=configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('DscConfiguration', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('DscConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
configuration_name: str,
parameters: Optional[Union[str, _models.DscConfigurationUpdateParameters]] = None,
*,
content_type: Optional[str] = "application/json",
**kwargs: Any
) -> _models.DscConfiguration:
"""Create the configuration identified by configuration name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param configuration_name: The create or update parameters for configuration.
:type configuration_name: str
:param parameters: The create or update parameters for configuration. Default value is None.
:type parameters: str or ~azure.mgmt.automation.models.DscConfigurationUpdateParameters
:keyword content_type: Media type of the body sent to the API. Known values are: "text/plain;
charset=utf-8" or "application/json". Default value is "application/json".
:paramtype content_type: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscConfiguration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscConfiguration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscConfiguration]
_json = None
_content = None
content_type = content_type or ""
if content_type.split(";")[0] in ['application/json']:
_json = parameters
elif content_type.split(";")[0] in ['text/plain']:
_content = parameters
else:
raise ValueError(
"The content_type '{}' is not one of the allowed values: "
"['text/plain; charset=utf-8', 'application/json']".format(content_type)
)
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
configuration_name=configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}"} # type: ignore
@distributed_trace_async
async def get_content(
self,
resource_group_name: str,
automation_account_name: str,
configuration_name: str,
**kwargs: Any
) -> str:
"""Retrieve the configuration script identified by configuration name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param configuration_name: The configuration name.
:type configuration_name: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: str, or the result of cls(response)
:rtype: str
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[str]
request = build_get_content_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
configuration_name=configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_content.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('str', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}/content"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
skip: Optional[int] = None,
top: Optional[int] = None,
inlinecount: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.DscConfigurationListResult]:
"""Retrieve a list of configurations.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:param skip: The number of rows to skip. Default value is None.
:type skip: int
:param top: The number of rows to take. Default value is None.
:type top: int
:param inlinecount: Return total rows. Default value is None.
:type inlinecount: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DscConfigurationListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscConfigurationListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscConfigurationListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
skip=skip,
top=top,
inlinecount=inlinecount,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
skip=skip,
top=top,
inlinecount=inlinecount,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DscConfigurationListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_dsc_configuration_operations.py
|
_dsc_configuration_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._dsc_configuration_operations import build_create_or_update_request, build_delete_request, build_get_content_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class DscConfigurationOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`dsc_configuration` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
configuration_name: str,
**kwargs: Any
) -> None:
"""Delete the dsc configuration identified by configuration name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param configuration_name: The configuration name.
:type configuration_name: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
configuration_name=configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
configuration_name: str,
**kwargs: Any
) -> _models.DscConfiguration:
"""Retrieve the configuration identified by configuration name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param configuration_name: The configuration name.
:type configuration_name: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscConfiguration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscConfiguration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscConfiguration]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
configuration_name=configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
configuration_name: str,
parameters: Union[str, _models.DscConfigurationCreateOrUpdateParameters],
*,
content_type: Optional[str] = "application/json",
**kwargs: Any
) -> _models.DscConfiguration:
"""Create the configuration identified by configuration name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param configuration_name: The create or update parameters for configuration.
:type configuration_name: str
:param parameters: The create or update parameters for configuration.
:type parameters: str or ~azure.mgmt.automation.models.DscConfigurationCreateOrUpdateParameters
:keyword content_type: Media type of the body sent to the API. Known values are: "text/plain;
charset=utf-8" or "application/json". Default value is "application/json".
:paramtype content_type: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscConfiguration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscConfiguration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscConfiguration]
_json = None
_content = None
content_type = content_type or ""
if content_type.split(";")[0] in ['application/json']:
_json = parameters
elif content_type.split(";")[0] in ['text/plain']:
_content = parameters
else:
raise ValueError(
"The content_type '{}' is not one of the allowed values: "
"['text/plain; charset=utf-8', 'application/json']".format(content_type)
)
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
configuration_name=configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('DscConfiguration', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('DscConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
configuration_name: str,
parameters: Optional[Union[str, _models.DscConfigurationUpdateParameters]] = None,
*,
content_type: Optional[str] = "application/json",
**kwargs: Any
) -> _models.DscConfiguration:
"""Create the configuration identified by configuration name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param configuration_name: The create or update parameters for configuration.
:type configuration_name: str
:param parameters: The create or update parameters for configuration. Default value is None.
:type parameters: str or ~azure.mgmt.automation.models.DscConfigurationUpdateParameters
:keyword content_type: Media type of the body sent to the API. Known values are: "text/plain;
charset=utf-8" or "application/json". Default value is "application/json".
:paramtype content_type: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscConfiguration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscConfiguration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscConfiguration]
_json = None
_content = None
content_type = content_type or ""
if content_type.split(";")[0] in ['application/json']:
_json = parameters
elif content_type.split(";")[0] in ['text/plain']:
_content = parameters
else:
raise ValueError(
"The content_type '{}' is not one of the allowed values: "
"['text/plain; charset=utf-8', 'application/json']".format(content_type)
)
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
configuration_name=configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}"} # type: ignore
@distributed_trace_async
async def get_content(
self,
resource_group_name: str,
automation_account_name: str,
configuration_name: str,
**kwargs: Any
) -> str:
"""Retrieve the configuration script identified by configuration name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param configuration_name: The configuration name.
:type configuration_name: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: str, or the result of cls(response)
:rtype: str
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[str]
request = build_get_content_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
configuration_name=configuration_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_content.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('str', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations/{configurationName}/content"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
skip: Optional[int] = None,
top: Optional[int] = None,
inlinecount: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.DscConfigurationListResult]:
"""Retrieve a list of configurations.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:param skip: The number of rows to skip. Default value is None.
:type skip: int
:param top: The number of rows to take. Default value is None.
:type top: int
:param inlinecount: Return total rows. Default value is None.
:type inlinecount: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DscConfigurationListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscConfigurationListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscConfigurationListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
skip=skip,
top=top,
inlinecount=inlinecount,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
skip=skip,
top=top,
inlinecount=inlinecount,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DscConfigurationListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/configurations"} # type: ignore
| 0.850531 | 0.088899 |
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._runbook_draft_operations import build_get_content_request, build_get_request, build_replace_content_request_initial, build_undo_edit_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class RunbookDraftOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`runbook_draft` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get_content(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> IO:
"""Retrieve the content of runbook draft identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: IO, or the result of cls(response)
:rtype: IO
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[IO]
request = build_get_content_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self.get_content.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('IO', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content"} # type: ignore
async def _replace_content_initial(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
runbook_content: str,
**kwargs: Any
) -> Optional[IO]:
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "text/powershell")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]]
_content = runbook_content
request = build_replace_content_request_initial(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
content_type=content_type,
content=_content,
template_url=self._replace_content_initial.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=True,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = None
response_headers = {}
if response.status_code == 200:
deserialized = response.stream_download(self._client._pipeline)
if response.status_code == 202:
response_headers['location']=self._deserialize('str', response.headers.get('location'))
if cls:
return cls(pipeline_response, deserialized, response_headers)
return deserialized
_replace_content_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content"} # type: ignore
@distributed_trace_async
async def begin_replace_content(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
runbook_content: str,
**kwargs: Any
) -> AsyncLROPoller[IO]:
"""Replaces the runbook draft content.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:param runbook_content: The runbook draft content.
:type runbook_content: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either IO or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[IO]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "text/powershell")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[IO]
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._replace_content_initial( # type: ignore
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
runbook_content=runbook_content,
api_version=api_version,
content_type=content_type,
cls=lambda x,y,z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop('error_map', None)
def get_long_running_output(pipeline_response):
deserialized = response.stream_download(self._client._pipeline)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method = cast(AsyncPollingMethod, AsyncARMPolling(
lro_delay,
**kwargs
)) # type: AsyncPollingMethod
elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_replace_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> _models.RunbookDraft:
"""Retrieve the runbook draft identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: RunbookDraft, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.RunbookDraft
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.RunbookDraft]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('RunbookDraft', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft"} # type: ignore
@distributed_trace_async
async def undo_edit(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> _models.RunbookDraftUndoEditResult:
"""Undo draft edit to last known published state identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: RunbookDraftUndoEditResult, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.RunbookDraftUndoEditResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.RunbookDraftUndoEditResult]
request = build_undo_edit_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self.undo_edit.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('RunbookDraftUndoEditResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
undo_edit.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_runbook_draft_operations.py
|
_runbook_draft_operations.py
|
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._runbook_draft_operations import build_get_content_request, build_get_request, build_replace_content_request_initial, build_undo_edit_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class RunbookDraftOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`runbook_draft` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get_content(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> IO:
"""Retrieve the content of runbook draft identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: IO, or the result of cls(response)
:rtype: IO
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[IO]
request = build_get_content_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self.get_content.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('IO', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content"} # type: ignore
async def _replace_content_initial(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
runbook_content: str,
**kwargs: Any
) -> Optional[IO]:
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "text/powershell")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[Optional[IO]]
_content = runbook_content
request = build_replace_content_request_initial(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
content_type=content_type,
content=_content,
template_url=self._replace_content_initial.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=True,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = None
response_headers = {}
if response.status_code == 200:
deserialized = response.stream_download(self._client._pipeline)
if response.status_code == 202:
response_headers['location']=self._deserialize('str', response.headers.get('location'))
if cls:
return cls(pipeline_response, deserialized, response_headers)
return deserialized
_replace_content_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content"} # type: ignore
@distributed_trace_async
async def begin_replace_content(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
runbook_content: str,
**kwargs: Any
) -> AsyncLROPoller[IO]:
"""Replaces the runbook draft content.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:param runbook_content: The runbook draft content.
:type runbook_content: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either IO or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[IO]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "text/powershell")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[IO]
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._replace_content_initial( # type: ignore
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
runbook_content=runbook_content,
api_version=api_version,
content_type=content_type,
cls=lambda x,y,z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop('error_map', None)
def get_long_running_output(pipeline_response):
deserialized = response.stream_download(self._client._pipeline)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method = cast(AsyncPollingMethod, AsyncARMPolling(
lro_delay,
**kwargs
)) # type: AsyncPollingMethod
elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_replace_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/content"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> _models.RunbookDraft:
"""Retrieve the runbook draft identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: RunbookDraft, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.RunbookDraft
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.RunbookDraft]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('RunbookDraft', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft"} # type: ignore
@distributed_trace_async
async def undo_edit(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> _models.RunbookDraftUndoEditResult:
"""Undo draft edit to last known published state identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: RunbookDraftUndoEditResult, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.RunbookDraftUndoEditResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.RunbookDraftUndoEditResult]
request = build_undo_edit_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self.undo_edit.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('RunbookDraftUndoEditResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
undo_edit.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/draft/undoEdit"} # type: ignore
| 0.808597 | 0.084417 |
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._software_update_configuration_machine_runs_operations import build_get_by_id_request, build_list_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SoftwareUpdateConfigurationMachineRunsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`software_update_configuration_machine_runs` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get_by_id(
self,
resource_group_name: str,
automation_account_name: str,
software_update_configuration_machine_run_id: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfigurationMachineRun:
"""Get a single software update configuration machine run by Id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param software_update_configuration_machine_run_id: The Id of the software update
configuration machine run.
:type software_update_configuration_machine_run_id: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfigurationMachineRun, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfigurationMachineRun]
request = build_get_by_id_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
software_update_configuration_machine_run_id=software_update_configuration_machine_run_id,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get_by_id.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SoftwareUpdateConfigurationMachineRun', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_by_id.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns/{softwareUpdateConfigurationMachineRunId}"} # type: ignore
@distributed_trace_async
async def list(
self,
resource_group_name: str,
automation_account_name: str,
client_request_id: Optional[str] = None,
filter: Optional[str] = None,
skip: Optional[str] = None,
top: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfigurationMachineRunListResult:
"""Return list of software update configuration machine runs.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:param filter: The filter to apply on the operation. You can use the following filters:
'properties/osType', 'properties/status', 'properties/startTime', and
'properties/softwareUpdateConfiguration/name'. Default value is None.
:type filter: str
:param skip: number of entries you skip before returning results. Default value is None.
:type skip: str
:param top: Maximum number of entries returned in the results collection. Default value is
None.
:type top: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfigurationMachineRunListResult, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRunListResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfigurationMachineRunListResult]
request = build_list_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
client_request_id=client_request_id,
filter=filter,
skip=skip,
top=top,
template_url=self.list.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SoftwareUpdateConfigurationMachineRunListResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_software_update_configuration_machine_runs_operations.py
|
_software_update_configuration_machine_runs_operations.py
|
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._software_update_configuration_machine_runs_operations import build_get_by_id_request, build_list_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SoftwareUpdateConfigurationMachineRunsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`software_update_configuration_machine_runs` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get_by_id(
self,
resource_group_name: str,
automation_account_name: str,
software_update_configuration_machine_run_id: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfigurationMachineRun:
"""Get a single software update configuration machine run by Id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param software_update_configuration_machine_run_id: The Id of the software update
configuration machine run.
:type software_update_configuration_machine_run_id: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfigurationMachineRun, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfigurationMachineRun]
request = build_get_by_id_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
software_update_configuration_machine_run_id=software_update_configuration_machine_run_id,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get_by_id.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SoftwareUpdateConfigurationMachineRun', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_by_id.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns/{softwareUpdateConfigurationMachineRunId}"} # type: ignore
@distributed_trace_async
async def list(
self,
resource_group_name: str,
automation_account_name: str,
client_request_id: Optional[str] = None,
filter: Optional[str] = None,
skip: Optional[str] = None,
top: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfigurationMachineRunListResult:
"""Return list of software update configuration machine runs.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:param filter: The filter to apply on the operation. You can use the following filters:
'properties/osType', 'properties/status', 'properties/startTime', and
'properties/softwareUpdateConfiguration/name'. Default value is None.
:type filter: str
:param skip: number of entries you skip before returning results. Default value is None.
:type skip: str
:param top: Maximum number of entries returned in the results collection. Default value is
None.
:type top: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfigurationMachineRunListResult, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRunListResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfigurationMachineRunListResult]
request = build_list_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
client_request_id=client_request_id,
filter=filter,
skip=skip,
top=top,
template_url=self.list.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SoftwareUpdateConfigurationMachineRunListResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationMachineRuns"} # type: ignore
| 0.856962 | 0.076339 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._python2_package_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class Python2PackageOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`python2_package` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
package_name: str,
**kwargs: Any
) -> None:
"""Delete the python 2 package by name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param package_name: The python package name.
:type package_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
package_name=package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
package_name: str,
**kwargs: Any
) -> _models.Module:
"""Retrieve the python 2 package identified by package name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param package_name: The python package name.
:type package_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Module, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Module
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Module]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
package_name=package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Module', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
package_name: str,
parameters: _models.PythonPackageCreateParameters,
**kwargs: Any
) -> _models.Module:
"""Create or Update the python 2 package identified by package name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param package_name: The name of python package.
:type package_name: str
:param parameters: The create or update parameters for python package.
:type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Module, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Module
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Module]
_json = self._serialize.body(parameters, 'PythonPackageCreateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
package_name=package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Module', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Module', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
package_name: str,
parameters: _models.PythonPackageUpdateParameters,
**kwargs: Any
) -> _models.Module:
"""Update the python 2 package identified by package name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param package_name: The name of python package.
:type package_name: str
:param parameters: The update parameters for python package.
:type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Module, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Module
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Module]
_json = self._serialize.body(parameters, 'PythonPackageUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
package_name=package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Module', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.ModuleListResult]:
"""Retrieve a list of python 2 packages.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ModuleListResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ModuleListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ModuleListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ModuleListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_python2_package_operations.py
|
_python2_package_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._python2_package_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class Python2PackageOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`python2_package` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
package_name: str,
**kwargs: Any
) -> None:
"""Delete the python 2 package by name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param package_name: The python package name.
:type package_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
package_name=package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
package_name: str,
**kwargs: Any
) -> _models.Module:
"""Retrieve the python 2 package identified by package name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param package_name: The python package name.
:type package_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Module, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Module
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Module]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
package_name=package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Module', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
package_name: str,
parameters: _models.PythonPackageCreateParameters,
**kwargs: Any
) -> _models.Module:
"""Create or Update the python 2 package identified by package name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param package_name: The name of python package.
:type package_name: str
:param parameters: The create or update parameters for python package.
:type parameters: ~azure.mgmt.automation.models.PythonPackageCreateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Module, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Module
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Module]
_json = self._serialize.body(parameters, 'PythonPackageCreateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
package_name=package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Module', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Module', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
package_name: str,
parameters: _models.PythonPackageUpdateParameters,
**kwargs: Any
) -> _models.Module:
"""Update the python 2 package identified by package name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param package_name: The name of python package.
:type package_name: str
:param parameters: The update parameters for python package.
:type parameters: ~azure.mgmt.automation.models.PythonPackageUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Module, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Module
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Module]
_json = self._serialize.body(parameters, 'PythonPackageUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
package_name=package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Module', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages/{packageName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.ModuleListResult]:
"""Retrieve a list of python 2 packages.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ModuleListResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ModuleListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ModuleListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ModuleListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/python2Packages"} # type: ignore
| 0.861407 | 0.093388 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._dsc_compilation_job_operations import build_create_request_initial, build_get_request, build_get_stream_request, build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class DscCompilationJobOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`dsc_compilation_job` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
async def _create_initial(
self,
resource_group_name: str,
automation_account_name: str,
compilation_job_name: str,
parameters: _models.DscCompilationJobCreateParameters,
**kwargs: Any
) -> _models.DscCompilationJob:
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscCompilationJob]
_json = self._serialize.body(parameters, 'DscCompilationJobCreateParameters')
request = build_create_request_initial(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
compilation_job_name=compilation_job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self._create_initial.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscCompilationJob', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}"} # type: ignore
@distributed_trace_async
async def begin_create(
self,
resource_group_name: str,
automation_account_name: str,
compilation_job_name: str,
parameters: _models.DscCompilationJobCreateParameters,
**kwargs: Any
) -> AsyncLROPoller[_models.DscCompilationJob]:
"""Creates the Dsc compilation job of the configuration.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param compilation_job_name: The DSC configuration Id.
:type compilation_job_name: str
:param parameters: The parameters supplied to the create compilation job operation.
:type parameters: ~azure.mgmt.automation.models.DscCompilationJobCreateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either DscCompilationJob or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscCompilationJob]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscCompilationJob]
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._create_initial( # type: ignore
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
compilation_job_name=compilation_job_name,
parameters=parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x,y,z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop('error_map', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('DscCompilationJob', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method = cast(AsyncPollingMethod, AsyncARMPolling(
lro_delay,
**kwargs
)) # type: AsyncPollingMethod
elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
compilation_job_name: str,
**kwargs: Any
) -> _models.DscCompilationJob:
"""Retrieve the Dsc configuration compilation job identified by job id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param compilation_job_name: The DSC configuration Id.
:type compilation_job_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscCompilationJob, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscCompilationJob
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscCompilationJob]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
compilation_job_name=compilation_job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscCompilationJob', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.DscCompilationJobListResult]:
"""Retrieve a list of dsc compilation jobs.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DscCompilationJobListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscCompilationJobListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscCompilationJobListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DscCompilationJobListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs"} # type: ignore
@distributed_trace_async
async def get_stream(
self,
resource_group_name: str,
automation_account_name: str,
job_id: str,
job_stream_id: str,
**kwargs: Any
) -> _models.JobStream:
"""Retrieve the job stream identified by job stream id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_id: The job id.
:type job_id: str
:param job_stream_id: The job stream id.
:type job_stream_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: JobStream, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.JobStream
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobStream]
request = build_get_stream_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_id=job_id,
job_stream_id=job_stream_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_stream.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('JobStream', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_stream.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams/{jobStreamId}"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_dsc_compilation_job_operations.py
|
_dsc_compilation_job_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._dsc_compilation_job_operations import build_create_request_initial, build_get_request, build_get_stream_request, build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class DscCompilationJobOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`dsc_compilation_job` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
async def _create_initial(
self,
resource_group_name: str,
automation_account_name: str,
compilation_job_name: str,
parameters: _models.DscCompilationJobCreateParameters,
**kwargs: Any
) -> _models.DscCompilationJob:
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscCompilationJob]
_json = self._serialize.body(parameters, 'DscCompilationJobCreateParameters')
request = build_create_request_initial(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
compilation_job_name=compilation_job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self._create_initial.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscCompilationJob', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_create_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}"} # type: ignore
@distributed_trace_async
async def begin_create(
self,
resource_group_name: str,
automation_account_name: str,
compilation_job_name: str,
parameters: _models.DscCompilationJobCreateParameters,
**kwargs: Any
) -> AsyncLROPoller[_models.DscCompilationJob]:
"""Creates the Dsc compilation job of the configuration.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param compilation_job_name: The DSC configuration Id.
:type compilation_job_name: str
:param parameters: The parameters supplied to the create compilation job operation.
:type parameters: ~azure.mgmt.automation.models.DscCompilationJobCreateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either DscCompilationJob or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.DscCompilationJob]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscCompilationJob]
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._create_initial( # type: ignore
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
compilation_job_name=compilation_job_name,
parameters=parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x,y,z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop('error_map', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('DscCompilationJob', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method = cast(AsyncPollingMethod, AsyncARMPolling(
lro_delay,
**kwargs
)) # type: AsyncPollingMethod
elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
compilation_job_name: str,
**kwargs: Any
) -> _models.DscCompilationJob:
"""Retrieve the Dsc configuration compilation job identified by job id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param compilation_job_name: The DSC configuration Id.
:type compilation_job_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: DscCompilationJob, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.DscCompilationJob
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscCompilationJob]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
compilation_job_name=compilation_job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('DscCompilationJob', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{compilationJobName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.DscCompilationJobListResult]:
"""Retrieve a list of dsc compilation jobs.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either DscCompilationJobListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.DscCompilationJobListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.DscCompilationJobListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DscCompilationJobListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs"} # type: ignore
@distributed_trace_async
async def get_stream(
self,
resource_group_name: str,
automation_account_name: str,
job_id: str,
job_stream_id: str,
**kwargs: Any
) -> _models.JobStream:
"""Retrieve the job stream identified by job stream id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_id: The job id.
:type job_id: str
:param job_stream_id: The job stream id.
:type job_stream_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: JobStream, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.JobStream
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobStream]
request = build_get_stream_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_id=job_id,
job_stream_id=job_stream_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_stream.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('JobStream', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_stream.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams/{jobStreamId}"} # type: ignore
| 0.862988 | 0.104204 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._private_endpoint_connections_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class PrivateEndpointConnectionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`private_endpoint_connections` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]:
"""List all private endpoint connections on a Automation account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateEndpointConnectionListResult or the result
of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.PrivateEndpointConnectionListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
private_endpoint_connection_name: str,
**kwargs: Any
) -> _models.PrivateEndpointConnection:
"""Gets a private endpoint connection.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param private_endpoint_connection_name: The name of the private endpoint connection.
:type private_endpoint_connection_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.PrivateEndpointConnection
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
automation_account_name: str,
private_endpoint_connection_name: str,
parameters: _models.PrivateEndpointConnection,
**kwargs: Any
) -> Optional[_models.PrivateEndpointConnection]:
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]]
_json = self._serialize.body(parameters, 'PrivateEndpointConnection')
request = build_create_or_update_request_initial(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self._create_or_update_initial.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
private_endpoint_connection_name: str,
parameters: _models.PrivateEndpointConnection,
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateEndpointConnection]:
"""Approve or reject a private endpoint connection with a given name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param private_endpoint_connection_name: The name of the private endpoint connection.
:type private_endpoint_connection_name: str
:param parameters:
:type parameters: ~azure.mgmt.automation.models.PrivateEndpointConnection
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.PrivateEndpointConnection]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection]
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._create_or_update_initial( # type: ignore
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
parameters=parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x,y,z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop('error_map', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method = cast(AsyncPollingMethod, AsyncARMPolling(
lro_delay,
**kwargs
)) # type: AsyncPollingMethod
elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
private_endpoint_connection_name: str,
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request_initial(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
api_version=api_version,
template_url=self._delete_initial.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore
@distributed_trace_async
async def begin_delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
private_endpoint_connection_name: str,
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Deletes a private endpoint connection with a given name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param private_endpoint_connection_name: The name of the private endpoint connection.
:type private_endpoint_connection_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
api_version=api_version,
cls=lambda x,y,z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop('error_map', None)
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method = cast(AsyncPollingMethod, AsyncARMPolling(
lro_delay,
**kwargs
)) # type: AsyncPollingMethod
elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_private_endpoint_connections_operations.py
|
_private_endpoint_connections_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union, cast
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._private_endpoint_connections_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class PrivateEndpointConnectionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`private_endpoint_connections` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.PrivateEndpointConnectionListResult]:
"""List all private endpoint connections on a Automation account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateEndpointConnectionListResult or the result
of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.PrivateEndpointConnectionListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnectionListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateEndpointConnectionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
private_endpoint_connection_name: str,
**kwargs: Any
) -> _models.PrivateEndpointConnection:
"""Gets a private endpoint connection.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param private_endpoint_connection_name: The name of the private endpoint connection.
:type private_endpoint_connection_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateEndpointConnection, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.PrivateEndpointConnection
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore
async def _create_or_update_initial(
self,
resource_group_name: str,
automation_account_name: str,
private_endpoint_connection_name: str,
parameters: _models.PrivateEndpointConnection,
**kwargs: Any
) -> Optional[_models.PrivateEndpointConnection]:
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.PrivateEndpointConnection]]
_json = self._serialize.body(parameters, 'PrivateEndpointConnection')
request = build_create_or_update_request_initial(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self._create_or_update_initial.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
private_endpoint_connection_name: str,
parameters: _models.PrivateEndpointConnection,
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateEndpointConnection]:
"""Approve or reject a private endpoint connection with a given name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param private_endpoint_connection_name: The name of the private endpoint connection.
:type private_endpoint_connection_name: str
:param parameters:
:type parameters: ~azure.mgmt.automation.models.PrivateEndpointConnection
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateEndpointConnection or the
result of cls(response)
:rtype:
~azure.core.polling.AsyncLROPoller[~azure.mgmt.automation.models.PrivateEndpointConnection]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateEndpointConnection]
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._create_or_update_initial( # type: ignore
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
parameters=parameters,
api_version=api_version,
content_type=content_type,
cls=lambda x,y,z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop('error_map', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('PrivateEndpointConnection', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method = cast(AsyncPollingMethod, AsyncARMPolling(
lro_delay,
**kwargs
)) # type: AsyncPollingMethod
elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
private_endpoint_connection_name: str,
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request_initial(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
api_version=api_version,
template_url=self._delete_initial.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore
@distributed_trace_async
async def begin_delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
private_endpoint_connection_name: str,
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Deletes a private endpoint connection with a given name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param private_endpoint_connection_name: The name of the private endpoint connection.
:type private_endpoint_connection_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
private_endpoint_connection_name=private_endpoint_connection_name,
api_version=api_version,
cls=lambda x,y,z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop('error_map', None)
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method = cast(AsyncPollingMethod, AsyncARMPolling(
lro_delay,
**kwargs
)) # type: AsyncPollingMethod
elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore
| 0.854323 | 0.099952 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._connection_type_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ConnectionTypeOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`connection_type` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
connection_type_name: str,
**kwargs: Any
) -> None:
"""Delete the connection type.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_type_name: The name of connection type.
:type connection_type_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_type_name=connection_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
connection_type_name: str,
**kwargs: Any
) -> _models.ConnectionType:
"""Retrieve the connection type identified by connection type name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_type_name: The name of connection type.
:type connection_type_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ConnectionType, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.ConnectionType
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionType]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_type_name=connection_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('ConnectionType', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
connection_type_name: str,
parameters: _models.ConnectionTypeCreateOrUpdateParameters,
**kwargs: Any
) -> _models.ConnectionType:
"""Create a connection type.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_type_name: The parameters supplied to the create or update connection type
operation.
:type connection_type_name: str
:param parameters: The parameters supplied to the create or update connection type operation.
:type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ConnectionType, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.ConnectionType
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionType]
_json = self._serialize.body(parameters, 'ConnectionTypeCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_type_name=connection_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('ConnectionType', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.ConnectionTypeListResult]:
"""Retrieve a list of connection types.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConnectionTypeListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ConnectionTypeListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionTypeListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ConnectionTypeListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_connection_type_operations.py
|
_connection_type_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._connection_type_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ConnectionTypeOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`connection_type` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
connection_type_name: str,
**kwargs: Any
) -> None:
"""Delete the connection type.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_type_name: The name of connection type.
:type connection_type_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_type_name=connection_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
connection_type_name: str,
**kwargs: Any
) -> _models.ConnectionType:
"""Retrieve the connection type identified by connection type name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_type_name: The name of connection type.
:type connection_type_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ConnectionType, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.ConnectionType
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionType]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_type_name=connection_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('ConnectionType', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
connection_type_name: str,
parameters: _models.ConnectionTypeCreateOrUpdateParameters,
**kwargs: Any
) -> _models.ConnectionType:
"""Create a connection type.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_type_name: The parameters supplied to the create or update connection type
operation.
:type connection_type_name: str
:param parameters: The parameters supplied to the create or update connection type operation.
:type parameters: ~azure.mgmt.automation.models.ConnectionTypeCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ConnectionType, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.ConnectionType
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionType]
_json = self._serialize.body(parameters, 'ConnectionTypeCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_type_name=connection_type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('ConnectionType', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes/{connectionTypeName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.ConnectionTypeListResult]:
"""Retrieve a list of connection types.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConnectionTypeListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ConnectionTypeListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionTypeListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ConnectionTypeListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connectionTypes"} # type: ignore
| 0.841435 | 0.084833 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._hybrid_runbook_worker_group_operations import build_create_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class HybridRunbookWorkerGroupOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`hybrid_runbook_worker_group` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
**kwargs: Any
) -> None:
"""Delete a hybrid runbook worker group.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
**kwargs: Any
) -> _models.HybridRunbookWorkerGroup:
"""Retrieve a hybrid runbook worker group.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HybridRunbookWorkerGroup, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorkerGroup]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('HybridRunbookWorkerGroup', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}"} # type: ignore
@distributed_trace_async
async def create(
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
hybrid_runbook_worker_group_creation_parameters: _models.HybridRunbookWorkerGroupCreateOrUpdateParameters,
**kwargs: Any
) -> _models.HybridRunbookWorkerGroup:
"""Create a hybrid runbook worker group.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param hybrid_runbook_worker_group_creation_parameters: The create or update parameters for
hybrid runbook worker group.
:type hybrid_runbook_worker_group_creation_parameters:
~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HybridRunbookWorkerGroup, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorkerGroup]
_json = self._serialize.body(hybrid_runbook_worker_group_creation_parameters, 'HybridRunbookWorkerGroupCreateOrUpdateParameters')
request = build_create_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('HybridRunbookWorkerGroup', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
parameters: _models.HybridRunbookWorkerGroupCreateOrUpdateParameters,
**kwargs: Any
) -> _models.HybridRunbookWorkerGroup:
"""Update a hybrid runbook worker group.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param parameters: The hybrid runbook worker group.
:type parameters:
~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HybridRunbookWorkerGroup, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorkerGroup]
_json = self._serialize.body(parameters, 'HybridRunbookWorkerGroupCreateOrUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('HybridRunbookWorkerGroup', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.HybridRunbookWorkerGroupsListResult]:
"""Retrieve a list of hybrid runbook worker groups.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either HybridRunbookWorkerGroupsListResult or the result
of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.HybridRunbookWorkerGroupsListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorkerGroupsListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("HybridRunbookWorkerGroupsListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_hybrid_runbook_worker_group_operations.py
|
_hybrid_runbook_worker_group_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._hybrid_runbook_worker_group_operations import build_create_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class HybridRunbookWorkerGroupOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`hybrid_runbook_worker_group` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
**kwargs: Any
) -> None:
"""Delete a hybrid runbook worker group.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
**kwargs: Any
) -> _models.HybridRunbookWorkerGroup:
"""Retrieve a hybrid runbook worker group.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HybridRunbookWorkerGroup, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorkerGroup]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('HybridRunbookWorkerGroup', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}"} # type: ignore
@distributed_trace_async
async def create(
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
hybrid_runbook_worker_group_creation_parameters: _models.HybridRunbookWorkerGroupCreateOrUpdateParameters,
**kwargs: Any
) -> _models.HybridRunbookWorkerGroup:
"""Create a hybrid runbook worker group.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param hybrid_runbook_worker_group_creation_parameters: The create or update parameters for
hybrid runbook worker group.
:type hybrid_runbook_worker_group_creation_parameters:
~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HybridRunbookWorkerGroup, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorkerGroup]
_json = self._serialize.body(hybrid_runbook_worker_group_creation_parameters, 'HybridRunbookWorkerGroupCreateOrUpdateParameters')
request = build_create_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('HybridRunbookWorkerGroup', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
hybrid_runbook_worker_group_name: str,
parameters: _models.HybridRunbookWorkerGroupCreateOrUpdateParameters,
**kwargs: Any
) -> _models.HybridRunbookWorkerGroup:
"""Update a hybrid runbook worker group.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param hybrid_runbook_worker_group_name: The hybrid runbook worker group name.
:type hybrid_runbook_worker_group_name: str
:param parameters: The hybrid runbook worker group.
:type parameters:
~azure.mgmt.automation.models.HybridRunbookWorkerGroupCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HybridRunbookWorkerGroup, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.HybridRunbookWorkerGroup
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorkerGroup]
_json = self._serialize.body(parameters, 'HybridRunbookWorkerGroupCreateOrUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
hybrid_runbook_worker_group_name=hybrid_runbook_worker_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('HybridRunbookWorkerGroup', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups/{hybridRunbookWorkerGroupName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.HybridRunbookWorkerGroupsListResult]:
"""Retrieve a list of hybrid runbook worker groups.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either HybridRunbookWorkerGroupsListResult or the result
of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.HybridRunbookWorkerGroupsListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.HybridRunbookWorkerGroupsListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("HybridRunbookWorkerGroupsListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/hybridRunbookWorkerGroups"} # type: ignore
| 0.838548 | 0.084153 |
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._software_update_configurations_operations import build_create_request, build_delete_request, build_get_by_name_request, build_list_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SoftwareUpdateConfigurationsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`software_update_configurations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def create(
self,
resource_group_name: str,
automation_account_name: str,
software_update_configuration_name: str,
parameters: _models.SoftwareUpdateConfiguration,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfiguration:
"""Create a new software update configuration with the name given in the URI.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param software_update_configuration_name: The name of the software update configuration to be
created.
:type software_update_configuration_name: str
:param parameters: Request body.
:type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfiguration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfiguration]
_json = self._serialize.body(parameters, 'SoftwareUpdateConfiguration')
request = build_create_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
software_update_configuration_name=software_update_configuration_name,
api_version=api_version,
content_type=content_type,
json=_json,
client_request_id=client_request_id,
template_url=self.create.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('SoftwareUpdateConfiguration', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('SoftwareUpdateConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}"} # type: ignore
@distributed_trace_async
async def get_by_name(
self,
resource_group_name: str,
automation_account_name: str,
software_update_configuration_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfiguration:
"""Get a single software update configuration by name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param software_update_configuration_name: The name of the software update configuration to be
created.
:type software_update_configuration_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfiguration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfiguration]
request = build_get_by_name_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
software_update_configuration_name=software_update_configuration_name,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get_by_name.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SoftwareUpdateConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_by_name.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
software_update_configuration_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""delete a specific software update configuration.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param software_update_configuration_name: The name of the software update configuration to be
created.
:type software_update_configuration_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
software_update_configuration_name=software_update_configuration_name,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}"} # type: ignore
@distributed_trace_async
async def list(
self,
resource_group_name: str,
automation_account_name: str,
client_request_id: Optional[str] = None,
filter: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfigurationListResult:
"""Get all software update configurations for the account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfigurationListResult, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationListResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfigurationListResult]
request = build_list_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
client_request_id=client_request_id,
filter=filter,
template_url=self.list.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SoftwareUpdateConfigurationListResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_software_update_configurations_operations.py
|
_software_update_configurations_operations.py
|
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._software_update_configurations_operations import build_create_request, build_delete_request, build_get_by_name_request, build_list_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SoftwareUpdateConfigurationsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`software_update_configurations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def create(
self,
resource_group_name: str,
automation_account_name: str,
software_update_configuration_name: str,
parameters: _models.SoftwareUpdateConfiguration,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfiguration:
"""Create a new software update configuration with the name given in the URI.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param software_update_configuration_name: The name of the software update configuration to be
created.
:type software_update_configuration_name: str
:param parameters: Request body.
:type parameters: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfiguration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfiguration]
_json = self._serialize.body(parameters, 'SoftwareUpdateConfiguration')
request = build_create_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
software_update_configuration_name=software_update_configuration_name,
api_version=api_version,
content_type=content_type,
json=_json,
client_request_id=client_request_id,
template_url=self.create.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('SoftwareUpdateConfiguration', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('SoftwareUpdateConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}"} # type: ignore
@distributed_trace_async
async def get_by_name(
self,
resource_group_name: str,
automation_account_name: str,
software_update_configuration_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfiguration:
"""Get a single software update configuration by name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param software_update_configuration_name: The name of the software update configuration to be
created.
:type software_update_configuration_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfiguration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfiguration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfiguration]
request = build_get_by_name_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
software_update_configuration_name=software_update_configuration_name,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get_by_name.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SoftwareUpdateConfiguration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_by_name.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
software_update_configuration_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""delete a specific software update configuration.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param software_update_configuration_name: The name of the software update configuration to be
created.
:type software_update_configuration_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
software_update_configuration_name=software_update_configuration_name,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations/{softwareUpdateConfigurationName}"} # type: ignore
@distributed_trace_async
async def list(
self,
resource_group_name: str,
automation_account_name: str,
client_request_id: Optional[str] = None,
filter: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfigurationListResult:
"""Get all software update configurations for the account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfigurationListResult, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationListResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfigurationListResult]
request = build_list_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
client_request_id=client_request_id,
filter=filter,
template_url=self.list.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SoftwareUpdateConfigurationListResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurations"} # type: ignore
| 0.846133 | 0.079032 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._webhook_operations import build_create_or_update_request, build_delete_request, build_generate_uri_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class WebhookOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`webhook` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def generate_uri(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> str:
"""Generates a Uri for use in creating a webhook.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2015-10-31". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: str, or the result of cls(response)
:rtype: str
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-10-31")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[str]
request = build_generate_uri_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.generate_uri.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('str', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
generate_uri.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/generateUri"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
webhook_name: str,
**kwargs: Any
) -> None:
"""Delete the webhook by name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param webhook_name: The webhook name.
:type webhook_name: str
:keyword api_version: Api Version. Default value is "2015-10-31". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-10-31")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
webhook_name=webhook_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
webhook_name: str,
**kwargs: Any
) -> _models.Webhook:
"""Retrieve the webhook identified by webhook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param webhook_name: The webhook name.
:type webhook_name: str
:keyword api_version: Api Version. Default value is "2015-10-31". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Webhook, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Webhook
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-10-31")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Webhook]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
webhook_name=webhook_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Webhook', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
webhook_name: str,
parameters: _models.WebhookCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Webhook:
"""Create the webhook identified by webhook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param webhook_name: The webhook name.
:type webhook_name: str
:param parameters: The create or update parameters for webhook.
:type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2015-10-31". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Webhook, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Webhook
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-10-31")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Webhook]
_json = self._serialize.body(parameters, 'WebhookCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
webhook_name=webhook_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Webhook', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Webhook', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
webhook_name: str,
parameters: _models.WebhookUpdateParameters,
**kwargs: Any
) -> _models.Webhook:
"""Update the webhook identified by webhook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param webhook_name: The webhook name.
:type webhook_name: str
:param parameters: The update parameters for webhook.
:type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters
:keyword api_version: Api Version. Default value is "2015-10-31". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Webhook, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Webhook
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-10-31")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Webhook]
_json = self._serialize.body(parameters, 'WebhookUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
webhook_name=webhook_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Webhook', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.WebhookListResult]:
"""Retrieve a list of webhooks.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2015-10-31". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WebhookListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.WebhookListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-10-31")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.WebhookListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WebhookListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_webhook_operations.py
|
_webhook_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._webhook_operations import build_create_or_update_request, build_delete_request, build_generate_uri_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class WebhookOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`webhook` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def generate_uri(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> str:
"""Generates a Uri for use in creating a webhook.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2015-10-31". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: str, or the result of cls(response)
:rtype: str
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-10-31")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[str]
request = build_generate_uri_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.generate_uri.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('str', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
generate_uri.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/generateUri"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
webhook_name: str,
**kwargs: Any
) -> None:
"""Delete the webhook by name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param webhook_name: The webhook name.
:type webhook_name: str
:keyword api_version: Api Version. Default value is "2015-10-31". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-10-31")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
webhook_name=webhook_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
webhook_name: str,
**kwargs: Any
) -> _models.Webhook:
"""Retrieve the webhook identified by webhook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param webhook_name: The webhook name.
:type webhook_name: str
:keyword api_version: Api Version. Default value is "2015-10-31". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Webhook, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Webhook
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-10-31")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Webhook]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
webhook_name=webhook_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Webhook', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
webhook_name: str,
parameters: _models.WebhookCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Webhook:
"""Create the webhook identified by webhook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param webhook_name: The webhook name.
:type webhook_name: str
:param parameters: The create or update parameters for webhook.
:type parameters: ~azure.mgmt.automation.models.WebhookCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2015-10-31". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Webhook, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Webhook
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-10-31")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Webhook]
_json = self._serialize.body(parameters, 'WebhookCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
webhook_name=webhook_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Webhook', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Webhook', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
webhook_name: str,
parameters: _models.WebhookUpdateParameters,
**kwargs: Any
) -> _models.Webhook:
"""Update the webhook identified by webhook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param webhook_name: The webhook name.
:type webhook_name: str
:param parameters: The update parameters for webhook.
:type parameters: ~azure.mgmt.automation.models.WebhookUpdateParameters
:keyword api_version: Api Version. Default value is "2015-10-31". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Webhook, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Webhook
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-10-31")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Webhook]
_json = self._serialize.body(parameters, 'WebhookUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
webhook_name=webhook_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Webhook', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks/{webhookName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.WebhookListResult]:
"""Retrieve a list of webhooks.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2015-10-31". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WebhookListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.WebhookListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2015-10-31")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.WebhookListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WebhookListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/webhooks"} # type: ignore
| 0.827654 | 0.078749 |
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._dsc_compilation_job_stream_operations import build_list_by_job_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class DscCompilationJobStreamOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`dsc_compilation_job_stream` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def list_by_job(
self,
resource_group_name: str,
automation_account_name: str,
job_id: str,
**kwargs: Any
) -> _models.JobStreamListResult:
"""Retrieve all the job streams for the compilation Job.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_id: The job id.
:type job_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: JobStreamListResult, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.JobStreamListResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobStreamListResult]
request = build_list_by_job_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_id=job_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_job.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('JobStreamListResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list_by_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_dsc_compilation_job_stream_operations.py
|
_dsc_compilation_job_stream_operations.py
|
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._dsc_compilation_job_stream_operations import build_list_by_job_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class DscCompilationJobStreamOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`dsc_compilation_job_stream` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def list_by_job(
self,
resource_group_name: str,
automation_account_name: str,
job_id: str,
**kwargs: Any
) -> _models.JobStreamListResult:
"""Retrieve all the job streams for the compilation Job.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_id: The job id.
:type job_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: JobStreamListResult, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.JobStreamListResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobStreamListResult]
request = build_list_by_job_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_id=job_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_job.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('JobStreamListResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list_by_job.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/compilationjobs/{jobId}/streams"} # type: ignore
| 0.835013 | 0.080647 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._fields_operations import build_list_by_type_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class FieldsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`fields` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_by_type(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
type_name: str,
**kwargs: Any
) -> AsyncIterable[_models.TypeFieldListResult]:
"""Retrieve a list of fields of a given type identified by module name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The name of module.
:type module_name: str
:param type_name: The name of type.
:type type_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either TypeFieldListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.TypeFieldListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.TypeFieldListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_type_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
type_name=type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_type.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_type_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
type_name=type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("TypeFieldListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_type.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/types/{typeName}/fields"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_fields_operations.py
|
_fields_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._fields_operations import build_list_by_type_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class FieldsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`fields` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_by_type(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
type_name: str,
**kwargs: Any
) -> AsyncIterable[_models.TypeFieldListResult]:
"""Retrieve a list of fields of a given type identified by module name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The name of module.
:type module_name: str
:param type_name: The name of type.
:type type_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either TypeFieldListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.TypeFieldListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.TypeFieldListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_type_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
type_name=type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_type.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_type_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
type_name=type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("TypeFieldListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_type.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/types/{typeName}/fields"} # type: ignore
| 0.804175 | 0.087058 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._private_link_resources_operations import build_automation_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class PrivateLinkResourcesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`private_link_resources` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def automation(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.PrivateLinkResourceListResult]:
"""Gets the private link resources that need to be created for Automation account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateLinkResourceListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.PrivateLinkResourceListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_automation_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=self.automation.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_automation_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
automation.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateLinkResources"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_private_link_resources_operations.py
|
_private_link_resources_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._private_link_resources_operations import build_automation_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class PrivateLinkResourcesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`private_link_resources` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def automation(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.PrivateLinkResourceListResult]:
"""Gets the private link resources that need to be created for Automation account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateLinkResourceListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.PrivateLinkResourceListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.PrivateLinkResourceListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_automation_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=self.automation.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_automation_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateLinkResourceListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
automation.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/privateLinkResources"} # type: ignore
| 0.80905 | 0.08548 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._automation_account_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class AutomationAccountOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`automation_account` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
parameters: _models.AutomationAccountUpdateParameters,
**kwargs: Any
) -> _models.AutomationAccount:
"""Update an automation account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param parameters: Parameters supplied to the update automation account.
:type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AutomationAccount, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.AutomationAccount
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationAccount]
_json = self._serialize.body(parameters, 'AutomationAccountUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('AutomationAccount', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
parameters: _models.AutomationAccountCreateOrUpdateParameters,
**kwargs: Any
) -> _models.AutomationAccount:
"""Create or update automation account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param parameters: Parameters supplied to the create or update automation account.
:type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AutomationAccount, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.AutomationAccount
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationAccount]
_json = self._serialize.body(parameters, 'AutomationAccountCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('AutomationAccount', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('AutomationAccount', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> None:
"""Delete an automation account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> _models.AutomationAccount:
"""Get information about an Automation Account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AutomationAccount, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.AutomationAccount
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationAccount]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('AutomationAccount', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}"} # type: ignore
@distributed_trace
def list_by_resource_group(
self,
resource_group_name: str,
**kwargs: Any
) -> AsyncIterable[_models.AutomationAccountListResult]:
"""Retrieve a list of accounts within a given resource group.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AutomationAccountListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.AutomationAccountListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationAccountListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_resource_group.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("AutomationAccountListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts"} # type: ignore
@distributed_trace
def list(
self,
**kwargs: Any
) -> AsyncIterable[_models.AutomationAccountListResult]:
"""Lists the Automation Accounts within an Azure subscription.
Retrieve a list of accounts within a given subscription.
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AutomationAccountListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.AutomationAccountListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationAccountListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("AutomationAccountListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_automation_account_operations.py
|
_automation_account_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._automation_account_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class AutomationAccountOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`automation_account` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
parameters: _models.AutomationAccountUpdateParameters,
**kwargs: Any
) -> _models.AutomationAccount:
"""Update an automation account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param parameters: Parameters supplied to the update automation account.
:type parameters: ~azure.mgmt.automation.models.AutomationAccountUpdateParameters
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AutomationAccount, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.AutomationAccount
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationAccount]
_json = self._serialize.body(parameters, 'AutomationAccountUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('AutomationAccount', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
parameters: _models.AutomationAccountCreateOrUpdateParameters,
**kwargs: Any
) -> _models.AutomationAccount:
"""Create or update automation account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param parameters: Parameters supplied to the create or update automation account.
:type parameters: ~azure.mgmt.automation.models.AutomationAccountCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AutomationAccount, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.AutomationAccount
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationAccount]
_json = self._serialize.body(parameters, 'AutomationAccountCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('AutomationAccount', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('AutomationAccount', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> None:
"""Delete an automation account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> _models.AutomationAccount:
"""Get information about an Automation Account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AutomationAccount, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.AutomationAccount
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationAccount]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('AutomationAccount', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}"} # type: ignore
@distributed_trace
def list_by_resource_group(
self,
resource_group_name: str,
**kwargs: Any
) -> AsyncIterable[_models.AutomationAccountListResult]:
"""Retrieve a list of accounts within a given resource group.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AutomationAccountListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.AutomationAccountListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationAccountListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_resource_group.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_resource_group_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("AutomationAccountListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts"} # type: ignore
@distributed_trace
def list(
self,
**kwargs: Any
) -> AsyncIterable[_models.AutomationAccountListResult]:
"""Lists the Automation Accounts within an Azure subscription.
Retrieve a list of accounts within a given subscription.
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either AutomationAccountListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.AutomationAccountListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.AutomationAccountListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("AutomationAccountListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Automation/automationAccounts"} # type: ignore
| 0.849394 | 0.098469 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._module_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ModuleOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`module` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
**kwargs: Any
) -> None:
"""Delete the module by name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The module name.
:type module_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
**kwargs: Any
) -> _models.Module:
"""Retrieve the module identified by module name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The module name.
:type module_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Module, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Module
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Module]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Module', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
parameters: _models.ModuleCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Module:
"""Create or Update the module identified by module name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The name of module.
:type module_name: str
:param parameters: The create or update parameters for module.
:type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Module, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Module
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Module]
_json = self._serialize.body(parameters, 'ModuleCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Module', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Module', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
parameters: _models.ModuleUpdateParameters,
**kwargs: Any
) -> _models.Module:
"""Update the module identified by module name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The name of module.
:type module_name: str
:param parameters: The update parameters for module.
:type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Module, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Module
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Module]
_json = self._serialize.body(parameters, 'ModuleUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Module', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.ModuleListResult]:
"""Retrieve a list of modules.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ModuleListResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ModuleListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ModuleListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ModuleListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_module_operations.py
|
_module_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._module_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ModuleOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`module` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
**kwargs: Any
) -> None:
"""Delete the module by name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The module name.
:type module_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
**kwargs: Any
) -> _models.Module:
"""Retrieve the module identified by module name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The module name.
:type module_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Module, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Module
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Module]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Module', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
parameters: _models.ModuleCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Module:
"""Create or Update the module identified by module name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The name of module.
:type module_name: str
:param parameters: The create or update parameters for module.
:type parameters: ~azure.mgmt.automation.models.ModuleCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Module, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Module
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Module]
_json = self._serialize.body(parameters, 'ModuleCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Module', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Module', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
parameters: _models.ModuleUpdateParameters,
**kwargs: Any
) -> _models.Module:
"""Update the module identified by module name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The name of module.
:type module_name: str
:param parameters: The update parameters for module.
:type parameters: ~azure.mgmt.automation.models.ModuleUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Module, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Module
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Module]
_json = self._serialize.body(parameters, 'ModuleUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Module', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.ModuleListResult]:
"""Retrieve a list of modules.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ModuleListResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ModuleListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ModuleListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ModuleListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules"} # type: ignore
| 0.835416 | 0.089733 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._source_control_sync_job_operations import build_create_request, build_get_request, build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SourceControlSyncJobOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`source_control_sync_job` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def create(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
source_control_sync_job_id: str,
parameters: _models.SourceControlSyncJobCreateParameters,
**kwargs: Any
) -> _models.SourceControlSyncJob:
"""Creates the sync job for a source control.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param source_control_sync_job_id: The source control sync job id.
:type source_control_sync_job_id: str
:param parameters: The parameters supplied to the create source control sync job operation.
:type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlSyncJob, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SourceControlSyncJob
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlSyncJob]
_json = self._serialize.body(parameters, 'SourceControlSyncJobCreateParameters')
request = build_create_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
source_control_sync_job_id=source_control_sync_job_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SourceControlSyncJob', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
source_control_sync_job_id: str,
**kwargs: Any
) -> _models.SourceControlSyncJobById:
"""Retrieve the source control sync job identified by job id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param source_control_sync_job_id: The source control sync job id.
:type source_control_sync_job_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlSyncJobById, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SourceControlSyncJobById
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlSyncJobById]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
source_control_sync_job_id=source_control_sync_job_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SourceControlSyncJobById', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.SourceControlSyncJobListResult]:
"""Retrieve a list of source control sync jobs.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either SourceControlSyncJobListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.SourceControlSyncJobListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlSyncJobListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlSyncJobListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_source_control_sync_job_operations.py
|
_source_control_sync_job_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._source_control_sync_job_operations import build_create_request, build_get_request, build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SourceControlSyncJobOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`source_control_sync_job` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def create(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
source_control_sync_job_id: str,
parameters: _models.SourceControlSyncJobCreateParameters,
**kwargs: Any
) -> _models.SourceControlSyncJob:
"""Creates the sync job for a source control.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param source_control_sync_job_id: The source control sync job id.
:type source_control_sync_job_id: str
:param parameters: The parameters supplied to the create source control sync job operation.
:type parameters: ~azure.mgmt.automation.models.SourceControlSyncJobCreateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlSyncJob, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SourceControlSyncJob
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlSyncJob]
_json = self._serialize.body(parameters, 'SourceControlSyncJobCreateParameters')
request = build_create_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
source_control_sync_job_id=source_control_sync_job_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SourceControlSyncJob', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
source_control_sync_job_id: str,
**kwargs: Any
) -> _models.SourceControlSyncJobById:
"""Retrieve the source control sync job identified by job id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param source_control_sync_job_id: The source control sync job id.
:type source_control_sync_job_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SourceControlSyncJobById, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SourceControlSyncJobById
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlSyncJobById]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
source_control_sync_job_id=source_control_sync_job_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SourceControlSyncJobById', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs/{sourceControlSyncJobId}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
source_control_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.SourceControlSyncJobListResult]:
"""Retrieve a list of source control sync jobs.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param source_control_name: The source control name.
:type source_control_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either SourceControlSyncJobListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.SourceControlSyncJobListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SourceControlSyncJobListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
source_control_name=source_control_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("SourceControlSyncJobListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/sourceControls/{sourceControlName}/sourceControlSyncJobs"} # type: ignore
| 0.837454 | 0.084153 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._credential_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class CredentialOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`credential` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
credential_name: str,
**kwargs: Any
) -> None:
"""Delete the credential.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param credential_name: The name of credential.
:type credential_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
credential_name=credential_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
credential_name: str,
**kwargs: Any
) -> _models.Credential:
"""Retrieve the credential identified by credential name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param credential_name: The name of credential.
:type credential_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Credential, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Credential
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Credential]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
credential_name=credential_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Credential', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
credential_name: str,
parameters: _models.CredentialCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Credential:
"""Create a credential.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param credential_name: The parameters supplied to the create or update credential operation.
:type credential_name: str
:param parameters: The parameters supplied to the create or update credential operation.
:type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Credential, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Credential
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Credential]
_json = self._serialize.body(parameters, 'CredentialCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
credential_name=credential_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Credential', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Credential', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
credential_name: str,
parameters: _models.CredentialUpdateParameters,
**kwargs: Any
) -> _models.Credential:
"""Update a credential.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param credential_name: The parameters supplied to the Update credential operation.
:type credential_name: str
:param parameters: The parameters supplied to the Update credential operation.
:type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Credential, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Credential
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Credential]
_json = self._serialize.body(parameters, 'CredentialUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
credential_name=credential_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Credential', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.CredentialListResult]:
"""Retrieve a list of credentials.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either CredentialListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.CredentialListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("CredentialListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_credential_operations.py
|
_credential_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._credential_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class CredentialOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`credential` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
credential_name: str,
**kwargs: Any
) -> None:
"""Delete the credential.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param credential_name: The name of credential.
:type credential_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
credential_name=credential_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
credential_name: str,
**kwargs: Any
) -> _models.Credential:
"""Retrieve the credential identified by credential name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param credential_name: The name of credential.
:type credential_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Credential, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Credential
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Credential]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
credential_name=credential_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Credential', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
credential_name: str,
parameters: _models.CredentialCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Credential:
"""Create a credential.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param credential_name: The parameters supplied to the create or update credential operation.
:type credential_name: str
:param parameters: The parameters supplied to the create or update credential operation.
:type parameters: ~azure.mgmt.automation.models.CredentialCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Credential, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Credential
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Credential]
_json = self._serialize.body(parameters, 'CredentialCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
credential_name=credential_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Credential', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Credential', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
credential_name: str,
parameters: _models.CredentialUpdateParameters,
**kwargs: Any
) -> _models.Credential:
"""Update a credential.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param credential_name: The parameters supplied to the Update credential operation.
:type credential_name: str
:param parameters: The parameters supplied to the Update credential operation.
:type parameters: ~azure.mgmt.automation.models.CredentialUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Credential, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Credential
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Credential]
_json = self._serialize.body(parameters, 'CredentialUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
credential_name=credential_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Credential', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials/{credentialName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.CredentialListResult]:
"""Retrieve a list of credentials.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either CredentialListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.CredentialListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.CredentialListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("CredentialListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/credentials"} # type: ignore
| 0.82478 | 0.085366 |
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._runbook_operations import build_create_or_update_request, build_delete_request, build_get_content_request, build_get_request, build_list_by_automation_account_request, build_publish_request_initial, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class RunbookOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`runbook` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
async def _publish_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_publish_request_initial(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self._publish_initial.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
response_headers['location']=self._deserialize('str', response.headers.get('location'))
if cls:
return cls(pipeline_response, None, response_headers)
_publish_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/publish"} # type: ignore
@distributed_trace_async
async def begin_publish( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Publish runbook draft.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The parameters supplied to the publish runbook operation.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._publish_initial( # type: ignore
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
cls=lambda x,y,z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop('error_map', None)
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method = cast(AsyncPollingMethod, AsyncARMPolling(
lro_delay,
**kwargs
)) # type: AsyncPollingMethod
elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_publish.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/publish"} # type: ignore
@distributed_trace_async
async def get_content(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> IO:
"""Retrieve the content of runbook identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: IO, or the result of cls(response)
:rtype: IO
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[IO]
request = build_get_content_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self.get_content.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('IO', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> _models.Runbook:
"""Retrieve the runbook identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Runbook, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Runbook
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Runbook]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Runbook', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
parameters: _models.RunbookCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Runbook:
"""Create the runbook identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:param parameters: The create or update parameters for runbook. Provide either content link for
a published runbook or draft, not both.
:type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Runbook, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Runbook
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Runbook]
_json = self._serialize.body(parameters, 'RunbookCreateOrUpdateParameters')
request = build_create_or_update_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Runbook', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Runbook', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
parameters: _models.RunbookUpdateParameters,
**kwargs: Any
) -> _models.Runbook:
"""Update the runbook identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:param parameters: The update parameters for runbook.
:type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Runbook, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Runbook
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Runbook]
_json = self._serialize.body(parameters, 'RunbookUpdateParameters')
request = build_update_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Runbook', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> None:
"""Delete the runbook by name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.RunbookListResult]:
"""Retrieve a list of runbooks.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RunbookListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.RunbookListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.RunbookListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("RunbookListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_runbook_operations.py
|
_runbook_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._runbook_operations import build_create_or_update_request, build_delete_request, build_get_content_request, build_get_request, build_list_by_automation_account_request, build_publish_request_initial, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class RunbookOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`runbook` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
async def _publish_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_publish_request_initial(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self._publish_initial.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
response_headers['location']=self._deserialize('str', response.headers.get('location'))
if cls:
return cls(pipeline_response, None, response_headers)
_publish_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/publish"} # type: ignore
@distributed_trace_async
async def begin_publish( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Publish runbook draft.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The parameters supplied to the publish runbook operation.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._publish_initial( # type: ignore
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
cls=lambda x,y,z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop('error_map', None)
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method = cast(AsyncPollingMethod, AsyncARMPolling(
lro_delay,
**kwargs
)) # type: AsyncPollingMethod
elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_publish.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/publish"} # type: ignore
@distributed_trace_async
async def get_content(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> IO:
"""Retrieve the content of runbook identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: IO, or the result of cls(response)
:rtype: IO
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[IO]
request = build_get_content_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self.get_content.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('IO', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}/content"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> _models.Runbook:
"""Retrieve the runbook identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Runbook, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Runbook
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Runbook]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Runbook', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
parameters: _models.RunbookCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Runbook:
"""Create the runbook identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:param parameters: The create or update parameters for runbook. Provide either content link for
a published runbook or draft, not both.
:type parameters: ~azure.mgmt.automation.models.RunbookCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Runbook, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Runbook
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Runbook]
_json = self._serialize.body(parameters, 'RunbookCreateOrUpdateParameters')
request = build_create_or_update_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Runbook', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Runbook', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
parameters: _models.RunbookUpdateParameters,
**kwargs: Any
) -> _models.Runbook:
"""Update the runbook identified by runbook name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:param parameters: The update parameters for runbook.
:type parameters: ~azure.mgmt.automation.models.RunbookUpdateParameters
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Runbook, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Runbook
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Runbook]
_json = self._serialize.body(parameters, 'RunbookUpdateParameters')
request = build_update_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Runbook', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
runbook_name: str,
**kwargs: Any
) -> None:
"""Delete the runbook by name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param runbook_name: The runbook name.
:type runbook_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
runbook_name=runbook_name,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks/{runbookName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.RunbookListResult]:
"""Retrieve a list of runbooks.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2018-06-30". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either RunbookListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.RunbookListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2018-06-30")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.RunbookListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("RunbookListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/runbooks"} # type: ignore
| 0.819929 | 0.087916 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._job_schedule_operations import build_create_request, build_delete_request, build_get_request, build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class JobScheduleOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`job_schedule` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
job_schedule_id: str,
**kwargs: Any
) -> None:
"""Delete the job schedule identified by job schedule name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_schedule_id: The job schedule name.
:type job_schedule_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_schedule_id=job_schedule_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
job_schedule_id: str,
**kwargs: Any
) -> _models.JobSchedule:
"""Retrieve the job schedule identified by job schedule name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_schedule_id: The job schedule name.
:type job_schedule_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: JobSchedule, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.JobSchedule
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobSchedule]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_schedule_id=job_schedule_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('JobSchedule', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}"} # type: ignore
@distributed_trace_async
async def create(
self,
resource_group_name: str,
automation_account_name: str,
job_schedule_id: str,
parameters: _models.JobScheduleCreateParameters,
**kwargs: Any
) -> _models.JobSchedule:
"""Create a job schedule.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_schedule_id: The job schedule name.
:type job_schedule_id: str
:param parameters: The parameters supplied to the create job schedule operation.
:type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: JobSchedule, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.JobSchedule
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobSchedule]
_json = self._serialize.body(parameters, 'JobScheduleCreateParameters')
request = build_create_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_schedule_id=job_schedule_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('JobSchedule', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.JobScheduleListResult]:
"""Retrieve a list of job schedules.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either JobScheduleListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobScheduleListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobScheduleListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("JobScheduleListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_job_schedule_operations.py
|
_job_schedule_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._job_schedule_operations import build_create_request, build_delete_request, build_get_request, build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class JobScheduleOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`job_schedule` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
job_schedule_id: str,
**kwargs: Any
) -> None:
"""Delete the job schedule identified by job schedule name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_schedule_id: The job schedule name.
:type job_schedule_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_schedule_id=job_schedule_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
job_schedule_id: str,
**kwargs: Any
) -> _models.JobSchedule:
"""Retrieve the job schedule identified by job schedule name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_schedule_id: The job schedule name.
:type job_schedule_id: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: JobSchedule, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.JobSchedule
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobSchedule]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_schedule_id=job_schedule_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('JobSchedule', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}"} # type: ignore
@distributed_trace_async
async def create(
self,
resource_group_name: str,
automation_account_name: str,
job_schedule_id: str,
parameters: _models.JobScheduleCreateParameters,
**kwargs: Any
) -> _models.JobSchedule:
"""Create a job schedule.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_schedule_id: The job schedule name.
:type job_schedule_id: str
:param parameters: The parameters supplied to the create job schedule operation.
:type parameters: ~azure.mgmt.automation.models.JobScheduleCreateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: JobSchedule, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.JobSchedule
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobSchedule]
_json = self._serialize.body(parameters, 'JobScheduleCreateParameters')
request = build_create_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_schedule_id=job_schedule_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('JobSchedule', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules/{jobScheduleId}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.JobScheduleListResult]:
"""Retrieve a list of job schedules.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either JobScheduleListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobScheduleListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobScheduleListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("JobScheduleListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobSchedules"} # type: ignore
| 0.829561 | 0.088387 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._statistics_operations import build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class StatisticsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`statistics` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.StatisticsListResult]:
"""Retrieve the statistics for the account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either StatisticsListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.StatisticsListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.StatisticsListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("StatisticsListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/statistics"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_statistics_operations.py
|
_statistics_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._statistics_operations import build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class StatisticsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`statistics` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.StatisticsListResult]:
"""Retrieve the statistics for the account.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either StatisticsListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.StatisticsListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.StatisticsListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("StatisticsListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/statistics"} # type: ignore
| 0.825941 | 0.095814 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._usages_operations import build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class UsagesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`usages` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.UsageListResult]:
"""Retrieve the usage for the account id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either UsageListResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.UsageListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.UsageListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("UsageListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/usages"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_usages_operations.py
|
_usages_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._usages_operations import build_list_by_automation_account_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class UsagesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`usages` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.UsageListResult]:
"""Retrieve the usage for the account id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either UsageListResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.UsageListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.UsageListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("UsageListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/usages"} # type: ignore
| 0.809916 | 0.089813 |
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._agent_registration_information_operations import build_get_request, build_regenerate_key_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class AgentRegistrationInformationOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`agent_registration_information` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> _models.AgentRegistration:
"""Retrieve the automation agent registration information.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AgentRegistration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.AgentRegistration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentRegistration]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('AgentRegistration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation"} # type: ignore
@distributed_trace_async
async def regenerate_key(
self,
resource_group_name: str,
automation_account_name: str,
parameters: _models.AgentRegistrationRegenerateKeyParameter,
**kwargs: Any
) -> _models.AgentRegistration:
"""Regenerate a primary or secondary agent registration key.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param parameters: The name of the agent registration key to be regenerated.
:type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AgentRegistration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.AgentRegistration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentRegistration]
_json = self._serialize.body(parameters, 'AgentRegistrationRegenerateKeyParameter')
request = build_regenerate_key_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.regenerate_key.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('AgentRegistration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
regenerate_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation/regenerateKey"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_agent_registration_information_operations.py
|
_agent_registration_information_operations.py
|
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._agent_registration_information_operations import build_get_request, build_regenerate_key_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class AgentRegistrationInformationOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`agent_registration_information` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> _models.AgentRegistration:
"""Retrieve the automation agent registration information.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AgentRegistration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.AgentRegistration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentRegistration]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('AgentRegistration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation"} # type: ignore
@distributed_trace_async
async def regenerate_key(
self,
resource_group_name: str,
automation_account_name: str,
parameters: _models.AgentRegistrationRegenerateKeyParameter,
**kwargs: Any
) -> _models.AgentRegistration:
"""Regenerate a primary or secondary agent registration key.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param parameters: The name of the agent registration key to be regenerated.
:type parameters: ~azure.mgmt.automation.models.AgentRegistrationRegenerateKeyParameter
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AgentRegistration, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.AgentRegistration
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.AgentRegistration]
_json = self._serialize.body(parameters, 'AgentRegistrationRegenerateKeyParameter')
request = build_regenerate_key_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.regenerate_key.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('AgentRegistration', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
regenerate_key.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/agentRegistrationInformation/regenerateKey"} # type: ignore
| 0.856797 | 0.085786 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._operations import build_list_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class Operations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`operations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self,
**kwargs: Any
) -> AsyncIterable[_models.OperationListResult]:
"""Lists all of the available Automation REST API operations.
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.OperationListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
api_version=api_version,
template_url=self.list.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_request(
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list.metadata = {'url': "/providers/Microsoft.Automation/operations"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_operations.py
|
_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._operations import build_list_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class Operations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`operations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self,
**kwargs: Any
) -> AsyncIterable[_models.OperationListResult]:
"""Lists all of the available Automation REST API operations.
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.OperationListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
api_version=api_version,
template_url=self.list.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_request(
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list.metadata = {'url': "/providers/Microsoft.Automation/operations"} # type: ignore
| 0.81134 | 0.090454 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._certificate_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class CertificateOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`certificate` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
certificate_name: str,
**kwargs: Any
) -> None:
"""Delete the certificate.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param certificate_name: The name of certificate.
:type certificate_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
certificate_name: str,
**kwargs: Any
) -> _models.Certificate:
"""Retrieve the certificate identified by certificate name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param certificate_name: The name of certificate.
:type certificate_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Certificate
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Certificate', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
certificate_name: str,
parameters: _models.CertificateCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Certificate:
"""Create a certificate.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param certificate_name: The parameters supplied to the create or update certificate operation.
:type certificate_name: str
:param parameters: The parameters supplied to the create or update certificate operation.
:type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Certificate
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate]
_json = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Certificate', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Certificate', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
certificate_name: str,
parameters: _models.CertificateUpdateParameters,
**kwargs: Any
) -> _models.Certificate:
"""Update a certificate.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param certificate_name: The parameters supplied to the update certificate operation.
:type certificate_name: str
:param parameters: The parameters supplied to the update certificate operation.
:type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Certificate
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate]
_json = self._serialize.body(parameters, 'CertificateUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Certificate', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.CertificateListResult]:
"""Retrieve a list of certificates.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either CertificateListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.CertificateListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.CertificateListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("CertificateListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_certificate_operations.py
|
_certificate_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._certificate_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class CertificateOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`certificate` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
certificate_name: str,
**kwargs: Any
) -> None:
"""Delete the certificate.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param certificate_name: The name of certificate.
:type certificate_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
certificate_name: str,
**kwargs: Any
) -> _models.Certificate:
"""Retrieve the certificate identified by certificate name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param certificate_name: The name of certificate.
:type certificate_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Certificate
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Certificate', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
certificate_name: str,
parameters: _models.CertificateCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Certificate:
"""Create a certificate.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param certificate_name: The parameters supplied to the create or update certificate operation.
:type certificate_name: str
:param parameters: The parameters supplied to the create or update certificate operation.
:type parameters: ~azure.mgmt.automation.models.CertificateCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Certificate
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate]
_json = self._serialize.body(parameters, 'CertificateCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Certificate', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Certificate', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
certificate_name: str,
parameters: _models.CertificateUpdateParameters,
**kwargs: Any
) -> _models.Certificate:
"""Update a certificate.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param certificate_name: The parameters supplied to the update certificate operation.
:type certificate_name: str
:param parameters: The parameters supplied to the update certificate operation.
:type parameters: ~azure.mgmt.automation.models.CertificateUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Certificate, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Certificate
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Certificate]
_json = self._serialize.body(parameters, 'CertificateUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
certificate_name=certificate_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Certificate', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates/{certificateName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.CertificateListResult]:
"""Retrieve a list of certificates.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either CertificateListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.CertificateListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.CertificateListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("CertificateListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/certificates"} # type: ignore
| 0.845145 | 0.092319 |
from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
from ._private_link_resources_operations import PrivateLinkResourcesOperations
from ._python2_package_operations import Python2PackageOperations
from ._agent_registration_information_operations import AgentRegistrationInformationOperations
from ._dsc_node_operations import DscNodeOperations
from ._node_reports_operations import NodeReportsOperations
from ._dsc_node_configuration_operations import DscNodeConfigurationOperations
from ._dsc_compilation_job_operations import DscCompilationJobOperations
from ._dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations
from ._node_count_information_operations import NodeCountInformationOperations
from ._source_control_operations import SourceControlOperations
from ._source_control_sync_job_operations import SourceControlSyncJobOperations
from ._source_control_sync_job_streams_operations import SourceControlSyncJobStreamsOperations
from ._automation_account_operations import AutomationAccountOperations
from ._statistics_operations import StatisticsOperations
from ._usages_operations import UsagesOperations
from ._keys_operations import KeysOperations
from ._certificate_operations import CertificateOperations
from ._connection_operations import ConnectionOperations
from ._connection_type_operations import ConnectionTypeOperations
from ._credential_operations import CredentialOperations
from ._hybrid_runbook_worker_group_operations import HybridRunbookWorkerGroupOperations
from ._job_schedule_operations import JobScheduleOperations
from ._linked_workspace_operations import LinkedWorkspaceOperations
from ._activity_operations import ActivityOperations
from ._module_operations import ModuleOperations
from ._object_data_types_operations import ObjectDataTypesOperations
from ._fields_operations import FieldsOperations
from ._schedule_operations import ScheduleOperations
from ._variable_operations import VariableOperations
from ._watcher_operations import WatcherOperations
from ._dsc_configuration_operations import DscConfigurationOperations
from ._job_operations import JobOperations
from ._job_stream_operations import JobStreamOperations
from ._operations import Operations
from ._automation_client_operations import AutomationClientOperationsMixin
from ._software_update_configurations_operations import SoftwareUpdateConfigurationsOperations
from ._software_update_configuration_runs_operations import SoftwareUpdateConfigurationRunsOperations
from ._software_update_configuration_machine_runs_operations import SoftwareUpdateConfigurationMachineRunsOperations
from ._runbook_draft_operations import RunbookDraftOperations
from ._runbook_operations import RunbookOperations
from ._test_job_streams_operations import TestJobStreamsOperations
from ._test_job_operations import TestJobOperations
from ._webhook_operations import WebhookOperations
from ._hybrid_runbook_workers_operations import HybridRunbookWorkersOperations
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'PrivateEndpointConnectionsOperations',
'PrivateLinkResourcesOperations',
'Python2PackageOperations',
'AgentRegistrationInformationOperations',
'DscNodeOperations',
'NodeReportsOperations',
'DscNodeConfigurationOperations',
'DscCompilationJobOperations',
'DscCompilationJobStreamOperations',
'NodeCountInformationOperations',
'SourceControlOperations',
'SourceControlSyncJobOperations',
'SourceControlSyncJobStreamsOperations',
'AutomationAccountOperations',
'StatisticsOperations',
'UsagesOperations',
'KeysOperations',
'CertificateOperations',
'ConnectionOperations',
'ConnectionTypeOperations',
'CredentialOperations',
'HybridRunbookWorkerGroupOperations',
'JobScheduleOperations',
'LinkedWorkspaceOperations',
'ActivityOperations',
'ModuleOperations',
'ObjectDataTypesOperations',
'FieldsOperations',
'ScheduleOperations',
'VariableOperations',
'WatcherOperations',
'DscConfigurationOperations',
'JobOperations',
'JobStreamOperations',
'Operations',
'AutomationClientOperationsMixin',
'SoftwareUpdateConfigurationsOperations',
'SoftwareUpdateConfigurationRunsOperations',
'SoftwareUpdateConfigurationMachineRunsOperations',
'RunbookDraftOperations',
'RunbookOperations',
'TestJobStreamsOperations',
'TestJobOperations',
'WebhookOperations',
'HybridRunbookWorkersOperations',
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/__init__.py
|
__init__.py
|
from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations
from ._private_link_resources_operations import PrivateLinkResourcesOperations
from ._python2_package_operations import Python2PackageOperations
from ._agent_registration_information_operations import AgentRegistrationInformationOperations
from ._dsc_node_operations import DscNodeOperations
from ._node_reports_operations import NodeReportsOperations
from ._dsc_node_configuration_operations import DscNodeConfigurationOperations
from ._dsc_compilation_job_operations import DscCompilationJobOperations
from ._dsc_compilation_job_stream_operations import DscCompilationJobStreamOperations
from ._node_count_information_operations import NodeCountInformationOperations
from ._source_control_operations import SourceControlOperations
from ._source_control_sync_job_operations import SourceControlSyncJobOperations
from ._source_control_sync_job_streams_operations import SourceControlSyncJobStreamsOperations
from ._automation_account_operations import AutomationAccountOperations
from ._statistics_operations import StatisticsOperations
from ._usages_operations import UsagesOperations
from ._keys_operations import KeysOperations
from ._certificate_operations import CertificateOperations
from ._connection_operations import ConnectionOperations
from ._connection_type_operations import ConnectionTypeOperations
from ._credential_operations import CredentialOperations
from ._hybrid_runbook_worker_group_operations import HybridRunbookWorkerGroupOperations
from ._job_schedule_operations import JobScheduleOperations
from ._linked_workspace_operations import LinkedWorkspaceOperations
from ._activity_operations import ActivityOperations
from ._module_operations import ModuleOperations
from ._object_data_types_operations import ObjectDataTypesOperations
from ._fields_operations import FieldsOperations
from ._schedule_operations import ScheduleOperations
from ._variable_operations import VariableOperations
from ._watcher_operations import WatcherOperations
from ._dsc_configuration_operations import DscConfigurationOperations
from ._job_operations import JobOperations
from ._job_stream_operations import JobStreamOperations
from ._operations import Operations
from ._automation_client_operations import AutomationClientOperationsMixin
from ._software_update_configurations_operations import SoftwareUpdateConfigurationsOperations
from ._software_update_configuration_runs_operations import SoftwareUpdateConfigurationRunsOperations
from ._software_update_configuration_machine_runs_operations import SoftwareUpdateConfigurationMachineRunsOperations
from ._runbook_draft_operations import RunbookDraftOperations
from ._runbook_operations import RunbookOperations
from ._test_job_streams_operations import TestJobStreamsOperations
from ._test_job_operations import TestJobOperations
from ._webhook_operations import WebhookOperations
from ._hybrid_runbook_workers_operations import HybridRunbookWorkersOperations
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'PrivateEndpointConnectionsOperations',
'PrivateLinkResourcesOperations',
'Python2PackageOperations',
'AgentRegistrationInformationOperations',
'DscNodeOperations',
'NodeReportsOperations',
'DscNodeConfigurationOperations',
'DscCompilationJobOperations',
'DscCompilationJobStreamOperations',
'NodeCountInformationOperations',
'SourceControlOperations',
'SourceControlSyncJobOperations',
'SourceControlSyncJobStreamsOperations',
'AutomationAccountOperations',
'StatisticsOperations',
'UsagesOperations',
'KeysOperations',
'CertificateOperations',
'ConnectionOperations',
'ConnectionTypeOperations',
'CredentialOperations',
'HybridRunbookWorkerGroupOperations',
'JobScheduleOperations',
'LinkedWorkspaceOperations',
'ActivityOperations',
'ModuleOperations',
'ObjectDataTypesOperations',
'FieldsOperations',
'ScheduleOperations',
'VariableOperations',
'WatcherOperations',
'DscConfigurationOperations',
'JobOperations',
'JobStreamOperations',
'Operations',
'AutomationClientOperationsMixin',
'SoftwareUpdateConfigurationsOperations',
'SoftwareUpdateConfigurationRunsOperations',
'SoftwareUpdateConfigurationMachineRunsOperations',
'RunbookDraftOperations',
'RunbookOperations',
'TestJobStreamsOperations',
'TestJobOperations',
'WebhookOperations',
'HybridRunbookWorkersOperations',
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
| 0.45423 | 0.0464 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._activity_operations import build_get_request, build_list_by_module_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ActivityOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`activity` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
activity_name: str,
**kwargs: Any
) -> _models.Activity:
"""Retrieve the activity in the module identified by module name and activity name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The name of module.
:type module_name: str
:param activity_name: The name of activity.
:type activity_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Activity, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Activity
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Activity]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
activity_name=activity_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Activity', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities/{activityName}"} # type: ignore
@distributed_trace
def list_by_module(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
**kwargs: Any
) -> AsyncIterable[_models.ActivityListResult]:
"""Retrieve a list of activities in the module identified by module name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The name of module.
:type module_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ActivityListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ActivityListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ActivityListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_module_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_module.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_module_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ActivityListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_module.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_activity_operations.py
|
_activity_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._activity_operations import build_get_request, build_list_by_module_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ActivityOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`activity` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
activity_name: str,
**kwargs: Any
) -> _models.Activity:
"""Retrieve the activity in the module identified by module name and activity name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The name of module.
:type module_name: str
:param activity_name: The name of activity.
:type activity_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Activity, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Activity
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Activity]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
activity_name=activity_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Activity', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities/{activityName}"} # type: ignore
@distributed_trace
def list_by_module(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
**kwargs: Any
) -> AsyncIterable[_models.ActivityListResult]:
"""Retrieve a list of activities in the module identified by module name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The name of module.
:type module_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ActivityListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ActivityListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ActivityListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_module_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_module.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_module_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ActivityListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_module.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/activities"} # type: ignore
| 0.811974 | 0.086593 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._variable_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class VariableOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`variable` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
variable_name: str,
parameters: _models.VariableCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Variable:
"""Create a variable.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param variable_name: The variable name.
:type variable_name: str
:param parameters: The parameters supplied to the create or update variable operation.
:type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Variable
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Variable]
_json = self._serialize.body(parameters, 'VariableCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
variable_name=variable_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Variable', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Variable', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
variable_name: str,
parameters: _models.VariableUpdateParameters,
**kwargs: Any
) -> _models.Variable:
"""Update a variable.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param variable_name: The variable name.
:type variable_name: str
:param parameters: The parameters supplied to the update variable operation.
:type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Variable
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Variable]
_json = self._serialize.body(parameters, 'VariableUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
variable_name=variable_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Variable', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
variable_name: str,
**kwargs: Any
) -> None:
"""Delete the variable.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param variable_name: The name of variable.
:type variable_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
variable_name=variable_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
variable_name: str,
**kwargs: Any
) -> _models.Variable:
"""Retrieve the variable identified by variable name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param variable_name: The name of variable.
:type variable_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Variable
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Variable]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
variable_name=variable_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Variable', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.VariableListResult]:
"""Retrieve a list of variables.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either VariableListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.VariableListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.VariableListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("VariableListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_variable_operations.py
|
_variable_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._variable_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class VariableOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`variable` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
variable_name: str,
parameters: _models.VariableCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Variable:
"""Create a variable.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param variable_name: The variable name.
:type variable_name: str
:param parameters: The parameters supplied to the create or update variable operation.
:type parameters: ~azure.mgmt.automation.models.VariableCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Variable
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Variable]
_json = self._serialize.body(parameters, 'VariableCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
variable_name=variable_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Variable', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Variable', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
variable_name: str,
parameters: _models.VariableUpdateParameters,
**kwargs: Any
) -> _models.Variable:
"""Update a variable.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param variable_name: The variable name.
:type variable_name: str
:param parameters: The parameters supplied to the update variable operation.
:type parameters: ~azure.mgmt.automation.models.VariableUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Variable
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Variable]
_json = self._serialize.body(parameters, 'VariableUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
variable_name=variable_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Variable', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}"} # type: ignore
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
variable_name: str,
**kwargs: Any
) -> None:
"""Delete the variable.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param variable_name: The name of variable.
:type variable_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
variable_name=variable_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
variable_name: str,
**kwargs: Any
) -> _models.Variable:
"""Retrieve the variable identified by variable name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param variable_name: The name of variable.
:type variable_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Variable, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Variable
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Variable]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
variable_name=variable_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Variable', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables/{variableName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.VariableListResult]:
"""Retrieve a list of variables.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either VariableListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.VariableListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.VariableListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("VariableListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/variables"} # type: ignore
| 0.855202 | 0.098773 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._connection_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ConnectionOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`connection` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
connection_name: str,
**kwargs: Any
) -> None:
"""Delete the connection.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_name: The name of connection.
:type connection_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_name=connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
connection_name: str,
**kwargs: Any
) -> _models.Connection:
"""Retrieve the connection identified by connection name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_name: The name of connection.
:type connection_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Connection, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Connection
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Connection]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_name=connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Connection', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
connection_name: str,
parameters: _models.ConnectionCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Connection:
"""Create or update a connection.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_name: The parameters supplied to the create or update connection operation.
:type connection_name: str
:param parameters: The parameters supplied to the create or update connection operation.
:type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Connection, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Connection
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Connection]
_json = self._serialize.body(parameters, 'ConnectionCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_name=connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Connection', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Connection', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
connection_name: str,
parameters: _models.ConnectionUpdateParameters,
**kwargs: Any
) -> _models.Connection:
"""Update a connection.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_name: The parameters supplied to the update a connection operation.
:type connection_name: str
:param parameters: The parameters supplied to the update a connection operation.
:type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Connection, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Connection
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Connection]
_json = self._serialize.body(parameters, 'ConnectionUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_name=connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Connection', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.ConnectionListResult]:
"""Retrieve a list of connections.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConnectionListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ConnectionListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ConnectionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_connection_operations.py
|
_connection_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._connection_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_automation_account_request, build_update_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ConnectionOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`connection` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
connection_name: str,
**kwargs: Any
) -> None:
"""Delete the connection.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_name: The name of connection.
:type connection_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_delete_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_name=connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
connection_name: str,
**kwargs: Any
) -> _models.Connection:
"""Retrieve the connection identified by connection name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_name: The name of connection.
:type connection_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Connection, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Connection
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Connection]
request = build_get_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_name=connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Connection', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}"} # type: ignore
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
automation_account_name: str,
connection_name: str,
parameters: _models.ConnectionCreateOrUpdateParameters,
**kwargs: Any
) -> _models.Connection:
"""Create or update a connection.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_name: The parameters supplied to the create or update connection operation.
:type connection_name: str
:param parameters: The parameters supplied to the create or update connection operation.
:type parameters: ~azure.mgmt.automation.models.ConnectionCreateOrUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Connection, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Connection
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Connection]
_json = self._serialize.body(parameters, 'ConnectionCreateOrUpdateParameters')
request = build_create_or_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_name=connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.create_or_update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize('Connection', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('Connection', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}"} # type: ignore
@distributed_trace_async
async def update(
self,
resource_group_name: str,
automation_account_name: str,
connection_name: str,
parameters: _models.ConnectionUpdateParameters,
**kwargs: Any
) -> _models.Connection:
"""Update a connection.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param connection_name: The parameters supplied to the update a connection operation.
:type connection_name: str
:param parameters: The parameters supplied to the update a connection operation.
:type parameters: ~azure.mgmt.automation.models.ConnectionUpdateParameters
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Connection, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Connection
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Connection]
_json = self._serialize.body(parameters, 'ConnectionUpdateParameters')
request = build_update_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
connection_name=connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.update.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Connection', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections/{connectionName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
**kwargs: Any
) -> AsyncIterable[_models.ConnectionListResult]:
"""Retrieve a list of connections.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ConnectionListResult or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.ConnectionListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.ConnectionListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ConnectionListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/connections"} # type: ignore
| 0.846641 | 0.087136 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._job_operations import build_create_request, build_get_output_request, build_get_request, build_get_runbook_content_request, build_list_by_automation_account_request, build_resume_request, build_stop_request, build_suspend_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class JobOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`job` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get_output(
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> str:
"""Retrieve the job output identified by job name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The name of the job to be created.
:type job_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: str, or the result of cls(response)
:rtype: str
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[str]
request = build_get_output_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get_output.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('str', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_output.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/output"} # type: ignore
@distributed_trace_async
async def get_runbook_content(
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> str:
"""Retrieve the runbook content of the job identified by job name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: str, or the result of cls(response)
:rtype: str
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[str]
request = build_get_runbook_content_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get_runbook_content.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('str', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_runbook_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/runbookContent"} # type: ignore
@distributed_trace_async
async def suspend( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""Suspend the job identified by job name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_suspend_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.suspend.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
suspend.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/suspend"} # type: ignore
@distributed_trace_async
async def stop( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""Stop the job identified by jobName.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_stop_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.stop.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/stop"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.Job:
"""Retrieve the job identified by job name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Job, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Job
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Job]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Job', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}"} # type: ignore
@distributed_trace_async
async def create(
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
parameters: _models.JobCreateParameters,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.Job:
"""Create a job of the runbook.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param parameters: The parameters supplied to the create job operation.
:type parameters: ~azure.mgmt.automation.models.JobCreateParameters
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Job, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Job
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Job]
_json = self._serialize.body(parameters, 'JobCreateParameters')
request = build_create_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
api_version=api_version,
content_type=content_type,
json=_json,
client_request_id=client_request_id,
template_url=self.create.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Job', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.JobListResultV2]:
"""Retrieve a list of jobs.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either JobListResultV2 or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobListResultV2]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobListResultV2]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
client_request_id=client_request_id,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
client_request_id=client_request_id,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("JobListResultV2", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs"} # type: ignore
@distributed_trace_async
async def resume( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""Resume the job identified by jobName.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_resume_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.resume.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
resume.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/resume"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_job_operations.py
|
_job_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._job_operations import build_create_request, build_get_output_request, build_get_request, build_get_runbook_content_request, build_list_by_automation_account_request, build_resume_request, build_stop_request, build_suspend_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class JobOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`job` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get_output(
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> str:
"""Retrieve the job output identified by job name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The name of the job to be created.
:type job_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: str, or the result of cls(response)
:rtype: str
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[str]
request = build_get_output_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get_output.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('str', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_output.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/output"} # type: ignore
@distributed_trace_async
async def get_runbook_content(
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> str:
"""Retrieve the runbook content of the job identified by job name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: str, or the result of cls(response)
:rtype: str
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[str]
request = build_get_runbook_content_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get_runbook_content.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('str', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_runbook_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/runbookContent"} # type: ignore
@distributed_trace_async
async def suspend( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""Suspend the job identified by job name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_suspend_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.suspend.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
suspend.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/suspend"} # type: ignore
@distributed_trace_async
async def stop( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""Stop the job identified by jobName.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_stop_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.stop.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
stop.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/stop"} # type: ignore
@distributed_trace_async
async def get(
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.Job:
"""Retrieve the job identified by job name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Job, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Job
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.Job]
request = build_get_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Job', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}"} # type: ignore
@distributed_trace_async
async def create(
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
parameters: _models.JobCreateParameters,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.Job:
"""Create a job of the runbook.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param parameters: The parameters supplied to the create job operation.
:type parameters: ~azure.mgmt.automation.models.JobCreateParameters
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Job, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.Job
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.Job]
_json = self._serialize.body(parameters, 'JobCreateParameters')
request = build_create_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
api_version=api_version,
content_type=content_type,
json=_json,
client_request_id=client_request_id,
template_url=self.create.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('Job', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
create.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}"} # type: ignore
@distributed_trace
def list_by_automation_account(
self,
resource_group_name: str,
automation_account_name: str,
filter: Optional[str] = None,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> AsyncIterable[_models.JobListResultV2]:
"""Retrieve a list of jobs.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param filter: The filter to apply on the operation. Default value is None.
:type filter: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either JobListResultV2 or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.JobListResultV2]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.JobListResultV2]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
client_request_id=client_request_id,
template_url=self.list_by_automation_account.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_by_automation_account_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
filter=filter,
client_request_id=client_request_id,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("JobListResultV2", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_automation_account.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs"} # type: ignore
@distributed_trace_async
async def resume( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
automation_account_name: str,
job_name: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""Resume the job identified by jobName.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param job_name: The job name.
:type job_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[None]
request = build_resume_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
job_name=job_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.resume.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
resume.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/jobs/{jobName}/resume"} # type: ignore
| 0.848486 | 0.080864 |
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._software_update_configuration_runs_operations import build_get_by_id_request, build_list_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SoftwareUpdateConfigurationRunsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`software_update_configuration_runs` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get_by_id(
self,
resource_group_name: str,
automation_account_name: str,
software_update_configuration_run_id: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfigurationRun:
"""Get a single software update configuration Run by Id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param software_update_configuration_run_id: The Id of the software update configuration run.
:type software_update_configuration_run_id: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfigurationRun, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfigurationRun]
request = build_get_by_id_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
software_update_configuration_run_id=software_update_configuration_run_id,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get_by_id.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SoftwareUpdateConfigurationRun', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_by_id.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns/{softwareUpdateConfigurationRunId}"} # type: ignore
@distributed_trace_async
async def list(
self,
resource_group_name: str,
automation_account_name: str,
client_request_id: Optional[str] = None,
filter: Optional[str] = None,
skip: Optional[str] = None,
top: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfigurationRunListResult:
"""Return list of software update configuration runs.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:param filter: The filter to apply on the operation. You can use the following filters:
'properties/osType', 'properties/status', 'properties/startTime', and
'properties/softwareUpdateConfiguration/name'. Default value is None.
:type filter: str
:param skip: Number of entries you skip before returning results. Default value is None.
:type skip: str
:param top: Maximum number of entries returned in the results collection. Default value is
None.
:type top: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfigurationRunListResult, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunListResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfigurationRunListResult]
request = build_list_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
client_request_id=client_request_id,
filter=filter,
skip=skip,
top=top,
template_url=self.list.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SoftwareUpdateConfigurationRunListResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_software_update_configuration_runs_operations.py
|
_software_update_configuration_runs_operations.py
|
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._software_update_configuration_runs_operations import build_get_by_id_request, build_list_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class SoftwareUpdateConfigurationRunsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`software_update_configuration_runs` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get_by_id(
self,
resource_group_name: str,
automation_account_name: str,
software_update_configuration_run_id: str,
client_request_id: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfigurationRun:
"""Get a single software update configuration Run by Id.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param software_update_configuration_run_id: The Id of the software update configuration run.
:type software_update_configuration_run_id: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfigurationRun, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfigurationRun]
request = build_get_by_id_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
software_update_configuration_run_id=software_update_configuration_run_id,
api_version=api_version,
client_request_id=client_request_id,
template_url=self.get_by_id.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SoftwareUpdateConfigurationRun', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_by_id.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns/{softwareUpdateConfigurationRunId}"} # type: ignore
@distributed_trace_async
async def list(
self,
resource_group_name: str,
automation_account_name: str,
client_request_id: Optional[str] = None,
filter: Optional[str] = None,
skip: Optional[str] = None,
top: Optional[str] = None,
**kwargs: Any
) -> _models.SoftwareUpdateConfigurationRunListResult:
"""Return list of software update configuration runs.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param client_request_id: Identifies this specific client request. Default value is None.
:type client_request_id: str
:param filter: The filter to apply on the operation. You can use the following filters:
'properties/osType', 'properties/status', 'properties/startTime', and
'properties/softwareUpdateConfiguration/name'. Default value is None.
:type filter: str
:param skip: Number of entries you skip before returning results. Default value is None.
:type skip: str
:param top: Maximum number of entries returned in the results collection. Default value is
None.
:type top: str
:keyword api_version: Api Version. Default value is "2019-06-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: SoftwareUpdateConfigurationRunListResult, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunListResult
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2019-06-01")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.SoftwareUpdateConfigurationRunListResult]
request = build_list_request(
subscription_id=self._config.subscription_id,
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
api_version=api_version,
client_request_id=client_request_id,
filter=filter,
skip=skip,
top=top,
template_url=self.list.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('SoftwareUpdateConfigurationRunListResult', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/softwareUpdateConfigurationRuns"} # type: ignore
| 0.856558 | 0.086208 |
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._automation_client_operations import build_convert_graph_runbook_content_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class AutomationClientOperationsMixin(MixinABC):
@distributed_trace_async
async def convert_graph_runbook_content(
self,
resource_group_name: str,
automation_account_name: str,
parameters: _models.GraphicalRunbookContent,
**kwargs: Any
) -> _models.GraphicalRunbookContent:
"""Post operation to serialize or deserialize GraphRunbookContent.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param parameters: Input data describing the graphical runbook.
:type parameters: ~azure.mgmt.automation.models.GraphicalRunbookContent
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: GraphicalRunbookContent, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.GraphicalRunbookContent
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.GraphicalRunbookContent]
_json = self._serialize.body(parameters, 'GraphicalRunbookContent')
request = build_convert_graph_runbook_content_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.convert_graph_runbook_content.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('GraphicalRunbookContent', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
convert_graph_runbook_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/convertGraphRunbookContent"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_automation_client_operations.py
|
_automation_client_operations.py
|
from typing import Any, Callable, Dict, Optional, TypeVar
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._automation_client_operations import build_convert_graph_runbook_content_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class AutomationClientOperationsMixin(MixinABC):
@distributed_trace_async
async def convert_graph_runbook_content(
self,
resource_group_name: str,
automation_account_name: str,
parameters: _models.GraphicalRunbookContent,
**kwargs: Any
) -> _models.GraphicalRunbookContent:
"""Post operation to serialize or deserialize GraphRunbookContent.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param parameters: Input data describing the graphical runbook.
:type parameters: ~azure.mgmt.automation.models.GraphicalRunbookContent
:keyword api_version: Api Version. Default value is "2021-06-22". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: GraphicalRunbookContent, or the result of cls(response)
:rtype: ~azure.mgmt.automation.models.GraphicalRunbookContent
:raises: ~azure.core.exceptions.HttpResponseError
"""
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-22")) # type: str
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str]
cls = kwargs.pop('cls', None) # type: ClsType[_models.GraphicalRunbookContent]
_json = self._serialize.body(parameters, 'GraphicalRunbookContent')
request = build_convert_graph_runbook_content_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
template_url=self.convert_graph_runbook_content.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize('GraphicalRunbookContent', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
convert_graph_runbook_content.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/convertGraphRunbookContent"} # type: ignore
| 0.891705 | 0.110639 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._object_data_types_operations import build_list_fields_by_module_and_type_request, build_list_fields_by_type_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ObjectDataTypesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`object_data_types` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_fields_by_module_and_type(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
type_name: str,
**kwargs: Any
) -> AsyncIterable[_models.TypeFieldListResult]:
"""Retrieve a list of fields of a given type identified by module name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The name of module.
:type module_name: str
:param type_name: The name of type.
:type type_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either TypeFieldListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.TypeFieldListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.TypeFieldListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_fields_by_module_and_type_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
type_name=type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_fields_by_module_and_type.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_fields_by_module_and_type_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
type_name=type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("TypeFieldListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_fields_by_module_and_type.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/objectDataTypes/{typeName}/fields"} # type: ignore
@distributed_trace
def list_fields_by_type(
self,
resource_group_name: str,
automation_account_name: str,
type_name: str,
**kwargs: Any
) -> AsyncIterable[_models.TypeFieldListResult]:
"""Retrieve a list of fields of a given type across all accessible modules.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param type_name: The name of type.
:type type_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either TypeFieldListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.TypeFieldListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.TypeFieldListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_fields_by_type_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
type_name=type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_fields_by_type.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_fields_by_type_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
type_name=type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("TypeFieldListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_fields_by_type.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/objectDataTypes/{typeName}/fields"} # type: ignore
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/aio/operations/_object_data_types_operations.py
|
_object_data_types_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._object_data_types_operations import build_list_fields_by_module_and_type_request, build_list_fields_by_type_request
from .._vendor import MixinABC
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ObjectDataTypesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.automation.aio.AutomationClient`'s
:attr:`object_data_types` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list_fields_by_module_and_type(
self,
resource_group_name: str,
automation_account_name: str,
module_name: str,
type_name: str,
**kwargs: Any
) -> AsyncIterable[_models.TypeFieldListResult]:
"""Retrieve a list of fields of a given type identified by module name.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param module_name: The name of module.
:type module_name: str
:param type_name: The name of type.
:type type_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either TypeFieldListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.TypeFieldListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.TypeFieldListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_fields_by_module_and_type_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
type_name=type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_fields_by_module_and_type.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_fields_by_module_and_type_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
module_name=module_name,
type_name=type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("TypeFieldListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_fields_by_module_and_type.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/modules/{moduleName}/objectDataTypes/{typeName}/fields"} # type: ignore
@distributed_trace
def list_fields_by_type(
self,
resource_group_name: str,
automation_account_name: str,
type_name: str,
**kwargs: Any
) -> AsyncIterable[_models.TypeFieldListResult]:
"""Retrieve a list of fields of a given type across all accessible modules.
:param resource_group_name: Name of an Azure Resource group.
:type resource_group_name: str
:param automation_account_name: The name of the automation account.
:type automation_account_name: str
:param type_name: The name of type.
:type type_name: str
:keyword api_version: Api Version. Default value is "2020-01-13-preview". Note that overriding
this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either TypeFieldListResult or the result of cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.automation.models.TypeFieldListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version = kwargs.pop('api_version', _params.pop('api-version', "2020-01-13-preview")) # type: str
cls = kwargs.pop('cls', None) # type: ClsType[_models.TypeFieldListResult]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_fields_by_type_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
type_name=type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_fields_by_type.metadata['url'],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
else:
request = build_list_fields_by_type_request(
resource_group_name=resource_group_name,
automation_account_name=automation_account_name,
type_name=type_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=next_link,
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url) # type: ignore
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("TypeFieldListResult", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access
request,
stream=False,
**kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_fields_by_type.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Automation/automationAccounts/{automationAccountName}/objectDataTypes/{typeName}/fields"} # type: ignore
| 0.83901 | 0.092196 |
import datetime
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
from azure.core.exceptions import HttpResponseError
import msrest.serialization
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
import __init__ as _models
class Activity(msrest.serialization.Model):
"""Definition of the activity.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Gets or sets the id of the resource.
:vartype id: str
:ivar name: Gets the name of the activity.
:vartype name: str
:ivar definition: Gets or sets the user name of the activity.
:vartype definition: str
:ivar parameter_sets: Gets or sets the parameter sets of the activity.
:vartype parameter_sets: list[~azure.mgmt.automation.models.ActivityParameterSet]
:ivar output_types: Gets or sets the output types of the activity.
:vartype output_types: list[~azure.mgmt.automation.models.ActivityOutputType]
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'name': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'definition': {'key': 'properties.definition', 'type': 'str'},
'parameter_sets': {'key': 'properties.parameterSets', 'type': '[ActivityParameterSet]'},
'output_types': {'key': 'properties.outputTypes', 'type': '[ActivityOutputType]'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
id: Optional[str] = None,
definition: Optional[str] = None,
parameter_sets: Optional[List["_models.ActivityParameterSet"]] = None,
output_types: Optional[List["_models.ActivityOutputType"]] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword id: Gets or sets the id of the resource.
:paramtype id: str
:keyword definition: Gets or sets the user name of the activity.
:paramtype definition: str
:keyword parameter_sets: Gets or sets the parameter sets of the activity.
:paramtype parameter_sets: list[~azure.mgmt.automation.models.ActivityParameterSet]
:keyword output_types: Gets or sets the output types of the activity.
:paramtype output_types: list[~azure.mgmt.automation.models.ActivityOutputType]
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Activity, self).__init__(**kwargs)
self.id = id
self.name = None
self.definition = definition
self.parameter_sets = parameter_sets
self.output_types = output_types
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.description = description
class ActivityListResult(msrest.serialization.Model):
"""The response model for the list activity operation.
:ivar value: Gets or sets a list of activities.
:vartype value: list[~azure.mgmt.automation.models.Activity]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Activity]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Activity"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of activities.
:paramtype value: list[~azure.mgmt.automation.models.Activity]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(ActivityListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class ActivityOutputType(msrest.serialization.Model):
"""Definition of the activity output type.
:ivar name: Gets or sets the name of the activity output type.
:vartype name: str
:ivar type: Gets or sets the type of the activity output type.
:vartype type: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
type: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the activity output type.
:paramtype name: str
:keyword type: Gets or sets the type of the activity output type.
:paramtype type: str
"""
super(ActivityOutputType, self).__init__(**kwargs)
self.name = name
self.type = type
class ActivityParameter(msrest.serialization.Model):
"""Definition of the activity parameter.
:ivar name: Gets or sets the name of the activity parameter.
:vartype name: str
:ivar type: Gets or sets the type of the activity parameter.
:vartype type: str
:ivar is_mandatory: Gets or sets a Boolean value that indicates true if the parameter is
required. If the value is false, the parameter is optional.
:vartype is_mandatory: bool
:ivar is_dynamic: Gets or sets a Boolean value that indicates true if the parameter is dynamic.
:vartype is_dynamic: bool
:ivar position: Gets or sets the position of the activity parameter.
:vartype position: long
:ivar value_from_pipeline: Gets or sets a Boolean value that indicates true if the parameter
can take values from the incoming pipeline objects. This setting is used if the cmdlet must
access the complete input object. false indicates that the parameter cannot take values from
the complete input object.
:vartype value_from_pipeline: bool
:ivar value_from_pipeline_by_property_name: Gets or sets a Boolean value that indicates true if
the parameter can be filled from a property of the incoming pipeline object that has the same
name as this parameter. false indicates that the parameter cannot be filled from the incoming
pipeline object property with the same name.
:vartype value_from_pipeline_by_property_name: bool
:ivar value_from_remaining_arguments: Gets or sets a Boolean value that indicates true if the
cmdlet parameter accepts all the remaining command-line arguments that are associated with this
parameter in the form of an array. false if the cmdlet parameter does not accept all the
remaining argument values.
:vartype value_from_remaining_arguments: bool
:ivar description: Gets or sets the description of the activity parameter.
:vartype description: str
:ivar validation_set: Gets or sets the validation set of activity parameter.
:vartype validation_set: list[~azure.mgmt.automation.models.ActivityParameterValidationSet]
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'is_mandatory': {'key': 'isMandatory', 'type': 'bool'},
'is_dynamic': {'key': 'isDynamic', 'type': 'bool'},
'position': {'key': 'position', 'type': 'long'},
'value_from_pipeline': {'key': 'valueFromPipeline', 'type': 'bool'},
'value_from_pipeline_by_property_name': {'key': 'valueFromPipelineByPropertyName', 'type': 'bool'},
'value_from_remaining_arguments': {'key': 'valueFromRemainingArguments', 'type': 'bool'},
'description': {'key': 'description', 'type': 'str'},
'validation_set': {'key': 'validationSet', 'type': '[ActivityParameterValidationSet]'},
}
def __init__(
self,
*,
name: Optional[str] = None,
type: Optional[str] = None,
is_mandatory: Optional[bool] = None,
is_dynamic: Optional[bool] = None,
position: Optional[int] = None,
value_from_pipeline: Optional[bool] = None,
value_from_pipeline_by_property_name: Optional[bool] = None,
value_from_remaining_arguments: Optional[bool] = None,
description: Optional[str] = None,
validation_set: Optional[List["_models.ActivityParameterValidationSet"]] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the activity parameter.
:paramtype name: str
:keyword type: Gets or sets the type of the activity parameter.
:paramtype type: str
:keyword is_mandatory: Gets or sets a Boolean value that indicates true if the parameter is
required. If the value is false, the parameter is optional.
:paramtype is_mandatory: bool
:keyword is_dynamic: Gets or sets a Boolean value that indicates true if the parameter is
dynamic.
:paramtype is_dynamic: bool
:keyword position: Gets or sets the position of the activity parameter.
:paramtype position: long
:keyword value_from_pipeline: Gets or sets a Boolean value that indicates true if the parameter
can take values from the incoming pipeline objects. This setting is used if the cmdlet must
access the complete input object. false indicates that the parameter cannot take values from
the complete input object.
:paramtype value_from_pipeline: bool
:keyword value_from_pipeline_by_property_name: Gets or sets a Boolean value that indicates true
if the parameter can be filled from a property of the incoming pipeline object that has the
same name as this parameter. false indicates that the parameter cannot be filled from the
incoming pipeline object property with the same name.
:paramtype value_from_pipeline_by_property_name: bool
:keyword value_from_remaining_arguments: Gets or sets a Boolean value that indicates true if
the cmdlet parameter accepts all the remaining command-line arguments that are associated with
this parameter in the form of an array. false if the cmdlet parameter does not accept all the
remaining argument values.
:paramtype value_from_remaining_arguments: bool
:keyword description: Gets or sets the description of the activity parameter.
:paramtype description: str
:keyword validation_set: Gets or sets the validation set of activity parameter.
:paramtype validation_set: list[~azure.mgmt.automation.models.ActivityParameterValidationSet]
"""
super(ActivityParameter, self).__init__(**kwargs)
self.name = name
self.type = type
self.is_mandatory = is_mandatory
self.is_dynamic = is_dynamic
self.position = position
self.value_from_pipeline = value_from_pipeline
self.value_from_pipeline_by_property_name = value_from_pipeline_by_property_name
self.value_from_remaining_arguments = value_from_remaining_arguments
self.description = description
self.validation_set = validation_set
class ActivityParameterSet(msrest.serialization.Model):
"""Definition of the activity parameter set.
:ivar name: Gets or sets the name of the activity parameter set.
:vartype name: str
:ivar parameters: Gets or sets the parameters of the activity parameter set.
:vartype parameters: list[~azure.mgmt.automation.models.ActivityParameter]
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'parameters': {'key': 'parameters', 'type': '[ActivityParameter]'},
}
def __init__(
self,
*,
name: Optional[str] = None,
parameters: Optional[List["_models.ActivityParameter"]] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the activity parameter set.
:paramtype name: str
:keyword parameters: Gets or sets the parameters of the activity parameter set.
:paramtype parameters: list[~azure.mgmt.automation.models.ActivityParameter]
"""
super(ActivityParameterSet, self).__init__(**kwargs)
self.name = name
self.parameters = parameters
class ActivityParameterValidationSet(msrest.serialization.Model):
"""Definition of the activity parameter validation set.
:ivar member_value: Gets or sets the name of the activity parameter validation set member.
:vartype member_value: str
"""
_attribute_map = {
'member_value': {'key': 'memberValue', 'type': 'str'},
}
def __init__(
self,
*,
member_value: Optional[str] = None,
**kwargs
):
"""
:keyword member_value: Gets or sets the name of the activity parameter validation set member.
:paramtype member_value: str
"""
super(ActivityParameterValidationSet, self).__init__(**kwargs)
self.member_value = member_value
class AdvancedSchedule(msrest.serialization.Model):
"""The properties of the create Advanced Schedule.
:ivar week_days: Days of the week that the job should execute on.
:vartype week_days: list[str]
:ivar month_days: Days of the month that the job should execute on. Must be between 1 and 31.
:vartype month_days: list[int]
:ivar monthly_occurrences: Occurrences of days within a month.
:vartype monthly_occurrences:
list[~azure.mgmt.automation.models.AdvancedScheduleMonthlyOccurrence]
"""
_attribute_map = {
'week_days': {'key': 'weekDays', 'type': '[str]'},
'month_days': {'key': 'monthDays', 'type': '[int]'},
'monthly_occurrences': {'key': 'monthlyOccurrences', 'type': '[AdvancedScheduleMonthlyOccurrence]'},
}
def __init__(
self,
*,
week_days: Optional[List[str]] = None,
month_days: Optional[List[int]] = None,
monthly_occurrences: Optional[List["_models.AdvancedScheduleMonthlyOccurrence"]] = None,
**kwargs
):
"""
:keyword week_days: Days of the week that the job should execute on.
:paramtype week_days: list[str]
:keyword month_days: Days of the month that the job should execute on. Must be between 1 and
31.
:paramtype month_days: list[int]
:keyword monthly_occurrences: Occurrences of days within a month.
:paramtype monthly_occurrences:
list[~azure.mgmt.automation.models.AdvancedScheduleMonthlyOccurrence]
"""
super(AdvancedSchedule, self).__init__(**kwargs)
self.week_days = week_days
self.month_days = month_days
self.monthly_occurrences = monthly_occurrences
class AdvancedScheduleMonthlyOccurrence(msrest.serialization.Model):
"""The properties of the create advanced schedule monthly occurrence.
:ivar occurrence: Occurrence of the week within the month. Must be between 1 and 5.
:vartype occurrence: int
:ivar day: Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday,
saturday, sunday. Known values are: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday", "Sunday".
:vartype day: str or ~azure.mgmt.automation.models.ScheduleDay
"""
_attribute_map = {
'occurrence': {'key': 'occurrence', 'type': 'int'},
'day': {'key': 'day', 'type': 'str'},
}
def __init__(
self,
*,
occurrence: Optional[int] = None,
day: Optional[Union[str, "_models.ScheduleDay"]] = None,
**kwargs
):
"""
:keyword occurrence: Occurrence of the week within the month. Must be between 1 and 5.
:paramtype occurrence: int
:keyword day: Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday,
friday, saturday, sunday. Known values are: "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday", "Sunday".
:paramtype day: str or ~azure.mgmt.automation.models.ScheduleDay
"""
super(AdvancedScheduleMonthlyOccurrence, self).__init__(**kwargs)
self.occurrence = occurrence
self.day = day
class AgentRegistration(msrest.serialization.Model):
"""Definition of the agent registration information type.
:ivar dsc_meta_configuration: Gets or sets the dsc meta configuration.
:vartype dsc_meta_configuration: str
:ivar endpoint: Gets or sets the dsc server endpoint.
:vartype endpoint: str
:ivar keys: Gets or sets the agent registration keys.
:vartype keys: ~azure.mgmt.automation.models.AgentRegistrationKeys
:ivar id: Gets or sets the id.
:vartype id: str
"""
_attribute_map = {
'dsc_meta_configuration': {'key': 'dscMetaConfiguration', 'type': 'str'},
'endpoint': {'key': 'endpoint', 'type': 'str'},
'keys': {'key': 'keys', 'type': 'AgentRegistrationKeys'},
'id': {'key': 'id', 'type': 'str'},
}
def __init__(
self,
*,
dsc_meta_configuration: Optional[str] = None,
endpoint: Optional[str] = None,
keys: Optional["_models.AgentRegistrationKeys"] = None,
id: Optional[str] = None,
**kwargs
):
"""
:keyword dsc_meta_configuration: Gets or sets the dsc meta configuration.
:paramtype dsc_meta_configuration: str
:keyword endpoint: Gets or sets the dsc server endpoint.
:paramtype endpoint: str
:keyword keys: Gets or sets the agent registration keys.
:paramtype keys: ~azure.mgmt.automation.models.AgentRegistrationKeys
:keyword id: Gets or sets the id.
:paramtype id: str
"""
super(AgentRegistration, self).__init__(**kwargs)
self.dsc_meta_configuration = dsc_meta_configuration
self.endpoint = endpoint
self.keys = keys
self.id = id
class AgentRegistrationKeys(msrest.serialization.Model):
"""Definition of the agent registration keys.
:ivar primary: Gets or sets the primary key.
:vartype primary: str
:ivar secondary: Gets or sets the secondary key.
:vartype secondary: str
"""
_attribute_map = {
'primary': {'key': 'primary', 'type': 'str'},
'secondary': {'key': 'secondary', 'type': 'str'},
}
def __init__(
self,
*,
primary: Optional[str] = None,
secondary: Optional[str] = None,
**kwargs
):
"""
:keyword primary: Gets or sets the primary key.
:paramtype primary: str
:keyword secondary: Gets or sets the secondary key.
:paramtype secondary: str
"""
super(AgentRegistrationKeys, self).__init__(**kwargs)
self.primary = primary
self.secondary = secondary
class AgentRegistrationRegenerateKeyParameter(msrest.serialization.Model):
"""The parameters supplied to the regenerate keys operation.
All required parameters must be populated in order to send to Azure.
:ivar key_name: Required. Gets or sets the agent registration key name - primary or secondary.
Known values are: "primary", "secondary".
:vartype key_name: str or ~azure.mgmt.automation.models.AgentRegistrationKeyName
"""
_validation = {
'key_name': {'required': True},
}
_attribute_map = {
'key_name': {'key': 'keyName', 'type': 'str'},
}
def __init__(
self,
*,
key_name: Union[str, "_models.AgentRegistrationKeyName"],
**kwargs
):
"""
:keyword key_name: Required. Gets or sets the agent registration key name - primary or
secondary. Known values are: "primary", "secondary".
:paramtype key_name: str or ~azure.mgmt.automation.models.AgentRegistrationKeyName
"""
super(AgentRegistrationRegenerateKeyParameter, self).__init__(**kwargs)
self.key_name = key_name
class Resource(msrest.serialization.Model):
"""The core properties of ARM resources.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: 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'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(Resource, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None
class TrackedResource(Resource):
"""The resource model definition for a ARM tracked top level resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar tags: A set of tags. Resource tags.
:vartype tags: dict[str, str]
:ivar location: The Azure Region where the resource lives.
:vartype location: 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'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The Azure Region where the resource lives.
:paramtype location: str
"""
super(TrackedResource, self).__init__(**kwargs)
self.tags = tags
self.location = location
class AutomationAccount(TrackedResource):
"""Definition of the automation account type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar tags: A set of tags. Resource tags.
:vartype tags: dict[str, str]
:ivar location: The Azure Region where the resource lives.
:vartype location: str
:ivar etag: Gets or sets the etag of the resource.
:vartype etag: str
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.automation.models.Identity
:ivar system_data: Resource system metadata.
:vartype system_data: ~azure.mgmt.automation.models.SystemData
:ivar sku: Gets or sets the SKU of account.
:vartype sku: ~azure.mgmt.automation.models.Sku
:ivar last_modified_by: Gets or sets the last modified by.
:vartype last_modified_by: str
:ivar state: Gets status of account. Known values are: "Ok", "Unavailable", "Suspended".
:vartype state: str or ~azure.mgmt.automation.models.AutomationAccountState
:ivar creation_time: Gets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
:ivar encryption: Encryption properties for the automation account.
:vartype encryption: ~azure.mgmt.automation.models.EncryptionProperties
:ivar private_endpoint_connections: List of Automation operations supported by the Automation
resource provider.
:vartype private_endpoint_connections:
list[~azure.mgmt.automation.models.PrivateEndpointConnection]
:ivar public_network_access: Indicates whether traffic on the non-ARM endpoint (Webhook/Agent)
is allowed from the public internet.
:vartype public_network_access: bool
:ivar disable_local_auth: Indicates whether requests using non-AAD authentication are blocked.
:vartype disable_local_auth: bool
:ivar automation_hybrid_service_url: URL of automation hybrid service which is used for hybrid
worker on-boarding.
:vartype automation_hybrid_service_url: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'system_data': {'readonly': True},
'state': {'readonly': True},
'creation_time': {'readonly': True},
'last_modified_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
'identity': {'key': 'identity', 'type': 'Identity'},
'system_data': {'key': 'systemData', 'type': 'SystemData'},
'sku': {'key': 'properties.sku', 'type': 'Sku'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'state': {'key': 'properties.state', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'},
'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'},
'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'bool'},
'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'},
'automation_hybrid_service_url': {'key': 'properties.automationHybridServiceUrl', 'type': 'str'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
etag: Optional[str] = None,
identity: Optional["_models.Identity"] = None,
sku: Optional["_models.Sku"] = None,
last_modified_by: Optional[str] = None,
description: Optional[str] = None,
encryption: Optional["_models.EncryptionProperties"] = None,
private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None,
public_network_access: Optional[bool] = None,
disable_local_auth: Optional[bool] = None,
automation_hybrid_service_url: Optional[str] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The Azure Region where the resource lives.
:paramtype location: str
:keyword etag: Gets or sets the etag of the resource.
:paramtype etag: str
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.automation.models.Identity
:keyword sku: Gets or sets the SKU of account.
:paramtype sku: ~azure.mgmt.automation.models.Sku
:keyword last_modified_by: Gets or sets the last modified by.
:paramtype last_modified_by: str
:keyword description: Gets or sets the description.
:paramtype description: str
:keyword encryption: Encryption properties for the automation account.
:paramtype encryption: ~azure.mgmt.automation.models.EncryptionProperties
:keyword private_endpoint_connections: List of Automation operations supported by the
Automation resource provider.
:paramtype private_endpoint_connections:
list[~azure.mgmt.automation.models.PrivateEndpointConnection]
:keyword public_network_access: Indicates whether traffic on the non-ARM endpoint
(Webhook/Agent) is allowed from the public internet.
:paramtype public_network_access: bool
:keyword disable_local_auth: Indicates whether requests using non-AAD authentication are
blocked.
:paramtype disable_local_auth: bool
:keyword automation_hybrid_service_url: URL of automation hybrid service which is used for
hybrid worker on-boarding.
:paramtype automation_hybrid_service_url: str
"""
super(AutomationAccount, self).__init__(tags=tags, location=location, **kwargs)
self.etag = etag
self.identity = identity
self.system_data = None
self.sku = sku
self.last_modified_by = last_modified_by
self.state = None
self.creation_time = None
self.last_modified_time = None
self.description = description
self.encryption = encryption
self.private_endpoint_connections = private_endpoint_connections
self.public_network_access = public_network_access
self.disable_local_auth = disable_local_auth
self.automation_hybrid_service_url = automation_hybrid_service_url
class AutomationAccountCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update automation account operation.
:ivar name: Gets or sets name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar identity: Sets the identity property for automation account.
:vartype identity: ~azure.mgmt.automation.models.Identity
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar sku: Gets or sets account SKU.
:vartype sku: ~azure.mgmt.automation.models.Sku
:ivar encryption: Set the encryption properties for the automation account.
:vartype encryption: ~azure.mgmt.automation.models.EncryptionProperties
:ivar public_network_access: Indicates whether traffic on the non-ARM endpoint (Webhook/Agent)
is allowed from the public internet.
:vartype public_network_access: bool
:ivar disable_local_auth: Indicates whether requests using non-AAD authentication are blocked.
:vartype disable_local_auth: bool
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'identity': {'key': 'identity', 'type': 'Identity'},
'tags': {'key': 'tags', 'type': '{str}'},
'sku': {'key': 'properties.sku', 'type': 'Sku'},
'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'},
'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'bool'},
'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'},
}
def __init__(
self,
*,
name: Optional[str] = None,
location: Optional[str] = None,
identity: Optional["_models.Identity"] = None,
tags: Optional[Dict[str, str]] = None,
sku: Optional["_models.Sku"] = None,
encryption: Optional["_models.EncryptionProperties"] = None,
public_network_access: Optional[bool] = None,
disable_local_auth: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Gets or sets name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword identity: Sets the identity property for automation account.
:paramtype identity: ~azure.mgmt.automation.models.Identity
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword sku: Gets or sets account SKU.
:paramtype sku: ~azure.mgmt.automation.models.Sku
:keyword encryption: Set the encryption properties for the automation account.
:paramtype encryption: ~azure.mgmt.automation.models.EncryptionProperties
:keyword public_network_access: Indicates whether traffic on the non-ARM endpoint
(Webhook/Agent) is allowed from the public internet.
:paramtype public_network_access: bool
:keyword disable_local_auth: Indicates whether requests using non-AAD authentication are
blocked.
:paramtype disable_local_auth: bool
"""
super(AutomationAccountCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.identity = identity
self.tags = tags
self.sku = sku
self.encryption = encryption
self.public_network_access = public_network_access
self.disable_local_auth = disable_local_auth
class AutomationAccountListResult(msrest.serialization.Model):
"""The response model for the list account operation.
:ivar value: Gets or sets list of accounts.
:vartype value: list[~azure.mgmt.automation.models.AutomationAccount]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[AutomationAccount]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.AutomationAccount"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets list of accounts.
:paramtype value: list[~azure.mgmt.automation.models.AutomationAccount]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(AutomationAccountListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class AutomationAccountUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update automation account operation.
:ivar name: Gets or sets the name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar identity: Sets the identity property for automation account.
:vartype identity: ~azure.mgmt.automation.models.Identity
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar sku: Gets or sets account SKU.
:vartype sku: ~azure.mgmt.automation.models.Sku
:ivar encryption: Set the encryption properties for the automation account.
:vartype encryption: ~azure.mgmt.automation.models.EncryptionProperties
:ivar public_network_access: Indicates whether traffic on the non-ARM endpoint (Webhook/Agent)
is allowed from the public internet.
:vartype public_network_access: bool
:ivar disable_local_auth: Indicates whether requests using non-AAD authentication are blocked.
:vartype disable_local_auth: bool
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'identity': {'key': 'identity', 'type': 'Identity'},
'tags': {'key': 'tags', 'type': '{str}'},
'sku': {'key': 'properties.sku', 'type': 'Sku'},
'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'},
'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'bool'},
'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'},
}
def __init__(
self,
*,
name: Optional[str] = None,
location: Optional[str] = None,
identity: Optional["_models.Identity"] = None,
tags: Optional[Dict[str, str]] = None,
sku: Optional["_models.Sku"] = None,
encryption: Optional["_models.EncryptionProperties"] = None,
public_network_access: Optional[bool] = None,
disable_local_auth: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword identity: Sets the identity property for automation account.
:paramtype identity: ~azure.mgmt.automation.models.Identity
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword sku: Gets or sets account SKU.
:paramtype sku: ~azure.mgmt.automation.models.Sku
:keyword encryption: Set the encryption properties for the automation account.
:paramtype encryption: ~azure.mgmt.automation.models.EncryptionProperties
:keyword public_network_access: Indicates whether traffic on the non-ARM endpoint
(Webhook/Agent) is allowed from the public internet.
:paramtype public_network_access: bool
:keyword disable_local_auth: Indicates whether requests using non-AAD authentication are
blocked.
:paramtype disable_local_auth: bool
"""
super(AutomationAccountUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.identity = identity
self.tags = tags
self.sku = sku
self.encryption = encryption
self.public_network_access = public_network_access
self.disable_local_auth = disable_local_auth
class AzureQueryProperties(msrest.serialization.Model):
"""Azure query for the update configuration.
:ivar scope: List of Subscription or Resource Group ARM Ids.
:vartype scope: list[str]
:ivar locations: List of locations to scope the query to.
:vartype locations: list[str]
:ivar tag_settings: Tag settings for the VM.
:vartype tag_settings: ~azure.mgmt.automation.models.TagSettingsProperties
"""
_attribute_map = {
'scope': {'key': 'scope', 'type': '[str]'},
'locations': {'key': 'locations', 'type': '[str]'},
'tag_settings': {'key': 'tagSettings', 'type': 'TagSettingsProperties'},
}
def __init__(
self,
*,
scope: Optional[List[str]] = None,
locations: Optional[List[str]] = None,
tag_settings: Optional["_models.TagSettingsProperties"] = None,
**kwargs
):
"""
:keyword scope: List of Subscription or Resource Group ARM Ids.
:paramtype scope: list[str]
:keyword locations: List of locations to scope the query to.
:paramtype locations: list[str]
:keyword tag_settings: Tag settings for the VM.
:paramtype tag_settings: ~azure.mgmt.automation.models.TagSettingsProperties
"""
super(AzureQueryProperties, self).__init__(**kwargs)
self.scope = scope
self.locations = locations
self.tag_settings = tag_settings
class ProxyResource(Resource):
"""ARM proxy resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: 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'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(ProxyResource, self).__init__(**kwargs)
class Certificate(ProxyResource):
"""Definition of the certificate.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar thumbprint: Gets the thumbprint of the certificate.
:vartype thumbprint: str
:ivar expiry_time: Gets the expiry time of the certificate.
:vartype expiry_time: ~datetime.datetime
:ivar is_exportable: Gets the is exportable flag of the certificate.
:vartype is_exportable: bool
:ivar creation_time: Gets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'thumbprint': {'readonly': True},
'expiry_time': {'readonly': True},
'is_exportable': {'readonly': True},
'creation_time': {'readonly': True},
'last_modified_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'},
'expiry_time': {'key': 'properties.expiryTime', 'type': 'iso-8601'},
'is_exportable': {'key': 'properties.isExportable', 'type': 'bool'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
description: Optional[str] = None,
**kwargs
):
"""
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Certificate, self).__init__(**kwargs)
self.thumbprint = None
self.expiry_time = None
self.is_exportable = None
self.creation_time = None
self.last_modified_time = None
self.description = description
class CertificateCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update or replace certificate operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the certificate.
:vartype name: str
:ivar base64_value: Required. Gets or sets the base64 encoded value of the certificate.
:vartype base64_value: str
:ivar description: Gets or sets the description of the certificate.
:vartype description: str
:ivar thumbprint: Gets or sets the thumbprint of the certificate.
:vartype thumbprint: str
:ivar is_exportable: Gets or sets the is exportable flag of the certificate.
:vartype is_exportable: bool
"""
_validation = {
'name': {'required': True},
'base64_value': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'base64_value': {'key': 'properties.base64Value', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'},
'is_exportable': {'key': 'properties.isExportable', 'type': 'bool'},
}
def __init__(
self,
*,
name: str,
base64_value: str,
description: Optional[str] = None,
thumbprint: Optional[str] = None,
is_exportable: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the certificate.
:paramtype name: str
:keyword base64_value: Required. Gets or sets the base64 encoded value of the certificate.
:paramtype base64_value: str
:keyword description: Gets or sets the description of the certificate.
:paramtype description: str
:keyword thumbprint: Gets or sets the thumbprint of the certificate.
:paramtype thumbprint: str
:keyword is_exportable: Gets or sets the is exportable flag of the certificate.
:paramtype is_exportable: bool
"""
super(CertificateCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.base64_value = base64_value
self.description = description
self.thumbprint = thumbprint
self.is_exportable = is_exportable
class CertificateListResult(msrest.serialization.Model):
"""The response model for the list certificate operation.
:ivar value: Gets or sets a list of certificates.
:vartype value: list[~azure.mgmt.automation.models.Certificate]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Certificate]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Certificate"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of certificates.
:paramtype value: list[~azure.mgmt.automation.models.Certificate]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(CertificateListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class CertificateUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update certificate operation.
:ivar name: Gets or sets the name of the certificate.
:vartype name: str
:ivar description: Gets or sets the description of the certificate.
:vartype description: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the certificate.
:paramtype name: str
:keyword description: Gets or sets the description of the certificate.
:paramtype description: str
"""
super(CertificateUpdateParameters, self).__init__(**kwargs)
self.name = name
self.description = description
class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model):
"""ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar principal_id: The principal id of user assigned identity.
:vartype principal_id: str
:ivar client_id: The client id of user assigned identity.
:vartype client_id: str
"""
_validation = {
'principal_id': {'readonly': True},
'client_id': {'readonly': True},
}
_attribute_map = {
'principal_id': {'key': 'principalId', 'type': 'str'},
'client_id': {'key': 'clientId', 'type': 'str'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs)
self.principal_id = None
self.client_id = None
class Connection(ProxyResource):
"""Definition of the connection.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar connection_type: Gets or sets the connectionType of the connection.
:vartype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty
:ivar field_definition_values: Gets the field definition values of the connection.
:vartype field_definition_values: dict[str, str]
:ivar creation_time: Gets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'field_definition_values': {'readonly': True},
'creation_time': {'readonly': True},
'last_modified_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'connection_type': {'key': 'properties.connectionType', 'type': 'ConnectionTypeAssociationProperty'},
'field_definition_values': {'key': 'properties.fieldDefinitionValues', 'type': '{str}'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
connection_type: Optional["_models.ConnectionTypeAssociationProperty"] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword connection_type: Gets or sets the connectionType of the connection.
:paramtype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Connection, self).__init__(**kwargs)
self.connection_type = connection_type
self.field_definition_values = None
self.creation_time = None
self.last_modified_time = None
self.description = description
class ConnectionCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update connection operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the connection.
:vartype name: str
:ivar description: Gets or sets the description of the connection.
:vartype description: str
:ivar connection_type: Required. Gets or sets the connectionType of the connection.
:vartype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty
:ivar field_definition_values: Gets or sets the field definition properties of the connection.
:vartype field_definition_values: dict[str, str]
"""
_validation = {
'name': {'required': True},
'connection_type': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'connection_type': {'key': 'properties.connectionType', 'type': 'ConnectionTypeAssociationProperty'},
'field_definition_values': {'key': 'properties.fieldDefinitionValues', 'type': '{str}'},
}
def __init__(
self,
*,
name: str,
connection_type: "_models.ConnectionTypeAssociationProperty",
description: Optional[str] = None,
field_definition_values: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the connection.
:paramtype name: str
:keyword description: Gets or sets the description of the connection.
:paramtype description: str
:keyword connection_type: Required. Gets or sets the connectionType of the connection.
:paramtype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty
:keyword field_definition_values: Gets or sets the field definition properties of the
connection.
:paramtype field_definition_values: dict[str, str]
"""
super(ConnectionCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.description = description
self.connection_type = connection_type
self.field_definition_values = field_definition_values
class ConnectionListResult(msrest.serialization.Model):
"""The response model for the list connection operation.
:ivar value: Gets or sets a list of connection.
:vartype value: list[~azure.mgmt.automation.models.Connection]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Connection]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Connection"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of connection.
:paramtype value: list[~azure.mgmt.automation.models.Connection]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(ConnectionListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class ConnectionType(msrest.serialization.Model):
"""Definition of the connection type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Gets the id of the resource.
:vartype id: str
:ivar name: Gets the name of the connection type.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar is_global: Gets or sets a Boolean value to indicate if the connection type is global.
:vartype is_global: bool
:ivar field_definitions: Gets the field definitions of the connection type.
:vartype field_definitions: dict[str, ~azure.mgmt.automation.models.FieldDefinition]
:ivar creation_time: Gets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'field_definitions': {'readonly': True},
'creation_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'is_global': {'key': 'properties.isGlobal', 'type': 'bool'},
'field_definitions': {'key': 'properties.fieldDefinitions', 'type': '{FieldDefinition}'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
is_global: Optional[bool] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword is_global: Gets or sets a Boolean value to indicate if the connection type is global.
:paramtype is_global: bool
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(ConnectionType, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None
self.is_global = is_global
self.field_definitions = None
self.creation_time = None
self.last_modified_time = last_modified_time
self.description = description
class ConnectionTypeAssociationProperty(msrest.serialization.Model):
"""The connection type property associated with the entity.
:ivar name: Gets or sets the name of the connection type.
:vartype name: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the connection type.
:paramtype name: str
"""
super(ConnectionTypeAssociationProperty, self).__init__(**kwargs)
self.name = name
class ConnectionTypeCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update connection type operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the connection type.
:vartype name: str
:ivar is_global: Gets or sets a Boolean value to indicate if the connection type is global.
:vartype is_global: bool
:ivar field_definitions: Required. Gets or sets the field definitions of the connection type.
:vartype field_definitions: dict[str, ~azure.mgmt.automation.models.FieldDefinition]
"""
_validation = {
'name': {'required': True},
'field_definitions': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'is_global': {'key': 'properties.isGlobal', 'type': 'bool'},
'field_definitions': {'key': 'properties.fieldDefinitions', 'type': '{FieldDefinition}'},
}
def __init__(
self,
*,
name: str,
field_definitions: Dict[str, "_models.FieldDefinition"],
is_global: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the connection type.
:paramtype name: str
:keyword is_global: Gets or sets a Boolean value to indicate if the connection type is global.
:paramtype is_global: bool
:keyword field_definitions: Required. Gets or sets the field definitions of the connection
type.
:paramtype field_definitions: dict[str, ~azure.mgmt.automation.models.FieldDefinition]
"""
super(ConnectionTypeCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.is_global = is_global
self.field_definitions = field_definitions
class ConnectionTypeListResult(msrest.serialization.Model):
"""The response model for the list connection type operation.
:ivar value: Gets or sets a list of connection types.
:vartype value: list[~azure.mgmt.automation.models.ConnectionType]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[ConnectionType]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.ConnectionType"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of connection types.
:paramtype value: list[~azure.mgmt.automation.models.ConnectionType]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(ConnectionTypeListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class ConnectionUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update connection operation.
:ivar name: Gets or sets the name of the connection.
:vartype name: str
:ivar description: Gets or sets the description of the connection.
:vartype description: str
:ivar field_definition_values: Gets or sets the field definition values of the connection.
:vartype field_definition_values: dict[str, str]
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'field_definition_values': {'key': 'properties.fieldDefinitionValues', 'type': '{str}'},
}
def __init__(
self,
*,
name: Optional[str] = None,
description: Optional[str] = None,
field_definition_values: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the connection.
:paramtype name: str
:keyword description: Gets or sets the description of the connection.
:paramtype description: str
:keyword field_definition_values: Gets or sets the field definition values of the connection.
:paramtype field_definition_values: dict[str, str]
"""
super(ConnectionUpdateParameters, self).__init__(**kwargs)
self.name = name
self.description = description
self.field_definition_values = field_definition_values
class ContentHash(msrest.serialization.Model):
"""Definition of the runbook property type.
All required parameters must be populated in order to send to Azure.
:ivar algorithm: Required. Gets or sets the content hash algorithm used to hash the content.
:vartype algorithm: str
:ivar value: Required. Gets or sets expected hash value of the content.
:vartype value: str
"""
_validation = {
'algorithm': {'required': True},
'value': {'required': True},
}
_attribute_map = {
'algorithm': {'key': 'algorithm', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'},
}
def __init__(
self,
*,
algorithm: str,
value: str,
**kwargs
):
"""
:keyword algorithm: Required. Gets or sets the content hash algorithm used to hash the content.
:paramtype algorithm: str
:keyword value: Required. Gets or sets expected hash value of the content.
:paramtype value: str
"""
super(ContentHash, self).__init__(**kwargs)
self.algorithm = algorithm
self.value = value
class ContentLink(msrest.serialization.Model):
"""Definition of the content link.
:ivar uri: Gets or sets the uri of the runbook content.
:vartype uri: str
:ivar content_hash: Gets or sets the hash.
:vartype content_hash: ~azure.mgmt.automation.models.ContentHash
:ivar version: Gets or sets the version of the content.
:vartype version: str
"""
_attribute_map = {
'uri': {'key': 'uri', 'type': 'str'},
'content_hash': {'key': 'contentHash', 'type': 'ContentHash'},
'version': {'key': 'version', 'type': 'str'},
}
def __init__(
self,
*,
uri: Optional[str] = None,
content_hash: Optional["_models.ContentHash"] = None,
version: Optional[str] = None,
**kwargs
):
"""
:keyword uri: Gets or sets the uri of the runbook content.
:paramtype uri: str
:keyword content_hash: Gets or sets the hash.
:paramtype content_hash: ~azure.mgmt.automation.models.ContentHash
:keyword version: Gets or sets the version of the content.
:paramtype version: str
"""
super(ContentLink, self).__init__(**kwargs)
self.uri = uri
self.content_hash = content_hash
self.version = version
class ContentSource(msrest.serialization.Model):
"""Definition of the content source.
:ivar hash: Gets or sets the hash.
:vartype hash: ~azure.mgmt.automation.models.ContentHash
:ivar type: Gets or sets the content source type. Known values are: "embeddedContent", "uri".
:vartype type: str or ~azure.mgmt.automation.models.ContentSourceType
:ivar value: Gets or sets the value of the content. This is based on the content source type.
:vartype value: str
:ivar version: Gets or sets the version of the content.
:vartype version: str
"""
_attribute_map = {
'hash': {'key': 'hash', 'type': 'ContentHash'},
'type': {'key': 'type', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'},
'version': {'key': 'version', 'type': 'str'},
}
def __init__(
self,
*,
hash: Optional["_models.ContentHash"] = None,
type: Optional[Union[str, "_models.ContentSourceType"]] = None,
value: Optional[str] = None,
version: Optional[str] = None,
**kwargs
):
"""
:keyword hash: Gets or sets the hash.
:paramtype hash: ~azure.mgmt.automation.models.ContentHash
:keyword type: Gets or sets the content source type. Known values are: "embeddedContent",
"uri".
:paramtype type: str or ~azure.mgmt.automation.models.ContentSourceType
:keyword value: Gets or sets the value of the content. This is based on the content source
type.
:paramtype value: str
:keyword version: Gets or sets the version of the content.
:paramtype version: str
"""
super(ContentSource, self).__init__(**kwargs)
self.hash = hash
self.type = type
self.value = value
self.version = version
class Credential(ProxyResource):
"""Definition of the credential.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar user_name: Gets the user name of the credential.
:vartype user_name: str
:ivar creation_time: Gets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'user_name': {'readonly': True},
'creation_time': {'readonly': True},
'last_modified_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'user_name': {'key': 'properties.userName', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
description: Optional[str] = None,
**kwargs
):
"""
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Credential, self).__init__(**kwargs)
self.user_name = None
self.creation_time = None
self.last_modified_time = None
self.description = description
class CredentialCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update credential operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the credential.
:vartype name: str
:ivar user_name: Required. Gets or sets the user name of the credential.
:vartype user_name: str
:ivar password: Required. Gets or sets the password of the credential.
:vartype password: str
:ivar description: Gets or sets the description of the credential.
:vartype description: str
"""
_validation = {
'name': {'required': True},
'user_name': {'required': True},
'password': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'user_name': {'key': 'properties.userName', 'type': 'str'},
'password': {'key': 'properties.password', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
name: str,
user_name: str,
password: str,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the credential.
:paramtype name: str
:keyword user_name: Required. Gets or sets the user name of the credential.
:paramtype user_name: str
:keyword password: Required. Gets or sets the password of the credential.
:paramtype password: str
:keyword description: Gets or sets the description of the credential.
:paramtype description: str
"""
super(CredentialCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.user_name = user_name
self.password = password
self.description = description
class CredentialListResult(msrest.serialization.Model):
"""The response model for the list credential operation.
:ivar value: Gets or sets a list of credentials.
:vartype value: list[~azure.mgmt.automation.models.Credential]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Credential]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Credential"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of credentials.
:paramtype value: list[~azure.mgmt.automation.models.Credential]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(CredentialListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class CredentialUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the Update credential operation.
:ivar name: Gets or sets the name of the credential.
:vartype name: str
:ivar user_name: Gets or sets the user name of the credential.
:vartype user_name: str
:ivar password: Gets or sets the password of the credential.
:vartype password: str
:ivar description: Gets or sets the description of the credential.
:vartype description: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'user_name': {'key': 'properties.userName', 'type': 'str'},
'password': {'key': 'properties.password', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
user_name: Optional[str] = None,
password: Optional[str] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the credential.
:paramtype name: str
:keyword user_name: Gets or sets the user name of the credential.
:paramtype user_name: str
:keyword password: Gets or sets the password of the credential.
:paramtype password: str
:keyword description: Gets or sets the description of the credential.
:paramtype description: str
"""
super(CredentialUpdateParameters, self).__init__(**kwargs)
self.name = name
self.user_name = user_name
self.password = password
self.description = description
class DscCompilationJob(ProxyResource):
"""Definition of the Dsc Compilation job.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar configuration: Gets or sets the configuration.
:vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:ivar started_by: Gets the compilation job started by.
:vartype started_by: str
:ivar job_id: Gets the id of the job.
:vartype job_id: str
:ivar creation_time: Gets the creation time of the job.
:vartype creation_time: ~datetime.datetime
:ivar provisioning_state: The current provisioning state of the job. Known values are:
"Failed", "Succeeded", "Suspended", "Processing".
:vartype provisioning_state: str or ~azure.mgmt.automation.models.JobProvisioningState
:ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:vartype run_on: str
:ivar status: Gets or sets the status of the job. Known values are: "New", "Activating",
"Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected",
"Suspending", "Stopping", "Resuming", "Removing".
:vartype status: str or ~azure.mgmt.automation.models.JobStatus
:ivar status_details: Gets or sets the status details of the job.
:vartype status_details: str
:ivar start_time: Gets the start time of the job.
:vartype start_time: ~datetime.datetime
:ivar end_time: Gets the end time of the job.
:vartype end_time: ~datetime.datetime
:ivar exception: Gets the exception of the job.
:vartype exception: str
:ivar last_modified_time: Gets the last modified time of the job.
:vartype last_modified_time: ~datetime.datetime
:ivar last_status_modified_time: Gets the last status modified time of the job.
:vartype last_status_modified_time: ~datetime.datetime
:ivar parameters: Gets or sets the parameters of the job.
:vartype parameters: dict[str, str]
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'started_by': {'readonly': True},
'job_id': {'readonly': True},
'creation_time': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
'exception': {'readonly': True},
'last_modified_time': {'readonly': True},
'last_status_modified_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'configuration': {'key': 'properties.configuration', 'type': 'DscConfigurationAssociationProperty'},
'started_by': {'key': 'properties.startedBy', 'type': 'str'},
'job_id': {'key': 'properties.jobId', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
'status': {'key': 'properties.status', 'type': 'str'},
'status_details': {'key': 'properties.statusDetails', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'exception': {'key': 'properties.exception', 'type': 'str'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_status_modified_time': {'key': 'properties.lastStatusModifiedTime', 'type': 'iso-8601'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
}
def __init__(
self,
*,
configuration: Optional["_models.DscConfigurationAssociationProperty"] = None,
provisioning_state: Optional[Union[str, "_models.JobProvisioningState"]] = None,
run_on: Optional[str] = None,
status: Optional[Union[str, "_models.JobStatus"]] = None,
status_details: Optional[str] = None,
parameters: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword configuration: Gets or sets the configuration.
:paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:keyword provisioning_state: The current provisioning state of the job. Known values are:
"Failed", "Succeeded", "Suspended", "Processing".
:paramtype provisioning_state: str or ~azure.mgmt.automation.models.JobProvisioningState
:keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:paramtype run_on: str
:keyword status: Gets or sets the status of the job. Known values are: "New", "Activating",
"Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected",
"Suspending", "Stopping", "Resuming", "Removing".
:paramtype status: str or ~azure.mgmt.automation.models.JobStatus
:keyword status_details: Gets or sets the status details of the job.
:paramtype status_details: str
:keyword parameters: Gets or sets the parameters of the job.
:paramtype parameters: dict[str, str]
"""
super(DscCompilationJob, self).__init__(**kwargs)
self.configuration = configuration
self.started_by = None
self.job_id = None
self.creation_time = None
self.provisioning_state = provisioning_state
self.run_on = run_on
self.status = status
self.status_details = status_details
self.start_time = None
self.end_time = None
self.exception = None
self.last_modified_time = None
self.last_status_modified_time = None
self.parameters = parameters
class DscCompilationJobCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create compilation job operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Gets or sets name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar configuration: Required. Gets or sets the configuration.
:vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:ivar parameters: Gets or sets the parameters of the job.
:vartype parameters: dict[str, str]
:ivar increment_node_configuration_build: If a new build version of NodeConfiguration is
required.
:vartype increment_node_configuration_build: bool
"""
_validation = {
'configuration': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'configuration': {'key': 'properties.configuration', 'type': 'DscConfigurationAssociationProperty'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
'increment_node_configuration_build': {'key': 'properties.incrementNodeConfigurationBuild', 'type': 'bool'},
}
def __init__(
self,
*,
configuration: "_models.DscConfigurationAssociationProperty",
name: Optional[str] = None,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
parameters: Optional[Dict[str, str]] = None,
increment_node_configuration_build: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Gets or sets name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword configuration: Required. Gets or sets the configuration.
:paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:keyword parameters: Gets or sets the parameters of the job.
:paramtype parameters: dict[str, str]
:keyword increment_node_configuration_build: If a new build version of NodeConfiguration is
required.
:paramtype increment_node_configuration_build: bool
"""
super(DscCompilationJobCreateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.tags = tags
self.configuration = configuration
self.parameters = parameters
self.increment_node_configuration_build = increment_node_configuration_build
class DscCompilationJobListResult(msrest.serialization.Model):
"""The response model for the list job operation.
:ivar value: Gets or sets a list of Dsc Compilation jobs.
:vartype value: list[~azure.mgmt.automation.models.DscCompilationJob]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[DscCompilationJob]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.DscCompilationJob"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of Dsc Compilation jobs.
:paramtype value: list[~azure.mgmt.automation.models.DscCompilationJob]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(DscCompilationJobListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class DscConfiguration(TrackedResource):
"""Definition of the configuration type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar tags: A set of tags. Resource tags.
:vartype tags: dict[str, str]
:ivar location: The Azure Region where the resource lives.
:vartype location: str
:ivar etag: Gets or sets the etag of the resource.
:vartype etag: str
:ivar provisioning_state: Gets or sets the provisioning state of the configuration. The only
acceptable values to pass in are None and "Succeeded". The default value is None.
:vartype provisioning_state: str
:ivar job_count: Gets or sets the job count of the configuration.
:vartype job_count: int
:ivar parameters: Gets or sets the configuration parameters.
:vartype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter]
:ivar source: Gets or sets the source.
:vartype source: ~azure.mgmt.automation.models.ContentSource
:ivar state: Gets or sets the state of the configuration. Known values are: "New", "Edit",
"Published".
:vartype state: str or ~azure.mgmt.automation.models.DscConfigurationState
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar node_configuration_count: Gets the number of compiled node configurations.
:vartype node_configuration_count: int
:ivar description: Gets or sets the description.
:vartype description: 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'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'job_count': {'key': 'properties.jobCount', 'type': 'int'},
'parameters': {'key': 'properties.parameters', 'type': '{DscConfigurationParameter}'},
'source': {'key': 'properties.source', 'type': 'ContentSource'},
'state': {'key': 'properties.state', 'type': 'str'},
'log_verbose': {'key': 'properties.logVerbose', 'type': 'bool'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'node_configuration_count': {'key': 'properties.nodeConfigurationCount', 'type': 'int'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
etag: Optional[str] = None,
provisioning_state: Optional[str] = None,
job_count: Optional[int] = None,
parameters: Optional[Dict[str, "_models.DscConfigurationParameter"]] = None,
source: Optional["_models.ContentSource"] = None,
state: Optional[Union[str, "_models.DscConfigurationState"]] = None,
log_verbose: Optional[bool] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
node_configuration_count: Optional[int] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The Azure Region where the resource lives.
:paramtype location: str
:keyword etag: Gets or sets the etag of the resource.
:paramtype etag: str
:keyword provisioning_state: Gets or sets the provisioning state of the configuration. The only
acceptable values to pass in are None and "Succeeded". The default value is None.
:paramtype provisioning_state: str
:keyword job_count: Gets or sets the job count of the configuration.
:paramtype job_count: int
:keyword parameters: Gets or sets the configuration parameters.
:paramtype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter]
:keyword source: Gets or sets the source.
:paramtype source: ~azure.mgmt.automation.models.ContentSource
:keyword state: Gets or sets the state of the configuration. Known values are: "New", "Edit",
"Published".
:paramtype state: str or ~azure.mgmt.automation.models.DscConfigurationState
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword node_configuration_count: Gets the number of compiled node configurations.
:paramtype node_configuration_count: int
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(DscConfiguration, self).__init__(tags=tags, location=location, **kwargs)
self.etag = etag
self.provisioning_state = provisioning_state
self.job_count = job_count
self.parameters = parameters
self.source = source
self.state = state
self.log_verbose = log_verbose
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.node_configuration_count = node_configuration_count
self.description = description
class DscConfigurationAssociationProperty(msrest.serialization.Model):
"""The Dsc configuration property associated with the entity.
:ivar name: Gets or sets the name of the Dsc configuration.
:vartype name: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the Dsc configuration.
:paramtype name: str
"""
super(DscConfigurationAssociationProperty, self).__init__(**kwargs)
self.name = name
class DscConfigurationCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update configuration operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Gets or sets name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar log_progress: Gets or sets progress log option.
:vartype log_progress: bool
:ivar source: Required. Gets or sets the source.
:vartype source: ~azure.mgmt.automation.models.ContentSource
:ivar parameters: Gets or sets the configuration parameters.
:vartype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter]
:ivar description: Gets or sets the description of the configuration.
:vartype description: str
"""
_validation = {
'source': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'log_verbose': {'key': 'properties.logVerbose', 'type': 'bool'},
'log_progress': {'key': 'properties.logProgress', 'type': 'bool'},
'source': {'key': 'properties.source', 'type': 'ContentSource'},
'parameters': {'key': 'properties.parameters', 'type': '{DscConfigurationParameter}'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
source: "_models.ContentSource",
name: Optional[str] = None,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
log_verbose: Optional[bool] = None,
log_progress: Optional[bool] = None,
parameters: Optional[Dict[str, "_models.DscConfigurationParameter"]] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword log_progress: Gets or sets progress log option.
:paramtype log_progress: bool
:keyword source: Required. Gets or sets the source.
:paramtype source: ~azure.mgmt.automation.models.ContentSource
:keyword parameters: Gets or sets the configuration parameters.
:paramtype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter]
:keyword description: Gets or sets the description of the configuration.
:paramtype description: str
"""
super(DscConfigurationCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.tags = tags
self.log_verbose = log_verbose
self.log_progress = log_progress
self.source = source
self.parameters = parameters
self.description = description
class DscConfigurationListResult(msrest.serialization.Model):
"""The response model for the list configuration operation.
:ivar value: Gets or sets a list of configurations.
:vartype value: list[~azure.mgmt.automation.models.DscConfiguration]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
:ivar total_count: Gets the total number of configurations matching filter criteria.
:vartype total_count: int
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[DscConfiguration]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
'total_count': {'key': 'totalCount', 'type': 'int'},
}
def __init__(
self,
*,
value: Optional[List["_models.DscConfiguration"]] = None,
next_link: Optional[str] = None,
total_count: Optional[int] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of configurations.
:paramtype value: list[~azure.mgmt.automation.models.DscConfiguration]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
:keyword total_count: Gets the total number of configurations matching filter criteria.
:paramtype total_count: int
"""
super(DscConfigurationListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
self.total_count = total_count
class DscConfigurationParameter(msrest.serialization.Model):
"""Definition of the configuration parameter type.
:ivar type: Gets or sets the type of the parameter.
:vartype type: str
:ivar is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is mandatory
or not.
:vartype is_mandatory: bool
:ivar position: Get or sets the position of the parameter.
:vartype position: int
:ivar default_value: Gets or sets the default value of parameter.
:vartype default_value: str
"""
_attribute_map = {
'type': {'key': 'type', 'type': 'str'},
'is_mandatory': {'key': 'isMandatory', 'type': 'bool'},
'position': {'key': 'position', 'type': 'int'},
'default_value': {'key': 'defaultValue', 'type': 'str'},
}
def __init__(
self,
*,
type: Optional[str] = None,
is_mandatory: Optional[bool] = None,
position: Optional[int] = None,
default_value: Optional[str] = None,
**kwargs
):
"""
:keyword type: Gets or sets the type of the parameter.
:paramtype type: str
:keyword is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is
mandatory or not.
:paramtype is_mandatory: bool
:keyword position: Get or sets the position of the parameter.
:paramtype position: int
:keyword default_value: Gets or sets the default value of parameter.
:paramtype default_value: str
"""
super(DscConfigurationParameter, self).__init__(**kwargs)
self.type = type
self.is_mandatory = is_mandatory
self.position = position
self.default_value = default_value
class DscConfigurationUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update configuration operation.
:ivar name: Gets or sets name of the resource.
:vartype name: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar log_progress: Gets or sets progress log option.
:vartype log_progress: bool
:ivar source: Gets or sets the source.
:vartype source: ~azure.mgmt.automation.models.ContentSource
:ivar parameters: Gets or sets the configuration parameters.
:vartype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter]
:ivar description: Gets or sets the description of the configuration.
:vartype description: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'log_verbose': {'key': 'properties.logVerbose', 'type': 'bool'},
'log_progress': {'key': 'properties.logProgress', 'type': 'bool'},
'source': {'key': 'properties.source', 'type': 'ContentSource'},
'parameters': {'key': 'properties.parameters', 'type': '{DscConfigurationParameter}'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
log_verbose: Optional[bool] = None,
log_progress: Optional[bool] = None,
source: Optional["_models.ContentSource"] = None,
parameters: Optional[Dict[str, "_models.DscConfigurationParameter"]] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets name of the resource.
:paramtype name: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword log_progress: Gets or sets progress log option.
:paramtype log_progress: bool
:keyword source: Gets or sets the source.
:paramtype source: ~azure.mgmt.automation.models.ContentSource
:keyword parameters: Gets or sets the configuration parameters.
:paramtype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter]
:keyword description: Gets or sets the description of the configuration.
:paramtype description: str
"""
super(DscConfigurationUpdateParameters, self).__init__(**kwargs)
self.name = name
self.tags = tags
self.log_verbose = log_verbose
self.log_progress = log_progress
self.source = source
self.parameters = parameters
self.description = description
class DscMetaConfiguration(msrest.serialization.Model):
"""Definition of the DSC Meta Configuration.
:ivar configuration_mode_frequency_mins: Gets or sets the ConfigurationModeFrequencyMins value
of the meta configuration.
:vartype configuration_mode_frequency_mins: int
:ivar reboot_node_if_needed: Gets or sets the RebootNodeIfNeeded value of the meta
configuration.
:vartype reboot_node_if_needed: bool
:ivar configuration_mode: Gets or sets the ConfigurationMode value of the meta configuration.
:vartype configuration_mode: str
:ivar action_after_reboot: Gets or sets the ActionAfterReboot value of the meta configuration.
:vartype action_after_reboot: str
:ivar certificate_id: Gets or sets the CertificateId value of the meta configuration.
:vartype certificate_id: str
:ivar refresh_frequency_mins: Gets or sets the RefreshFrequencyMins value of the meta
configuration.
:vartype refresh_frequency_mins: int
:ivar allow_module_overwrite: Gets or sets the AllowModuleOverwrite value of the meta
configuration.
:vartype allow_module_overwrite: bool
"""
_attribute_map = {
'configuration_mode_frequency_mins': {'key': 'configurationModeFrequencyMins', 'type': 'int'},
'reboot_node_if_needed': {'key': 'rebootNodeIfNeeded', 'type': 'bool'},
'configuration_mode': {'key': 'configurationMode', 'type': 'str'},
'action_after_reboot': {'key': 'actionAfterReboot', 'type': 'str'},
'certificate_id': {'key': 'certificateId', 'type': 'str'},
'refresh_frequency_mins': {'key': 'refreshFrequencyMins', 'type': 'int'},
'allow_module_overwrite': {'key': 'allowModuleOverwrite', 'type': 'bool'},
}
def __init__(
self,
*,
configuration_mode_frequency_mins: Optional[int] = None,
reboot_node_if_needed: Optional[bool] = None,
configuration_mode: Optional[str] = None,
action_after_reboot: Optional[str] = None,
certificate_id: Optional[str] = None,
refresh_frequency_mins: Optional[int] = None,
allow_module_overwrite: Optional[bool] = None,
**kwargs
):
"""
:keyword configuration_mode_frequency_mins: Gets or sets the ConfigurationModeFrequencyMins
value of the meta configuration.
:paramtype configuration_mode_frequency_mins: int
:keyword reboot_node_if_needed: Gets or sets the RebootNodeIfNeeded value of the meta
configuration.
:paramtype reboot_node_if_needed: bool
:keyword configuration_mode: Gets or sets the ConfigurationMode value of the meta
configuration.
:paramtype configuration_mode: str
:keyword action_after_reboot: Gets or sets the ActionAfterReboot value of the meta
configuration.
:paramtype action_after_reboot: str
:keyword certificate_id: Gets or sets the CertificateId value of the meta configuration.
:paramtype certificate_id: str
:keyword refresh_frequency_mins: Gets or sets the RefreshFrequencyMins value of the meta
configuration.
:paramtype refresh_frequency_mins: int
:keyword allow_module_overwrite: Gets or sets the AllowModuleOverwrite value of the meta
configuration.
:paramtype allow_module_overwrite: bool
"""
super(DscMetaConfiguration, self).__init__(**kwargs)
self.configuration_mode_frequency_mins = configuration_mode_frequency_mins
self.reboot_node_if_needed = reboot_node_if_needed
self.configuration_mode = configuration_mode
self.action_after_reboot = action_after_reboot
self.certificate_id = certificate_id
self.refresh_frequency_mins = refresh_frequency_mins
self.allow_module_overwrite = allow_module_overwrite
class DscNode(ProxyResource):
"""Definition of a DscNode.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar last_seen: Gets or sets the last seen time of the node.
:vartype last_seen: ~datetime.datetime
:ivar registration_time: Gets or sets the registration time of the node.
:vartype registration_time: ~datetime.datetime
:ivar ip: Gets or sets the ip of the node.
:vartype ip: str
:ivar account_id: Gets or sets the account id of the node.
:vartype account_id: str
:ivar status: Gets or sets the status of the node.
:vartype status: str
:ivar node_id: Gets or sets the node id.
:vartype node_id: str
:ivar etag: Gets or sets the etag of the resource.
:vartype etag: str
:ivar total_count: Gets the total number of records matching filter criteria.
:vartype total_count: int
:ivar extension_handler: Gets or sets the list of extensionHandler properties for a Node.
:vartype extension_handler:
list[~azure.mgmt.automation.models.DscNodeExtensionHandlerAssociationProperty]
:ivar name_properties_node_configuration_name: Gets or sets the name of the dsc node
configuration.
:vartype name_properties_node_configuration_name: 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'},
'last_seen': {'key': 'properties.lastSeen', 'type': 'iso-8601'},
'registration_time': {'key': 'properties.registrationTime', 'type': 'iso-8601'},
'ip': {'key': 'properties.ip', 'type': 'str'},
'account_id': {'key': 'properties.accountId', 'type': 'str'},
'status': {'key': 'properties.status', 'type': 'str'},
'node_id': {'key': 'properties.nodeId', 'type': 'str'},
'etag': {'key': 'properties.etag', 'type': 'str'},
'total_count': {'key': 'properties.totalCount', 'type': 'int'},
'extension_handler': {'key': 'properties.extensionHandler', 'type': '[DscNodeExtensionHandlerAssociationProperty]'},
'name_properties_node_configuration_name': {'key': 'properties.nodeConfiguration.name', 'type': 'str'},
}
def __init__(
self,
*,
last_seen: Optional[datetime.datetime] = None,
registration_time: Optional[datetime.datetime] = None,
ip: Optional[str] = None,
account_id: Optional[str] = None,
status: Optional[str] = None,
node_id: Optional[str] = None,
etag: Optional[str] = None,
total_count: Optional[int] = None,
extension_handler: Optional[List["_models.DscNodeExtensionHandlerAssociationProperty"]] = None,
name_properties_node_configuration_name: Optional[str] = None,
**kwargs
):
"""
:keyword last_seen: Gets or sets the last seen time of the node.
:paramtype last_seen: ~datetime.datetime
:keyword registration_time: Gets or sets the registration time of the node.
:paramtype registration_time: ~datetime.datetime
:keyword ip: Gets or sets the ip of the node.
:paramtype ip: str
:keyword account_id: Gets or sets the account id of the node.
:paramtype account_id: str
:keyword status: Gets or sets the status of the node.
:paramtype status: str
:keyword node_id: Gets or sets the node id.
:paramtype node_id: str
:keyword etag: Gets or sets the etag of the resource.
:paramtype etag: str
:keyword total_count: Gets the total number of records matching filter criteria.
:paramtype total_count: int
:keyword extension_handler: Gets or sets the list of extensionHandler properties for a Node.
:paramtype extension_handler:
list[~azure.mgmt.automation.models.DscNodeExtensionHandlerAssociationProperty]
:keyword name_properties_node_configuration_name: Gets or sets the name of the dsc node
configuration.
:paramtype name_properties_node_configuration_name: str
"""
super(DscNode, self).__init__(**kwargs)
self.last_seen = last_seen
self.registration_time = registration_time
self.ip = ip
self.account_id = account_id
self.status = status
self.node_id = node_id
self.etag = etag
self.total_count = total_count
self.extension_handler = extension_handler
self.name_properties_node_configuration_name = name_properties_node_configuration_name
class DscNodeConfiguration(ProxyResource):
"""Definition of the dsc node configuration.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar creation_time: Gets or sets creation time.
:vartype creation_time: ~datetime.datetime
:ivar configuration: Gets or sets the configuration of the node.
:vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:ivar source: Source of node configuration.
:vartype source: str
:ivar node_count: Number of nodes with this node configuration assigned.
:vartype node_count: long
:ivar increment_node_configuration_build: If a new build version of NodeConfiguration is
required.
:vartype increment_node_configuration_build: bool
"""
_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'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'configuration': {'key': 'properties.configuration', 'type': 'DscConfigurationAssociationProperty'},
'source': {'key': 'properties.source', 'type': 'str'},
'node_count': {'key': 'properties.nodeCount', 'type': 'long'},
'increment_node_configuration_build': {'key': 'properties.incrementNodeConfigurationBuild', 'type': 'bool'},
}
def __init__(
self,
*,
last_modified_time: Optional[datetime.datetime] = None,
creation_time: Optional[datetime.datetime] = None,
configuration: Optional["_models.DscConfigurationAssociationProperty"] = None,
source: Optional[str] = None,
node_count: Optional[int] = None,
increment_node_configuration_build: Optional[bool] = None,
**kwargs
):
"""
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword creation_time: Gets or sets creation time.
:paramtype creation_time: ~datetime.datetime
:keyword configuration: Gets or sets the configuration of the node.
:paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:keyword source: Source of node configuration.
:paramtype source: str
:keyword node_count: Number of nodes with this node configuration assigned.
:paramtype node_count: long
:keyword increment_node_configuration_build: If a new build version of NodeConfiguration is
required.
:paramtype increment_node_configuration_build: bool
"""
super(DscNodeConfiguration, self).__init__(**kwargs)
self.last_modified_time = last_modified_time
self.creation_time = creation_time
self.configuration = configuration
self.source = source
self.node_count = node_count
self.increment_node_configuration_build = increment_node_configuration_build
class DscNodeConfigurationCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update node configuration operation.
:ivar name: Name of the node configuration.
:vartype name: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar source: Gets or sets the source.
:vartype source: ~azure.mgmt.automation.models.ContentSource
:ivar configuration: Gets or sets the configuration of the node.
:vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:ivar increment_node_configuration_build: If a new build version of NodeConfiguration is
required.
:vartype increment_node_configuration_build: bool
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'source': {'key': 'properties.source', 'type': 'ContentSource'},
'configuration': {'key': 'properties.configuration', 'type': 'DscConfigurationAssociationProperty'},
'increment_node_configuration_build': {'key': 'properties.incrementNodeConfigurationBuild', 'type': 'bool'},
}
def __init__(
self,
*,
name: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
source: Optional["_models.ContentSource"] = None,
configuration: Optional["_models.DscConfigurationAssociationProperty"] = None,
increment_node_configuration_build: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Name of the node configuration.
:paramtype name: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword source: Gets or sets the source.
:paramtype source: ~azure.mgmt.automation.models.ContentSource
:keyword configuration: Gets or sets the configuration of the node.
:paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:keyword increment_node_configuration_build: If a new build version of NodeConfiguration is
required.
:paramtype increment_node_configuration_build: bool
"""
super(DscNodeConfigurationCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.tags = tags
self.source = source
self.configuration = configuration
self.increment_node_configuration_build = increment_node_configuration_build
class DscNodeConfigurationListResult(msrest.serialization.Model):
"""The response model for the list job operation.
:ivar value: Gets or sets a list of Dsc node configurations.
:vartype value: list[~azure.mgmt.automation.models.DscNodeConfiguration]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
:ivar total_count: Gets or sets the total rows in query.
:vartype total_count: int
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[DscNodeConfiguration]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
'total_count': {'key': 'totalCount', 'type': 'int'},
}
def __init__(
self,
*,
value: Optional[List["_models.DscNodeConfiguration"]] = None,
next_link: Optional[str] = None,
total_count: Optional[int] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of Dsc node configurations.
:paramtype value: list[~azure.mgmt.automation.models.DscNodeConfiguration]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
:keyword total_count: Gets or sets the total rows in query.
:paramtype total_count: int
"""
super(DscNodeConfigurationListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
self.total_count = total_count
class DscNodeExtensionHandlerAssociationProperty(msrest.serialization.Model):
"""The dsc extensionHandler property associated with the node.
:ivar name: Gets or sets the name of the extension handler.
:vartype name: str
:ivar version: Gets or sets the version of the extension handler.
:vartype version: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'version': {'key': 'version', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
version: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the extension handler.
:paramtype name: str
:keyword version: Gets or sets the version of the extension handler.
:paramtype version: str
"""
super(DscNodeExtensionHandlerAssociationProperty, self).__init__(**kwargs)
self.name = name
self.version = version
class DscNodeListResult(msrest.serialization.Model):
"""The response model for the list dsc nodes operation.
:ivar value: Gets or sets a list of dsc nodes.
:vartype value: list[~azure.mgmt.automation.models.DscNode]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
:ivar total_count: Gets the total number of nodes matching filter criteria.
:vartype total_count: int
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[DscNode]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
'total_count': {'key': 'totalCount', 'type': 'int'},
}
def __init__(
self,
*,
value: Optional[List["_models.DscNode"]] = None,
next_link: Optional[str] = None,
total_count: Optional[int] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of dsc nodes.
:paramtype value: list[~azure.mgmt.automation.models.DscNode]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
:keyword total_count: Gets the total number of nodes matching filter criteria.
:paramtype total_count: int
"""
super(DscNodeListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
self.total_count = total_count
class DscNodeReport(msrest.serialization.Model):
"""Definition of the dsc node report type.
:ivar end_time: Gets or sets the end time of the node report.
:vartype end_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the lastModifiedTime of the node report.
:vartype last_modified_time: ~datetime.datetime
:ivar start_time: Gets or sets the start time of the node report.
:vartype start_time: ~datetime.datetime
:ivar type: Gets or sets the type of the node report.
:vartype type: str
:ivar report_id: Gets or sets the id of the node report.
:vartype report_id: str
:ivar status: Gets or sets the status of the node report.
:vartype status: str
:ivar refresh_mode: Gets or sets the refreshMode of the node report.
:vartype refresh_mode: str
:ivar reboot_requested: Gets or sets the rebootRequested of the node report.
:vartype reboot_requested: str
:ivar report_format_version: Gets or sets the reportFormatVersion of the node report.
:vartype report_format_version: str
:ivar configuration_version: Gets or sets the configurationVersion of the node report.
:vartype configuration_version: str
:ivar id: Gets or sets the id.
:vartype id: str
:ivar errors: Gets or sets the errors for the node report.
:vartype errors: list[~azure.mgmt.automation.models.DscReportError]
:ivar resources: Gets or sets the resource for the node report.
:vartype resources: list[~azure.mgmt.automation.models.DscReportResource]
:ivar meta_configuration: Gets or sets the metaConfiguration of the node at the time of the
report.
:vartype meta_configuration: ~azure.mgmt.automation.models.DscMetaConfiguration
:ivar host_name: Gets or sets the hostname of the node that sent the report.
:vartype host_name: str
:ivar i_pv4_addresses: Gets or sets the IPv4 address of the node that sent the report.
:vartype i_pv4_addresses: list[str]
:ivar i_pv6_addresses: Gets or sets the IPv6 address of the node that sent the report.
:vartype i_pv6_addresses: list[str]
:ivar number_of_resources: Gets or sets the number of resource in the node report.
:vartype number_of_resources: int
:ivar raw_errors: Gets or sets the unparsed errors for the node report.
:vartype raw_errors: str
"""
_attribute_map = {
'end_time': {'key': 'endTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'},
'start_time': {'key': 'startTime', 'type': 'iso-8601'},
'type': {'key': 'type', 'type': 'str'},
'report_id': {'key': 'reportId', 'type': 'str'},
'status': {'key': 'status', 'type': 'str'},
'refresh_mode': {'key': 'refreshMode', 'type': 'str'},
'reboot_requested': {'key': 'rebootRequested', 'type': 'str'},
'report_format_version': {'key': 'reportFormatVersion', 'type': 'str'},
'configuration_version': {'key': 'configurationVersion', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'errors': {'key': 'errors', 'type': '[DscReportError]'},
'resources': {'key': 'resources', 'type': '[DscReportResource]'},
'meta_configuration': {'key': 'metaConfiguration', 'type': 'DscMetaConfiguration'},
'host_name': {'key': 'hostName', 'type': 'str'},
'i_pv4_addresses': {'key': 'iPV4Addresses', 'type': '[str]'},
'i_pv6_addresses': {'key': 'iPV6Addresses', 'type': '[str]'},
'number_of_resources': {'key': 'numberOfResources', 'type': 'int'},
'raw_errors': {'key': 'rawErrors', 'type': 'str'},
}
def __init__(
self,
*,
end_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
start_time: Optional[datetime.datetime] = None,
type: Optional[str] = None,
report_id: Optional[str] = None,
status: Optional[str] = None,
refresh_mode: Optional[str] = None,
reboot_requested: Optional[str] = None,
report_format_version: Optional[str] = None,
configuration_version: Optional[str] = None,
id: Optional[str] = None,
errors: Optional[List["_models.DscReportError"]] = None,
resources: Optional[List["_models.DscReportResource"]] = None,
meta_configuration: Optional["_models.DscMetaConfiguration"] = None,
host_name: Optional[str] = None,
i_pv4_addresses: Optional[List[str]] = None,
i_pv6_addresses: Optional[List[str]] = None,
number_of_resources: Optional[int] = None,
raw_errors: Optional[str] = None,
**kwargs
):
"""
:keyword end_time: Gets or sets the end time of the node report.
:paramtype end_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the lastModifiedTime of the node report.
:paramtype last_modified_time: ~datetime.datetime
:keyword start_time: Gets or sets the start time of the node report.
:paramtype start_time: ~datetime.datetime
:keyword type: Gets or sets the type of the node report.
:paramtype type: str
:keyword report_id: Gets or sets the id of the node report.
:paramtype report_id: str
:keyword status: Gets or sets the status of the node report.
:paramtype status: str
:keyword refresh_mode: Gets or sets the refreshMode of the node report.
:paramtype refresh_mode: str
:keyword reboot_requested: Gets or sets the rebootRequested of the node report.
:paramtype reboot_requested: str
:keyword report_format_version: Gets or sets the reportFormatVersion of the node report.
:paramtype report_format_version: str
:keyword configuration_version: Gets or sets the configurationVersion of the node report.
:paramtype configuration_version: str
:keyword id: Gets or sets the id.
:paramtype id: str
:keyword errors: Gets or sets the errors for the node report.
:paramtype errors: list[~azure.mgmt.automation.models.DscReportError]
:keyword resources: Gets or sets the resource for the node report.
:paramtype resources: list[~azure.mgmt.automation.models.DscReportResource]
:keyword meta_configuration: Gets or sets the metaConfiguration of the node at the time of the
report.
:paramtype meta_configuration: ~azure.mgmt.automation.models.DscMetaConfiguration
:keyword host_name: Gets or sets the hostname of the node that sent the report.
:paramtype host_name: str
:keyword i_pv4_addresses: Gets or sets the IPv4 address of the node that sent the report.
:paramtype i_pv4_addresses: list[str]
:keyword i_pv6_addresses: Gets or sets the IPv6 address of the node that sent the report.
:paramtype i_pv6_addresses: list[str]
:keyword number_of_resources: Gets or sets the number of resource in the node report.
:paramtype number_of_resources: int
:keyword raw_errors: Gets or sets the unparsed errors for the node report.
:paramtype raw_errors: str
"""
super(DscNodeReport, self).__init__(**kwargs)
self.end_time = end_time
self.last_modified_time = last_modified_time
self.start_time = start_time
self.type = type
self.report_id = report_id
self.status = status
self.refresh_mode = refresh_mode
self.reboot_requested = reboot_requested
self.report_format_version = report_format_version
self.configuration_version = configuration_version
self.id = id
self.errors = errors
self.resources = resources
self.meta_configuration = meta_configuration
self.host_name = host_name
self.i_pv4_addresses = i_pv4_addresses
self.i_pv6_addresses = i_pv6_addresses
self.number_of_resources = number_of_resources
self.raw_errors = raw_errors
class DscNodeReportListResult(msrest.serialization.Model):
"""The response model for the list dsc nodes operation.
:ivar value: Gets or sets a list of dsc node reports.
:vartype value: list[~azure.mgmt.automation.models.DscNodeReport]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[DscNodeReport]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.DscNodeReport"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of dsc node reports.
:paramtype value: list[~azure.mgmt.automation.models.DscNodeReport]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(DscNodeReportListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class DscNodeUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update dsc node operation.
:ivar node_id: Gets or sets the id of the dsc node.
:vartype node_id: str
:ivar properties:
:vartype properties: ~azure.mgmt.automation.models.DscNodeUpdateParametersProperties
"""
_attribute_map = {
'node_id': {'key': 'nodeId', 'type': 'str'},
'properties': {'key': 'properties', 'type': 'DscNodeUpdateParametersProperties'},
}
def __init__(
self,
*,
node_id: Optional[str] = None,
properties: Optional["_models.DscNodeUpdateParametersProperties"] = None,
**kwargs
):
"""
:keyword node_id: Gets or sets the id of the dsc node.
:paramtype node_id: str
:keyword properties:
:paramtype properties: ~azure.mgmt.automation.models.DscNodeUpdateParametersProperties
"""
super(DscNodeUpdateParameters, self).__init__(**kwargs)
self.node_id = node_id
self.properties = properties
class DscNodeUpdateParametersProperties(msrest.serialization.Model):
"""DscNodeUpdateParametersProperties.
:ivar name: Gets or sets the name of the dsc node configuration.
:vartype name: str
"""
_attribute_map = {
'name': {'key': 'nodeConfiguration.name', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the dsc node configuration.
:paramtype name: str
"""
super(DscNodeUpdateParametersProperties, self).__init__(**kwargs)
self.name = name
class DscReportError(msrest.serialization.Model):
"""Definition of the dsc node report error type.
:ivar error_source: Gets or sets the source of the error.
:vartype error_source: str
:ivar resource_id: Gets or sets the resource ID which generated the error.
:vartype resource_id: str
:ivar error_code: Gets or sets the error code.
:vartype error_code: str
:ivar error_message: Gets or sets the error message.
:vartype error_message: str
:ivar locale: Gets or sets the locale of the error.
:vartype locale: str
:ivar error_details: Gets or sets the error details.
:vartype error_details: str
"""
_attribute_map = {
'error_source': {'key': 'errorSource', 'type': 'str'},
'resource_id': {'key': 'resourceId', 'type': 'str'},
'error_code': {'key': 'errorCode', 'type': 'str'},
'error_message': {'key': 'errorMessage', 'type': 'str'},
'locale': {'key': 'locale', 'type': 'str'},
'error_details': {'key': 'errorDetails', 'type': 'str'},
}
def __init__(
self,
*,
error_source: Optional[str] = None,
resource_id: Optional[str] = None,
error_code: Optional[str] = None,
error_message: Optional[str] = None,
locale: Optional[str] = None,
error_details: Optional[str] = None,
**kwargs
):
"""
:keyword error_source: Gets or sets the source of the error.
:paramtype error_source: str
:keyword resource_id: Gets or sets the resource ID which generated the error.
:paramtype resource_id: str
:keyword error_code: Gets or sets the error code.
:paramtype error_code: str
:keyword error_message: Gets or sets the error message.
:paramtype error_message: str
:keyword locale: Gets or sets the locale of the error.
:paramtype locale: str
:keyword error_details: Gets or sets the error details.
:paramtype error_details: str
"""
super(DscReportError, self).__init__(**kwargs)
self.error_source = error_source
self.resource_id = resource_id
self.error_code = error_code
self.error_message = error_message
self.locale = locale
self.error_details = error_details
class DscReportResource(msrest.serialization.Model):
"""Definition of the DSC Report Resource.
:ivar resource_id: Gets or sets the ID of the resource.
:vartype resource_id: str
:ivar source_info: Gets or sets the source info of the resource.
:vartype source_info: str
:ivar depends_on: Gets or sets the Resource Navigation values for resources the resource
depends on.
:vartype depends_on: list[~azure.mgmt.automation.models.DscReportResourceNavigation]
:ivar module_name: Gets or sets the module name of the resource.
:vartype module_name: str
:ivar module_version: Gets or sets the module version of the resource.
:vartype module_version: str
:ivar resource_name: Gets or sets the name of the resource.
:vartype resource_name: str
:ivar error: Gets or sets the error of the resource.
:vartype error: str
:ivar status: Gets or sets the status of the resource.
:vartype status: str
:ivar duration_in_seconds: Gets or sets the duration in seconds for the resource.
:vartype duration_in_seconds: float
:ivar start_date: Gets or sets the start date of the resource.
:vartype start_date: ~datetime.datetime
"""
_attribute_map = {
'resource_id': {'key': 'resourceId', 'type': 'str'},
'source_info': {'key': 'sourceInfo', 'type': 'str'},
'depends_on': {'key': 'dependsOn', 'type': '[DscReportResourceNavigation]'},
'module_name': {'key': 'moduleName', 'type': 'str'},
'module_version': {'key': 'moduleVersion', 'type': 'str'},
'resource_name': {'key': 'resourceName', 'type': 'str'},
'error': {'key': 'error', 'type': 'str'},
'status': {'key': 'status', 'type': 'str'},
'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'float'},
'start_date': {'key': 'startDate', 'type': 'iso-8601'},
}
def __init__(
self,
*,
resource_id: Optional[str] = None,
source_info: Optional[str] = None,
depends_on: Optional[List["_models.DscReportResourceNavigation"]] = None,
module_name: Optional[str] = None,
module_version: Optional[str] = None,
resource_name: Optional[str] = None,
error: Optional[str] = None,
status: Optional[str] = None,
duration_in_seconds: Optional[float] = None,
start_date: Optional[datetime.datetime] = None,
**kwargs
):
"""
:keyword resource_id: Gets or sets the ID of the resource.
:paramtype resource_id: str
:keyword source_info: Gets or sets the source info of the resource.
:paramtype source_info: str
:keyword depends_on: Gets or sets the Resource Navigation values for resources the resource
depends on.
:paramtype depends_on: list[~azure.mgmt.automation.models.DscReportResourceNavigation]
:keyword module_name: Gets or sets the module name of the resource.
:paramtype module_name: str
:keyword module_version: Gets or sets the module version of the resource.
:paramtype module_version: str
:keyword resource_name: Gets or sets the name of the resource.
:paramtype resource_name: str
:keyword error: Gets or sets the error of the resource.
:paramtype error: str
:keyword status: Gets or sets the status of the resource.
:paramtype status: str
:keyword duration_in_seconds: Gets or sets the duration in seconds for the resource.
:paramtype duration_in_seconds: float
:keyword start_date: Gets or sets the start date of the resource.
:paramtype start_date: ~datetime.datetime
"""
super(DscReportResource, self).__init__(**kwargs)
self.resource_id = resource_id
self.source_info = source_info
self.depends_on = depends_on
self.module_name = module_name
self.module_version = module_version
self.resource_name = resource_name
self.error = error
self.status = status
self.duration_in_seconds = duration_in_seconds
self.start_date = start_date
class DscReportResourceNavigation(msrest.serialization.Model):
"""Navigation for DSC Report Resource.
:ivar resource_id: Gets or sets the ID of the resource to navigate to.
:vartype resource_id: str
"""
_attribute_map = {
'resource_id': {'key': 'resourceId', 'type': 'str'},
}
def __init__(
self,
*,
resource_id: Optional[str] = None,
**kwargs
):
"""
:keyword resource_id: Gets or sets the ID of the resource to navigate to.
:paramtype resource_id: str
"""
super(DscReportResourceNavigation, self).__init__(**kwargs)
self.resource_id = resource_id
class EncryptionProperties(msrest.serialization.Model):
"""The encryption settings for automation account.
:ivar key_vault_properties: Key vault properties.
:vartype key_vault_properties: ~azure.mgmt.automation.models.KeyVaultProperties
:ivar key_source: Encryption Key Source. Known values are: "Microsoft.Automation",
"Microsoft.Keyvault".
:vartype key_source: str or ~azure.mgmt.automation.models.EncryptionKeySourceType
:ivar identity: User identity used for CMK.
:vartype identity: ~azure.mgmt.automation.models.EncryptionPropertiesIdentity
"""
_attribute_map = {
'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'},
'key_source': {'key': 'keySource', 'type': 'str'},
'identity': {'key': 'identity', 'type': 'EncryptionPropertiesIdentity'},
}
def __init__(
self,
*,
key_vault_properties: Optional["_models.KeyVaultProperties"] = None,
key_source: Optional[Union[str, "_models.EncryptionKeySourceType"]] = None,
identity: Optional["_models.EncryptionPropertiesIdentity"] = None,
**kwargs
):
"""
:keyword key_vault_properties: Key vault properties.
:paramtype key_vault_properties: ~azure.mgmt.automation.models.KeyVaultProperties
:keyword key_source: Encryption Key Source. Known values are: "Microsoft.Automation",
"Microsoft.Keyvault".
:paramtype key_source: str or ~azure.mgmt.automation.models.EncryptionKeySourceType
:keyword identity: User identity used for CMK.
:paramtype identity: ~azure.mgmt.automation.models.EncryptionPropertiesIdentity
"""
super(EncryptionProperties, self).__init__(**kwargs)
self.key_vault_properties = key_vault_properties
self.key_source = key_source
self.identity = identity
class EncryptionPropertiesIdentity(msrest.serialization.Model):
"""User identity used for CMK.
:ivar user_assigned_identity: The user identity used for CMK. It will be an ARM resource id in
the form:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
:vartype user_assigned_identity: any
"""
_attribute_map = {
'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'object'},
}
def __init__(
self,
*,
user_assigned_identity: Optional[Any] = None,
**kwargs
):
"""
:keyword user_assigned_identity: The user identity used for CMK. It will be an ARM resource id
in the form:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
:paramtype user_assigned_identity: any
"""
super(EncryptionPropertiesIdentity, self).__init__(**kwargs)
self.user_assigned_identity = user_assigned_identity
class ErrorResponse(msrest.serialization.Model):
"""Error response of an operation failure.
:ivar code: Error code.
:vartype code: str
:ivar message: Error message indicating why the operation failed.
:vartype message: str
"""
_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}
def __init__(
self,
*,
code: Optional[str] = None,
message: Optional[str] = None,
**kwargs
):
"""
:keyword code: Error code.
:paramtype code: str
:keyword message: Error message indicating why the operation failed.
:paramtype message: str
"""
super(ErrorResponse, self).__init__(**kwargs)
self.code = code
self.message = message
class FieldDefinition(msrest.serialization.Model):
"""Definition of the connection fields.
All required parameters must be populated in order to send to Azure.
:ivar is_encrypted: Gets or sets the isEncrypted flag of the connection field definition.
:vartype is_encrypted: bool
:ivar is_optional: Gets or sets the isOptional flag of the connection field definition.
:vartype is_optional: bool
:ivar type: Required. Gets or sets the type of the connection field definition.
:vartype type: str
"""
_validation = {
'type': {'required': True},
}
_attribute_map = {
'is_encrypted': {'key': 'isEncrypted', 'type': 'bool'},
'is_optional': {'key': 'isOptional', 'type': 'bool'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(
self,
*,
type: str,
is_encrypted: Optional[bool] = None,
is_optional: Optional[bool] = None,
**kwargs
):
"""
:keyword is_encrypted: Gets or sets the isEncrypted flag of the connection field definition.
:paramtype is_encrypted: bool
:keyword is_optional: Gets or sets the isOptional flag of the connection field definition.
:paramtype is_optional: bool
:keyword type: Required. Gets or sets the type of the connection field definition.
:paramtype type: str
"""
super(FieldDefinition, self).__init__(**kwargs)
self.is_encrypted = is_encrypted
self.is_optional = is_optional
self.type = type
class GraphicalRunbookContent(msrest.serialization.Model):
"""Graphical Runbook Content.
:ivar raw_content: Raw graphical Runbook content.
:vartype raw_content: ~azure.mgmt.automation.models.RawGraphicalRunbookContent
:ivar graph_runbook_json: Graphical Runbook content as JSON.
:vartype graph_runbook_json: str
"""
_attribute_map = {
'raw_content': {'key': 'rawContent', 'type': 'RawGraphicalRunbookContent'},
'graph_runbook_json': {'key': 'graphRunbookJson', 'type': 'str'},
}
def __init__(
self,
*,
raw_content: Optional["_models.RawGraphicalRunbookContent"] = None,
graph_runbook_json: Optional[str] = None,
**kwargs
):
"""
:keyword raw_content: Raw graphical Runbook content.
:paramtype raw_content: ~azure.mgmt.automation.models.RawGraphicalRunbookContent
:keyword graph_runbook_json: Graphical Runbook content as JSON.
:paramtype graph_runbook_json: str
"""
super(GraphicalRunbookContent, self).__init__(**kwargs)
self.raw_content = raw_content
self.graph_runbook_json = graph_runbook_json
class HybridRunbookWorker(Resource):
"""Definition of hybrid runbook worker.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar system_data: Resource system metadata.
:vartype system_data: ~azure.mgmt.automation.models.SystemData
:ivar ip: Gets or sets the assigned machine IP address.
:vartype ip: str
:ivar registered_date_time: Gets or sets the registration time of the worker machine.
:vartype registered_date_time: ~datetime.datetime
:ivar last_seen_date_time: Last Heartbeat from the Worker.
:vartype last_seen_date_time: ~datetime.datetime
:ivar vm_resource_id: Azure Resource Manager Id for a virtual machine.
:vartype vm_resource_id: str
:ivar worker_type: Type of the HybridWorker. Known values are: "HybridV1", "HybridV2".
:vartype worker_type: str or ~azure.mgmt.automation.models.WorkerType
:ivar worker_name: Name of the HybridWorker.
:vartype worker_name: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'system_data': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'system_data': {'key': 'systemData', 'type': 'SystemData'},
'ip': {'key': 'properties.ip', 'type': 'str'},
'registered_date_time': {'key': 'properties.registeredDateTime', 'type': 'iso-8601'},
'last_seen_date_time': {'key': 'properties.lastSeenDateTime', 'type': 'iso-8601'},
'vm_resource_id': {'key': 'properties.vmResourceId', 'type': 'str'},
'worker_type': {'key': 'properties.workerType', 'type': 'str'},
'worker_name': {'key': 'properties.workerName', 'type': 'str'},
}
def __init__(
self,
*,
ip: Optional[str] = None,
registered_date_time: Optional[datetime.datetime] = None,
last_seen_date_time: Optional[datetime.datetime] = None,
vm_resource_id: Optional[str] = None,
worker_type: Optional[Union[str, "_models.WorkerType"]] = None,
worker_name: Optional[str] = None,
**kwargs
):
"""
:keyword ip: Gets or sets the assigned machine IP address.
:paramtype ip: str
:keyword registered_date_time: Gets or sets the registration time of the worker machine.
:paramtype registered_date_time: ~datetime.datetime
:keyword last_seen_date_time: Last Heartbeat from the Worker.
:paramtype last_seen_date_time: ~datetime.datetime
:keyword vm_resource_id: Azure Resource Manager Id for a virtual machine.
:paramtype vm_resource_id: str
:keyword worker_type: Type of the HybridWorker. Known values are: "HybridV1", "HybridV2".
:paramtype worker_type: str or ~azure.mgmt.automation.models.WorkerType
:keyword worker_name: Name of the HybridWorker.
:paramtype worker_name: str
"""
super(HybridRunbookWorker, self).__init__(**kwargs)
self.system_data = None
self.ip = ip
self.registered_date_time = registered_date_time
self.last_seen_date_time = last_seen_date_time
self.vm_resource_id = vm_resource_id
self.worker_type = worker_type
self.worker_name = worker_name
class HybridRunbookWorkerCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create hybrid runbook worker operation.
:ivar name: Gets or sets the name of the resource.
:vartype name: str
:ivar vm_resource_id: Azure Resource Manager Id for a virtual machine.
:vartype vm_resource_id: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'vm_resource_id': {'key': 'properties.vmResourceId', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
vm_resource_id: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the resource.
:paramtype name: str
:keyword vm_resource_id: Azure Resource Manager Id for a virtual machine.
:paramtype vm_resource_id: str
"""
super(HybridRunbookWorkerCreateParameters, self).__init__(**kwargs)
self.name = name
self.vm_resource_id = vm_resource_id
class HybridRunbookWorkerGroup(msrest.serialization.Model):
"""Definition of hybrid runbook worker group.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Gets or sets the id of the resource.
:vartype id: str
:ivar name: Gets or sets the name of the group.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar hybrid_runbook_workers: Gets or sets the list of hybrid runbook workers.
:vartype hybrid_runbook_workers: list[~azure.mgmt.automation.models.HybridRunbookWorkerLegacy]
:ivar credential: Sets the credential of a worker group.
:vartype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty
:ivar group_type: Type of the HybridWorkerGroup. Known values are: "User", "System".
:vartype group_type: str or ~azure.mgmt.automation.models.GroupTypeEnum
:ivar system_data: Resource system metadata.
:vartype system_data: ~azure.mgmt.automation.models.SystemData
"""
_validation = {
'type': {'readonly': True},
'system_data': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'hybrid_runbook_workers': {'key': 'hybridRunbookWorkers', 'type': '[HybridRunbookWorkerLegacy]'},
'credential': {'key': 'credential', 'type': 'RunAsCredentialAssociationProperty'},
'group_type': {'key': 'groupType', 'type': 'str'},
'system_data': {'key': 'systemData', 'type': 'SystemData'},
}
def __init__(
self,
*,
id: Optional[str] = None,
name: Optional[str] = None,
hybrid_runbook_workers: Optional[List["_models.HybridRunbookWorkerLegacy"]] = None,
credential: Optional["_models.RunAsCredentialAssociationProperty"] = None,
group_type: Optional[Union[str, "_models.GroupTypeEnum"]] = None,
**kwargs
):
"""
:keyword id: Gets or sets the id of the resource.
:paramtype id: str
:keyword name: Gets or sets the name of the group.
:paramtype name: str
:keyword hybrid_runbook_workers: Gets or sets the list of hybrid runbook workers.
:paramtype hybrid_runbook_workers:
list[~azure.mgmt.automation.models.HybridRunbookWorkerLegacy]
:keyword credential: Sets the credential of a worker group.
:paramtype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty
:keyword group_type: Type of the HybridWorkerGroup. Known values are: "User", "System".
:paramtype group_type: str or ~azure.mgmt.automation.models.GroupTypeEnum
"""
super(HybridRunbookWorkerGroup, self).__init__(**kwargs)
self.id = id
self.name = name
self.type = None
self.hybrid_runbook_workers = hybrid_runbook_workers
self.credential = credential
self.group_type = group_type
self.system_data = None
class HybridRunbookWorkerGroupCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update hybrid runbook worker group operation.
:ivar credential: Sets the credential of a worker group.
:vartype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty
"""
_attribute_map = {
'credential': {'key': 'credential', 'type': 'RunAsCredentialAssociationProperty'},
}
def __init__(
self,
*,
credential: Optional["_models.RunAsCredentialAssociationProperty"] = None,
**kwargs
):
"""
:keyword credential: Sets the credential of a worker group.
:paramtype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty
"""
super(HybridRunbookWorkerGroupCreateOrUpdateParameters, self).__init__(**kwargs)
self.credential = credential
class HybridRunbookWorkerGroupsListResult(msrest.serialization.Model):
"""The response model for the list hybrid runbook worker groups.
:ivar value: Gets or sets a list of hybrid runbook worker groups.
:vartype value: list[~azure.mgmt.automation.models.HybridRunbookWorkerGroup]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[HybridRunbookWorkerGroup]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.HybridRunbookWorkerGroup"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of hybrid runbook worker groups.
:paramtype value: list[~azure.mgmt.automation.models.HybridRunbookWorkerGroup]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(HybridRunbookWorkerGroupsListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class HybridRunbookWorkerGroupUpdateParameters(msrest.serialization.Model):
"""Parameters supplied to the update operation.
:ivar credential: Sets the credential of a worker group.
:vartype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty
"""
_attribute_map = {
'credential': {'key': 'credential', 'type': 'RunAsCredentialAssociationProperty'},
}
def __init__(
self,
*,
credential: Optional["_models.RunAsCredentialAssociationProperty"] = None,
**kwargs
):
"""
:keyword credential: Sets the credential of a worker group.
:paramtype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty
"""
super(HybridRunbookWorkerGroupUpdateParameters, self).__init__(**kwargs)
self.credential = credential
class HybridRunbookWorkerLegacy(msrest.serialization.Model):
"""Definition of hybrid runbook worker Legacy.
:ivar name: Gets or sets the worker machine name.
:vartype name: str
:ivar ip: Gets or sets the assigned machine IP address.
:vartype ip: str
:ivar registration_time: Gets or sets the registration time of the worker machine.
:vartype registration_time: ~datetime.datetime
:ivar last_seen_date_time: Last Heartbeat from the Worker.
:vartype last_seen_date_time: ~datetime.datetime
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'ip': {'key': 'ip', 'type': 'str'},
'registration_time': {'key': 'registrationTime', 'type': 'iso-8601'},
'last_seen_date_time': {'key': 'lastSeenDateTime', 'type': 'iso-8601'},
}
def __init__(
self,
*,
name: Optional[str] = None,
ip: Optional[str] = None,
registration_time: Optional[datetime.datetime] = None,
last_seen_date_time: Optional[datetime.datetime] = None,
**kwargs
):
"""
:keyword name: Gets or sets the worker machine name.
:paramtype name: str
:keyword ip: Gets or sets the assigned machine IP address.
:paramtype ip: str
:keyword registration_time: Gets or sets the registration time of the worker machine.
:paramtype registration_time: ~datetime.datetime
:keyword last_seen_date_time: Last Heartbeat from the Worker.
:paramtype last_seen_date_time: ~datetime.datetime
"""
super(HybridRunbookWorkerLegacy, self).__init__(**kwargs)
self.name = name
self.ip = ip
self.registration_time = registration_time
self.last_seen_date_time = last_seen_date_time
class HybridRunbookWorkerMoveParameters(msrest.serialization.Model):
"""Parameters supplied to move hybrid worker operation.
:ivar hybrid_runbook_worker_group_name: Gets or sets the target hybrid runbook worker group.
:vartype hybrid_runbook_worker_group_name: str
"""
_attribute_map = {
'hybrid_runbook_worker_group_name': {'key': 'hybridRunbookWorkerGroupName', 'type': 'str'},
}
def __init__(
self,
*,
hybrid_runbook_worker_group_name: Optional[str] = None,
**kwargs
):
"""
:keyword hybrid_runbook_worker_group_name: Gets or sets the target hybrid runbook worker group.
:paramtype hybrid_runbook_worker_group_name: str
"""
super(HybridRunbookWorkerMoveParameters, self).__init__(**kwargs)
self.hybrid_runbook_worker_group_name = hybrid_runbook_worker_group_name
class HybridRunbookWorkersListResult(msrest.serialization.Model):
"""The response model for the list hybrid runbook workers.
:ivar value: Gets or sets a list of hybrid runbook workers.
:vartype value: list[~azure.mgmt.automation.models.HybridRunbookWorker]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[HybridRunbookWorker]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.HybridRunbookWorker"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of hybrid runbook workers.
:paramtype value: list[~azure.mgmt.automation.models.HybridRunbookWorker]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(HybridRunbookWorkersListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class Identity(msrest.serialization.Model):
"""Identity for the resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar principal_id: The principal ID of resource identity.
:vartype principal_id: str
:ivar tenant_id: The tenant ID of resource.
:vartype tenant_id: str
:ivar type: The identity type. Known values are: "SystemAssigned", "UserAssigned",
"SystemAssigned, UserAssigned", "None".
:vartype type: str or ~azure.mgmt.automation.models.ResourceIdentityType
:ivar user_assigned_identities: The list of user identities associated with the resource. The
user identity dictionary key references will be ARM resource ids in the form:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
:vartype user_assigned_identities: dict[str,
~azure.mgmt.automation.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties]
"""
_validation = {
'principal_id': {'readonly': True},
'tenant_id': {'readonly': True},
}
_attribute_map = {
'principal_id': {'key': 'principalId', 'type': 'str'},
'tenant_id': {'key': 'tenantId', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties}'},
}
def __init__(
self,
*,
type: Optional[Union[str, "_models.ResourceIdentityType"]] = None,
user_assigned_identities: Optional[Dict[str, "_models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None,
**kwargs
):
"""
:keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned",
"SystemAssigned, UserAssigned", "None".
:paramtype type: str or ~azure.mgmt.automation.models.ResourceIdentityType
:keyword user_assigned_identities: The list of user identities associated with the resource.
The user identity dictionary key references will be ARM resource ids in the form:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
:paramtype user_assigned_identities: dict[str,
~azure.mgmt.automation.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties]
"""
super(Identity, self).__init__(**kwargs)
self.principal_id = None
self.tenant_id = None
self.type = type
self.user_assigned_identities = user_assigned_identities
class Job(ProxyResource):
"""Definition of the job.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar runbook: Gets or sets the runbook.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar started_by: Gets or sets the job started by.
:vartype started_by: str
:ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:vartype run_on: str
:ivar job_id: Gets or sets the id of the job.
:vartype job_id: str
:ivar creation_time: Gets or sets the creation time of the job.
:vartype creation_time: ~datetime.datetime
:ivar status: Gets or sets the status of the job. Known values are: "New", "Activating",
"Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected",
"Suspending", "Stopping", "Resuming", "Removing".
:vartype status: str or ~azure.mgmt.automation.models.JobStatus
:ivar status_details: Gets or sets the status details of the job.
:vartype status_details: str
:ivar start_time: Gets or sets the start time of the job.
:vartype start_time: ~datetime.datetime
:ivar end_time: Gets or sets the end time of the job.
:vartype end_time: ~datetime.datetime
:ivar exception: Gets or sets the exception of the job.
:vartype exception: str
:ivar last_modified_time: Gets or sets the last modified time of the job.
:vartype last_modified_time: ~datetime.datetime
:ivar last_status_modified_time: Gets or sets the last status modified time of the job.
:vartype last_status_modified_time: ~datetime.datetime
:ivar parameters: Gets or sets the parameters of the job.
:vartype parameters: dict[str, str]
:ivar provisioning_state: The current provisioning state of the job. Known values are:
"Failed", "Succeeded", "Suspended", "Processing".
:vartype provisioning_state: str or ~azure.mgmt.automation.models.JobProvisioningState
"""
_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'},
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'started_by': {'key': 'properties.startedBy', 'type': 'str'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
'job_id': {'key': 'properties.jobId', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'status': {'key': 'properties.status', 'type': 'str'},
'status_details': {'key': 'properties.statusDetails', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'exception': {'key': 'properties.exception', 'type': 'str'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_status_modified_time': {'key': 'properties.lastStatusModifiedTime', 'type': 'iso-8601'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
}
def __init__(
self,
*,
runbook: Optional["_models.RunbookAssociationProperty"] = None,
started_by: Optional[str] = None,
run_on: Optional[str] = None,
job_id: Optional[str] = None,
creation_time: Optional[datetime.datetime] = None,
status: Optional[Union[str, "_models.JobStatus"]] = None,
status_details: Optional[str] = None,
start_time: Optional[datetime.datetime] = None,
end_time: Optional[datetime.datetime] = None,
exception: Optional[str] = None,
last_modified_time: Optional[datetime.datetime] = None,
last_status_modified_time: Optional[datetime.datetime] = None,
parameters: Optional[Dict[str, str]] = None,
provisioning_state: Optional[Union[str, "_models.JobProvisioningState"]] = None,
**kwargs
):
"""
:keyword runbook: Gets or sets the runbook.
:paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:keyword started_by: Gets or sets the job started by.
:paramtype started_by: str
:keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:paramtype run_on: str
:keyword job_id: Gets or sets the id of the job.
:paramtype job_id: str
:keyword creation_time: Gets or sets the creation time of the job.
:paramtype creation_time: ~datetime.datetime
:keyword status: Gets or sets the status of the job. Known values are: "New", "Activating",
"Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected",
"Suspending", "Stopping", "Resuming", "Removing".
:paramtype status: str or ~azure.mgmt.automation.models.JobStatus
:keyword status_details: Gets or sets the status details of the job.
:paramtype status_details: str
:keyword start_time: Gets or sets the start time of the job.
:paramtype start_time: ~datetime.datetime
:keyword end_time: Gets or sets the end time of the job.
:paramtype end_time: ~datetime.datetime
:keyword exception: Gets or sets the exception of the job.
:paramtype exception: str
:keyword last_modified_time: Gets or sets the last modified time of the job.
:paramtype last_modified_time: ~datetime.datetime
:keyword last_status_modified_time: Gets or sets the last status modified time of the job.
:paramtype last_status_modified_time: ~datetime.datetime
:keyword parameters: Gets or sets the parameters of the job.
:paramtype parameters: dict[str, str]
:keyword provisioning_state: The current provisioning state of the job. Known values are:
"Failed", "Succeeded", "Suspended", "Processing".
:paramtype provisioning_state: str or ~azure.mgmt.automation.models.JobProvisioningState
"""
super(Job, self).__init__(**kwargs)
self.runbook = runbook
self.started_by = started_by
self.run_on = run_on
self.job_id = job_id
self.creation_time = creation_time
self.status = status
self.status_details = status_details
self.start_time = start_time
self.end_time = end_time
self.exception = exception
self.last_modified_time = last_modified_time
self.last_status_modified_time = last_status_modified_time
self.parameters = parameters
self.provisioning_state = provisioning_state
class JobCollectionItem(ProxyResource):
"""Job collection item properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar runbook: The runbook association.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar job_id: The id of the job.
:vartype job_id: str
:ivar creation_time: The creation time of the job.
:vartype creation_time: ~datetime.datetime
:ivar status: The status of the job. Known values are: "New", "Activating", "Running",
"Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected", "Suspending",
"Stopping", "Resuming", "Removing".
:vartype status: str or ~azure.mgmt.automation.models.JobStatus
:ivar start_time: The start time of the job.
:vartype start_time: ~datetime.datetime
:ivar end_time: The end time of the job.
:vartype end_time: ~datetime.datetime
:ivar last_modified_time: The last modified time of the job.
:vartype last_modified_time: ~datetime.datetime
:ivar provisioning_state: The provisioning state of a resource.
:vartype provisioning_state: str
:ivar run_on: Specifies the runOn group name where the job was executed.
:vartype run_on: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'runbook': {'readonly': True},
'job_id': {'readonly': True},
'creation_time': {'readonly': True},
'status': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
'last_modified_time': {'readonly': True},
'provisioning_state': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'job_id': {'key': 'properties.jobId', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'status': {'key': 'properties.status', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
}
def __init__(
self,
*,
run_on: Optional[str] = None,
**kwargs
):
"""
:keyword run_on: Specifies the runOn group name where the job was executed.
:paramtype run_on: str
"""
super(JobCollectionItem, self).__init__(**kwargs)
self.runbook = None
self.job_id = None
self.creation_time = None
self.status = None
self.start_time = None
self.end_time = None
self.last_modified_time = None
self.provisioning_state = None
self.run_on = run_on
class JobCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create job operation.
:ivar runbook: Gets or sets the runbook.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar parameters: Gets or sets the parameters of the job.
:vartype parameters: dict[str, str]
:ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:vartype run_on: str
"""
_attribute_map = {
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
}
def __init__(
self,
*,
runbook: Optional["_models.RunbookAssociationProperty"] = None,
parameters: Optional[Dict[str, str]] = None,
run_on: Optional[str] = None,
**kwargs
):
"""
:keyword runbook: Gets or sets the runbook.
:paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:keyword parameters: Gets or sets the parameters of the job.
:paramtype parameters: dict[str, str]
:keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:paramtype run_on: str
"""
super(JobCreateParameters, self).__init__(**kwargs)
self.runbook = runbook
self.parameters = parameters
self.run_on = run_on
class JobListResultV2(msrest.serialization.Model):
"""The response model for the list job operation.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of jobs.
:vartype value: list[~azure.mgmt.automation.models.JobCollectionItem]
:ivar next_link: The link to the next page.
:vartype next_link: str
"""
_validation = {
'next_link': {'readonly': True},
}
_attribute_map = {
'value': {'key': 'value', 'type': '[JobCollectionItem]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.JobCollectionItem"]] = None,
**kwargs
):
"""
:keyword value: List of jobs.
:paramtype value: list[~azure.mgmt.automation.models.JobCollectionItem]
"""
super(JobListResultV2, self).__init__(**kwargs)
self.value = value
self.next_link = None
class JobNavigation(msrest.serialization.Model):
"""Software update configuration machine run job navigation properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Id of the job associated with the software update configuration run.
:vartype id: str
"""
_validation = {
'id': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(JobNavigation, self).__init__(**kwargs)
self.id = None
class JobSchedule(msrest.serialization.Model):
"""Definition of the job schedule.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Gets the id of the resource.
:vartype id: str
:ivar name: Gets the name of the variable.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar job_schedule_id: Gets or sets the id of job schedule.
:vartype job_schedule_id: str
:ivar schedule: Gets or sets the schedule.
:vartype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty
:ivar runbook: Gets or sets the runbook.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar run_on: Gets or sets the hybrid worker group that the scheduled job should run on.
:vartype run_on: str
:ivar parameters: Gets or sets the parameters of the job schedule.
:vartype parameters: dict[str, 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'},
'job_schedule_id': {'key': 'properties.jobScheduleId', 'type': 'str'},
'schedule': {'key': 'properties.schedule', 'type': 'ScheduleAssociationProperty'},
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
}
def __init__(
self,
*,
job_schedule_id: Optional[str] = None,
schedule: Optional["_models.ScheduleAssociationProperty"] = None,
runbook: Optional["_models.RunbookAssociationProperty"] = None,
run_on: Optional[str] = None,
parameters: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword job_schedule_id: Gets or sets the id of job schedule.
:paramtype job_schedule_id: str
:keyword schedule: Gets or sets the schedule.
:paramtype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty
:keyword runbook: Gets or sets the runbook.
:paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:keyword run_on: Gets or sets the hybrid worker group that the scheduled job should run on.
:paramtype run_on: str
:keyword parameters: Gets or sets the parameters of the job schedule.
:paramtype parameters: dict[str, str]
"""
super(JobSchedule, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None
self.job_schedule_id = job_schedule_id
self.schedule = schedule
self.runbook = runbook
self.run_on = run_on
self.parameters = parameters
class JobScheduleCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create job schedule operation.
All required parameters must be populated in order to send to Azure.
:ivar schedule: Required. Gets or sets the schedule.
:vartype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty
:ivar runbook: Required. Gets or sets the runbook.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar run_on: Gets or sets the hybrid worker group that the scheduled job should run on.
:vartype run_on: str
:ivar parameters: Gets or sets a list of job properties.
:vartype parameters: dict[str, str]
"""
_validation = {
'schedule': {'required': True},
'runbook': {'required': True},
}
_attribute_map = {
'schedule': {'key': 'properties.schedule', 'type': 'ScheduleAssociationProperty'},
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
}
def __init__(
self,
*,
schedule: "_models.ScheduleAssociationProperty",
runbook: "_models.RunbookAssociationProperty",
run_on: Optional[str] = None,
parameters: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword schedule: Required. Gets or sets the schedule.
:paramtype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty
:keyword runbook: Required. Gets or sets the runbook.
:paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:keyword run_on: Gets or sets the hybrid worker group that the scheduled job should run on.
:paramtype run_on: str
:keyword parameters: Gets or sets a list of job properties.
:paramtype parameters: dict[str, str]
"""
super(JobScheduleCreateParameters, self).__init__(**kwargs)
self.schedule = schedule
self.runbook = runbook
self.run_on = run_on
self.parameters = parameters
class JobScheduleListResult(msrest.serialization.Model):
"""The response model for the list job schedule operation.
:ivar value: Gets or sets a list of job schedules.
:vartype value: list[~azure.mgmt.automation.models.JobSchedule]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[JobSchedule]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.JobSchedule"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of job schedules.
:paramtype value: list[~azure.mgmt.automation.models.JobSchedule]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(JobScheduleListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class JobStream(msrest.serialization.Model):
"""Definition of the job stream.
:ivar id: Gets or sets the id of the resource.
:vartype id: str
:ivar job_stream_id: Gets or sets the id of the job stream.
:vartype job_stream_id: str
:ivar time: Gets or sets the creation time of the job.
:vartype time: ~datetime.datetime
:ivar stream_type: Gets or sets the stream type. Known values are: "Progress", "Output",
"Warning", "Error", "Debug", "Verbose", "Any".
:vartype stream_type: str or ~azure.mgmt.automation.models.JobStreamType
:ivar stream_text: Gets or sets the stream text.
:vartype stream_text: str
:ivar summary: Gets or sets the summary.
:vartype summary: str
:ivar value: Gets or sets the values of the job stream.
:vartype value: dict[str, any]
"""
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'job_stream_id': {'key': 'properties.jobStreamId', 'type': 'str'},
'time': {'key': 'properties.time', 'type': 'iso-8601'},
'stream_type': {'key': 'properties.streamType', 'type': 'str'},
'stream_text': {'key': 'properties.streamText', 'type': 'str'},
'summary': {'key': 'properties.summary', 'type': 'str'},
'value': {'key': 'properties.value', 'type': '{object}'},
}
def __init__(
self,
*,
id: Optional[str] = None,
job_stream_id: Optional[str] = None,
time: Optional[datetime.datetime] = None,
stream_type: Optional[Union[str, "_models.JobStreamType"]] = None,
stream_text: Optional[str] = None,
summary: Optional[str] = None,
value: Optional[Dict[str, Any]] = None,
**kwargs
):
"""
:keyword id: Gets or sets the id of the resource.
:paramtype id: str
:keyword job_stream_id: Gets or sets the id of the job stream.
:paramtype job_stream_id: str
:keyword time: Gets or sets the creation time of the job.
:paramtype time: ~datetime.datetime
:keyword stream_type: Gets or sets the stream type. Known values are: "Progress", "Output",
"Warning", "Error", "Debug", "Verbose", "Any".
:paramtype stream_type: str or ~azure.mgmt.automation.models.JobStreamType
:keyword stream_text: Gets or sets the stream text.
:paramtype stream_text: str
:keyword summary: Gets or sets the summary.
:paramtype summary: str
:keyword value: Gets or sets the values of the job stream.
:paramtype value: dict[str, any]
"""
super(JobStream, self).__init__(**kwargs)
self.id = id
self.job_stream_id = job_stream_id
self.time = time
self.stream_type = stream_type
self.stream_text = stream_text
self.summary = summary
self.value = value
class JobStreamListResult(msrest.serialization.Model):
"""The response model for the list job stream operation.
:ivar value: A list of job streams.
:vartype value: list[~azure.mgmt.automation.models.JobStream]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[JobStream]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.JobStream"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: A list of job streams.
:paramtype value: list[~azure.mgmt.automation.models.JobStream]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(JobStreamListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class Key(msrest.serialization.Model):
"""Automation key which is used to register a DSC Node.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar key_name: Automation key name. Known values are: "Primary", "Secondary".
:vartype key_name: str or ~azure.mgmt.automation.models.AutomationKeyName
:ivar permissions: Automation key permissions. Known values are: "Read", "Full".
:vartype permissions: str or ~azure.mgmt.automation.models.AutomationKeyPermissions
:ivar value: Value of the Automation Key used for registration.
:vartype value: str
"""
_validation = {
'key_name': {'readonly': True},
'permissions': {'readonly': True},
'value': {'readonly': True},
}
_attribute_map = {
'key_name': {'key': 'KeyName', 'type': 'str'},
'permissions': {'key': 'Permissions', 'type': 'str'},
'value': {'key': 'Value', 'type': 'str'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(Key, self).__init__(**kwargs)
self.key_name = None
self.permissions = None
self.value = None
class KeyListResult(msrest.serialization.Model):
"""KeyListResult.
:ivar keys: Lists the automation keys.
:vartype keys: list[~azure.mgmt.automation.models.Key]
"""
_attribute_map = {
'keys': {'key': 'keys', 'type': '[Key]'},
}
def __init__(
self,
*,
keys: Optional[List["_models.Key"]] = None,
**kwargs
):
"""
:keyword keys: Lists the automation keys.
:paramtype keys: list[~azure.mgmt.automation.models.Key]
"""
super(KeyListResult, self).__init__(**kwargs)
self.keys = keys
class KeyVaultProperties(msrest.serialization.Model):
"""Settings concerning key vault encryption for a configuration store.
:ivar keyvault_uri: The URI of the key vault key used to encrypt data.
:vartype keyvault_uri: str
:ivar key_name: The name of key used to encrypt data.
:vartype key_name: str
:ivar key_version: The key version of the key used to encrypt data.
:vartype key_version: str
"""
_attribute_map = {
'keyvault_uri': {'key': 'keyvaultUri', 'type': 'str'},
'key_name': {'key': 'keyName', 'type': 'str'},
'key_version': {'key': 'keyVersion', 'type': 'str'},
}
def __init__(
self,
*,
keyvault_uri: Optional[str] = None,
key_name: Optional[str] = None,
key_version: Optional[str] = None,
**kwargs
):
"""
:keyword keyvault_uri: The URI of the key vault key used to encrypt data.
:paramtype keyvault_uri: str
:keyword key_name: The name of key used to encrypt data.
:paramtype key_name: str
:keyword key_version: The key version of the key used to encrypt data.
:paramtype key_version: str
"""
super(KeyVaultProperties, self).__init__(**kwargs)
self.keyvault_uri = keyvault_uri
self.key_name = key_name
self.key_version = key_version
class LinkedWorkspace(msrest.serialization.Model):
"""Definition of the linked workspace.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Gets the id of the linked workspace.
:vartype id: str
"""
_validation = {
'id': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(LinkedWorkspace, self).__init__(**kwargs)
self.id = None
class LinuxProperties(msrest.serialization.Model):
"""Linux specific update configuration.
:ivar included_package_classifications: Update classifications included in the software update
configuration. Known values are: "Unclassified", "Critical", "Security", "Other".
:vartype included_package_classifications: str or
~azure.mgmt.automation.models.LinuxUpdateClasses
:ivar excluded_package_name_masks: packages excluded from the software update configuration.
:vartype excluded_package_name_masks: list[str]
:ivar included_package_name_masks: packages included from the software update configuration.
:vartype included_package_name_masks: list[str]
:ivar reboot_setting: Reboot setting for the software update configuration.
:vartype reboot_setting: str
"""
_attribute_map = {
'included_package_classifications': {'key': 'includedPackageClassifications', 'type': 'str'},
'excluded_package_name_masks': {'key': 'excludedPackageNameMasks', 'type': '[str]'},
'included_package_name_masks': {'key': 'includedPackageNameMasks', 'type': '[str]'},
'reboot_setting': {'key': 'rebootSetting', 'type': 'str'},
}
def __init__(
self,
*,
included_package_classifications: Optional[Union[str, "_models.LinuxUpdateClasses"]] = None,
excluded_package_name_masks: Optional[List[str]] = None,
included_package_name_masks: Optional[List[str]] = None,
reboot_setting: Optional[str] = None,
**kwargs
):
"""
:keyword included_package_classifications: Update classifications included in the software
update configuration. Known values are: "Unclassified", "Critical", "Security", "Other".
:paramtype included_package_classifications: str or
~azure.mgmt.automation.models.LinuxUpdateClasses
:keyword excluded_package_name_masks: packages excluded from the software update configuration.
:paramtype excluded_package_name_masks: list[str]
:keyword included_package_name_masks: packages included from the software update configuration.
:paramtype included_package_name_masks: list[str]
:keyword reboot_setting: Reboot setting for the software update configuration.
:paramtype reboot_setting: str
"""
super(LinuxProperties, self).__init__(**kwargs)
self.included_package_classifications = included_package_classifications
self.excluded_package_name_masks = excluded_package_name_masks
self.included_package_name_masks = included_package_name_masks
self.reboot_setting = reboot_setting
class Module(TrackedResource):
"""Definition of the module type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar tags: A set of tags. Resource tags.
:vartype tags: dict[str, str]
:ivar location: The Azure Region where the resource lives.
:vartype location: str
:ivar etag: Gets or sets the etag of the resource.
:vartype etag: str
:ivar is_global: Gets or sets the isGlobal flag of the module.
:vartype is_global: bool
:ivar version: Gets or sets the version of the module.
:vartype version: str
:ivar size_in_bytes: Gets or sets the size in bytes of the module.
:vartype size_in_bytes: long
:ivar activity_count: Gets or sets the activity count of the module.
:vartype activity_count: int
:ivar provisioning_state: Gets or sets the provisioning state of the module. Known values are:
"Created", "Creating", "StartingImportModuleRunbook", "RunningImportModuleRunbook",
"ContentRetrieved", "ContentDownloaded", "ContentValidated", "ConnectionTypeImported",
"ContentStored", "ModuleDataStored", "ActivitiesStored", "ModuleImportRunbookComplete",
"Succeeded", "Failed", "Cancelled", "Updating".
:vartype provisioning_state: str or ~azure.mgmt.automation.models.ModuleProvisioningState
:ivar content_link: Gets or sets the contentLink of the module.
:vartype content_link: ~azure.mgmt.automation.models.ContentLink
:ivar error: Gets or sets the error info of the module.
:vartype error: ~azure.mgmt.automation.models.ModuleErrorInfo
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
:ivar is_composite: Gets or sets type of module, if its composite or not.
:vartype is_composite: bool
"""
_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'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
'is_global': {'key': 'properties.isGlobal', 'type': 'bool'},
'version': {'key': 'properties.version', 'type': 'str'},
'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'},
'activity_count': {'key': 'properties.activityCount', 'type': 'int'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'content_link': {'key': 'properties.contentLink', 'type': 'ContentLink'},
'error': {'key': 'properties.error', 'type': 'ModuleErrorInfo'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
'is_composite': {'key': 'properties.isComposite', 'type': 'bool'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
etag: Optional[str] = None,
is_global: Optional[bool] = None,
version: Optional[str] = None,
size_in_bytes: Optional[int] = None,
activity_count: Optional[int] = None,
provisioning_state: Optional[Union[str, "_models.ModuleProvisioningState"]] = None,
content_link: Optional["_models.ContentLink"] = None,
error: Optional["_models.ModuleErrorInfo"] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
is_composite: Optional[bool] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The Azure Region where the resource lives.
:paramtype location: str
:keyword etag: Gets or sets the etag of the resource.
:paramtype etag: str
:keyword is_global: Gets or sets the isGlobal flag of the module.
:paramtype is_global: bool
:keyword version: Gets or sets the version of the module.
:paramtype version: str
:keyword size_in_bytes: Gets or sets the size in bytes of the module.
:paramtype size_in_bytes: long
:keyword activity_count: Gets or sets the activity count of the module.
:paramtype activity_count: int
:keyword provisioning_state: Gets or sets the provisioning state of the module. Known values
are: "Created", "Creating", "StartingImportModuleRunbook", "RunningImportModuleRunbook",
"ContentRetrieved", "ContentDownloaded", "ContentValidated", "ConnectionTypeImported",
"ContentStored", "ModuleDataStored", "ActivitiesStored", "ModuleImportRunbookComplete",
"Succeeded", "Failed", "Cancelled", "Updating".
:paramtype provisioning_state: str or ~azure.mgmt.automation.models.ModuleProvisioningState
:keyword content_link: Gets or sets the contentLink of the module.
:paramtype content_link: ~azure.mgmt.automation.models.ContentLink
:keyword error: Gets or sets the error info of the module.
:paramtype error: ~azure.mgmt.automation.models.ModuleErrorInfo
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
:keyword is_composite: Gets or sets type of module, if its composite or not.
:paramtype is_composite: bool
"""
super(Module, self).__init__(tags=tags, location=location, **kwargs)
self.etag = etag
self.is_global = is_global
self.version = version
self.size_in_bytes = size_in_bytes
self.activity_count = activity_count
self.provisioning_state = provisioning_state
self.content_link = content_link
self.error = error
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.description = description
self.is_composite = is_composite
class ModuleCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update module operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Gets or sets name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar content_link: Required. Gets or sets the module content link.
:vartype content_link: ~azure.mgmt.automation.models.ContentLink
"""
_validation = {
'content_link': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'content_link': {'key': 'properties.contentLink', 'type': 'ContentLink'},
}
def __init__(
self,
*,
content_link: "_models.ContentLink",
name: Optional[str] = None,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword name: Gets or sets name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword content_link: Required. Gets or sets the module content link.
:paramtype content_link: ~azure.mgmt.automation.models.ContentLink
"""
super(ModuleCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.tags = tags
self.content_link = content_link
class ModuleErrorInfo(msrest.serialization.Model):
"""Definition of the module error info type.
:ivar code: Gets or sets the error code.
:vartype code: str
:ivar message: Gets or sets the error message.
:vartype message: str
"""
_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}
def __init__(
self,
*,
code: Optional[str] = None,
message: Optional[str] = None,
**kwargs
):
"""
:keyword code: Gets or sets the error code.
:paramtype code: str
:keyword message: Gets or sets the error message.
:paramtype message: str
"""
super(ModuleErrorInfo, self).__init__(**kwargs)
self.code = code
self.message = message
class ModuleListResult(msrest.serialization.Model):
"""The response model for the list module operation.
:ivar value: Gets or sets a list of modules.
:vartype value: list[~azure.mgmt.automation.models.Module]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Module]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Module"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of modules.
:paramtype value: list[~azure.mgmt.automation.models.Module]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(ModuleListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class ModuleUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update module operation.
:ivar name: Gets or sets name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar content_link: Gets or sets the module content link.
:vartype content_link: ~azure.mgmt.automation.models.ContentLink
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'content_link': {'key': 'properties.contentLink', 'type': 'ContentLink'},
}
def __init__(
self,
*,
name: Optional[str] = None,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
content_link: Optional["_models.ContentLink"] = None,
**kwargs
):
"""
:keyword name: Gets or sets name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword content_link: Gets or sets the module content link.
:paramtype content_link: ~azure.mgmt.automation.models.ContentLink
"""
super(ModuleUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.tags = tags
self.content_link = content_link
class NodeCount(msrest.serialization.Model):
"""Number of nodes based on the Filter.
:ivar name: Gets the name of a count type.
:vartype name: str
:ivar properties:
:vartype properties: ~azure.mgmt.automation.models.NodeCountProperties
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'properties': {'key': 'properties', 'type': 'NodeCountProperties'},
}
def __init__(
self,
*,
name: Optional[str] = None,
properties: Optional["_models.NodeCountProperties"] = None,
**kwargs
):
"""
:keyword name: Gets the name of a count type.
:paramtype name: str
:keyword properties:
:paramtype properties: ~azure.mgmt.automation.models.NodeCountProperties
"""
super(NodeCount, self).__init__(**kwargs)
self.name = name
self.properties = properties
class NodeCountProperties(msrest.serialization.Model):
"""NodeCountProperties.
:ivar count: Gets the count for the name.
:vartype count: int
"""
_attribute_map = {
'count': {'key': 'count', 'type': 'int'},
}
def __init__(
self,
*,
count: Optional[int] = None,
**kwargs
):
"""
:keyword count: Gets the count for the name.
:paramtype count: int
"""
super(NodeCountProperties, self).__init__(**kwargs)
self.count = count
class NodeCounts(msrest.serialization.Model):
"""Gets the count of nodes by count type.
:ivar value: Gets an array of counts.
:vartype value: list[~azure.mgmt.automation.models.NodeCount]
:ivar total_count: Gets the total number of records matching countType criteria.
:vartype total_count: int
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[NodeCount]'},
'total_count': {'key': 'totalCount', 'type': 'int'},
}
def __init__(
self,
*,
value: Optional[List["_models.NodeCount"]] = None,
total_count: Optional[int] = None,
**kwargs
):
"""
:keyword value: Gets an array of counts.
:paramtype value: list[~azure.mgmt.automation.models.NodeCount]
:keyword total_count: Gets the total number of records matching countType criteria.
:paramtype total_count: int
"""
super(NodeCounts, self).__init__(**kwargs)
self.value = value
self.total_count = total_count
class NonAzureQueryProperties(msrest.serialization.Model):
"""Non Azure query for the update configuration.
:ivar function_alias: Log Analytics Saved Search name.
:vartype function_alias: str
:ivar workspace_id: Workspace Id for Log Analytics in which the saved Search is resided.
:vartype workspace_id: str
"""
_attribute_map = {
'function_alias': {'key': 'functionAlias', 'type': 'str'},
'workspace_id': {'key': 'workspaceId', 'type': 'str'},
}
def __init__(
self,
*,
function_alias: Optional[str] = None,
workspace_id: Optional[str] = None,
**kwargs
):
"""
:keyword function_alias: Log Analytics Saved Search name.
:paramtype function_alias: str
:keyword workspace_id: Workspace Id for Log Analytics in which the saved Search is resided.
:paramtype workspace_id: str
"""
super(NonAzureQueryProperties, self).__init__(**kwargs)
self.function_alias = function_alias
self.workspace_id = workspace_id
class Operation(msrest.serialization.Model):
"""Automation REST API operation.
:ivar name: Operation name: {provider}/{resource}/{operation}.
:vartype name: str
:ivar display: Provider, Resource and Operation values.
:vartype display: ~azure.mgmt.automation.models.OperationDisplay
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'display': {'key': 'display', 'type': 'OperationDisplay'},
}
def __init__(
self,
*,
name: Optional[str] = None,
display: Optional["_models.OperationDisplay"] = None,
**kwargs
):
"""
:keyword name: Operation name: {provider}/{resource}/{operation}.
:paramtype name: str
:keyword display: Provider, Resource and Operation values.
:paramtype display: ~azure.mgmt.automation.models.OperationDisplay
"""
super(Operation, self).__init__(**kwargs)
self.name = name
self.display = display
class OperationDisplay(msrest.serialization.Model):
"""Provider, Resource and Operation values.
:ivar provider: Service provider: Microsoft.Automation.
:vartype provider: str
:ivar resource: Resource on which the operation is performed: Runbooks, Jobs etc.
:vartype resource: str
:ivar operation: Operation type: Read, write, delete, etc.
:vartype operation: str
"""
_attribute_map = {
'provider': {'key': 'provider', 'type': 'str'},
'resource': {'key': 'resource', 'type': 'str'},
'operation': {'key': 'operation', 'type': 'str'},
}
def __init__(
self,
*,
provider: Optional[str] = None,
resource: Optional[str] = None,
operation: Optional[str] = None,
**kwargs
):
"""
:keyword provider: Service provider: Microsoft.Automation.
:paramtype provider: str
:keyword resource: Resource on which the operation is performed: Runbooks, Jobs etc.
:paramtype resource: str
:keyword operation: Operation type: Read, write, delete, etc.
:paramtype operation: str
"""
super(OperationDisplay, self).__init__(**kwargs)
self.provider = provider
self.resource = resource
self.operation = operation
class OperationListResult(msrest.serialization.Model):
"""The response model for the list of Automation operations.
:ivar value: List of Automation operations supported by the Automation resource provider.
:vartype value: list[~azure.mgmt.automation.models.Operation]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Operation]'},
}
def __init__(
self,
*,
value: Optional[List["_models.Operation"]] = None,
**kwargs
):
"""
:keyword value: List of Automation operations supported by the Automation resource provider.
:paramtype value: list[~azure.mgmt.automation.models.Operation]
"""
super(OperationListResult, self).__init__(**kwargs)
self.value = value
class PrivateEndpointConnection(ProxyResource):
"""A private endpoint connection.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar private_endpoint: Private endpoint which the connection belongs to.
:vartype private_endpoint: ~azure.mgmt.automation.models.PrivateEndpointProperty
:ivar group_ids: Gets the groupIds.
:vartype group_ids: list[str]
:ivar private_link_service_connection_state: Connection State of the Private Endpoint
Connection.
:vartype private_link_service_connection_state:
~azure.mgmt.automation.models.PrivateLinkServiceConnectionStateProperty
"""
_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'},
'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpointProperty'},
'group_ids': {'key': 'properties.groupIds', 'type': '[str]'},
'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'},
}
def __init__(
self,
*,
private_endpoint: Optional["_models.PrivateEndpointProperty"] = None,
group_ids: Optional[List[str]] = None,
private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None,
**kwargs
):
"""
:keyword private_endpoint: Private endpoint which the connection belongs to.
:paramtype private_endpoint: ~azure.mgmt.automation.models.PrivateEndpointProperty
:keyword group_ids: Gets the groupIds.
:paramtype group_ids: list[str]
:keyword private_link_service_connection_state: Connection State of the Private Endpoint
Connection.
:paramtype private_link_service_connection_state:
~azure.mgmt.automation.models.PrivateLinkServiceConnectionStateProperty
"""
super(PrivateEndpointConnection, self).__init__(**kwargs)
self.private_endpoint = private_endpoint
self.group_ids = group_ids
self.private_link_service_connection_state = private_link_service_connection_state
class PrivateEndpointConnectionListResult(msrest.serialization.Model):
"""A list of private endpoint connections.
:ivar value: Array of private endpoint connections.
:vartype value: list[~azure.mgmt.automation.models.PrivateEndpointConnection]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'},
}
def __init__(
self,
*,
value: Optional[List["_models.PrivateEndpointConnection"]] = None,
**kwargs
):
"""
:keyword value: Array of private endpoint connections.
:paramtype value: list[~azure.mgmt.automation.models.PrivateEndpointConnection]
"""
super(PrivateEndpointConnectionListResult, self).__init__(**kwargs)
self.value = value
class PrivateEndpointProperty(msrest.serialization.Model):
"""Private endpoint which the connection belongs to.
:ivar id: Resource id of the private endpoint.
:vartype id: str
"""
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
}
def __init__(
self,
*,
id: Optional[str] = None,
**kwargs
):
"""
:keyword id: Resource id of the private endpoint.
:paramtype id: str
"""
super(PrivateEndpointProperty, self).__init__(**kwargs)
self.id = id
class PrivateLinkResource(ProxyResource):
"""A private link resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar group_id: The private link resource group id.
:vartype group_id: str
:ivar required_members: The private link resource required member names.
:vartype required_members: list[str]
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'group_id': {'readonly': True},
'required_members': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'group_id': {'key': 'properties.groupId', 'type': 'str'},
'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(PrivateLinkResource, self).__init__(**kwargs)
self.group_id = None
self.required_members = None
class PrivateLinkResourceListResult(msrest.serialization.Model):
"""A list of private link resources.
:ivar value: Array of private link resources.
:vartype value: list[~azure.mgmt.automation.models.PrivateLinkResource]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[PrivateLinkResource]'},
}
def __init__(
self,
*,
value: Optional[List["_models.PrivateLinkResource"]] = None,
**kwargs
):
"""
:keyword value: Array of private link resources.
:paramtype value: list[~azure.mgmt.automation.models.PrivateLinkResource]
"""
super(PrivateLinkResourceListResult, self).__init__(**kwargs)
self.value = value
class PrivateLinkServiceConnectionStateProperty(msrest.serialization.Model):
"""Connection State of the Private Endpoint Connection.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar status: The private link service connection status.
:vartype status: str
:ivar description: The private link service connection description.
:vartype description: str
:ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/
disconnect).
:vartype actions_required: str
"""
_validation = {
'actions_required': {'readonly': True},
}
_attribute_map = {
'status': {'key': 'status', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
'actions_required': {'key': 'actionsRequired', 'type': 'str'},
}
def __init__(
self,
*,
status: Optional[str] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword status: The private link service connection status.
:paramtype status: str
:keyword description: The private link service connection description.
:paramtype description: str
"""
super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs)
self.status = status
self.description = description
self.actions_required = None
class PythonPackageCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update module operation.
All required parameters must be populated in order to send to Azure.
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar content_link: Required. Gets or sets the module content link.
:vartype content_link: ~azure.mgmt.automation.models.ContentLink
"""
_validation = {
'content_link': {'required': True},
}
_attribute_map = {
'tags': {'key': 'tags', 'type': '{str}'},
'content_link': {'key': 'properties.contentLink', 'type': 'ContentLink'},
}
def __init__(
self,
*,
content_link: "_models.ContentLink",
tags: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword content_link: Required. Gets or sets the module content link.
:paramtype content_link: ~azure.mgmt.automation.models.ContentLink
"""
super(PythonPackageCreateParameters, self).__init__(**kwargs)
self.tags = tags
self.content_link = content_link
class PythonPackageUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update module operation.
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
"""
_attribute_map = {
'tags': {'key': 'tags', 'type': '{str}'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
"""
super(PythonPackageUpdateParameters, self).__init__(**kwargs)
self.tags = tags
class RawGraphicalRunbookContent(msrest.serialization.Model):
"""Raw Graphical Runbook content.
:ivar schema_version: Schema version of the serializer.
:vartype schema_version: str
:ivar runbook_definition: Serialized Graphical runbook.
:vartype runbook_definition: str
:ivar runbook_type: Runbook Type. Known values are: "GraphPowerShell",
"GraphPowerShellWorkflow".
:vartype runbook_type: str or ~azure.mgmt.automation.models.GraphRunbookType
"""
_attribute_map = {
'schema_version': {'key': 'schemaVersion', 'type': 'str'},
'runbook_definition': {'key': 'runbookDefinition', 'type': 'str'},
'runbook_type': {'key': 'runbookType', 'type': 'str'},
}
def __init__(
self,
*,
schema_version: Optional[str] = None,
runbook_definition: Optional[str] = None,
runbook_type: Optional[Union[str, "_models.GraphRunbookType"]] = None,
**kwargs
):
"""
:keyword schema_version: Schema version of the serializer.
:paramtype schema_version: str
:keyword runbook_definition: Serialized Graphical runbook.
:paramtype runbook_definition: str
:keyword runbook_type: Runbook Type. Known values are: "GraphPowerShell",
"GraphPowerShellWorkflow".
:paramtype runbook_type: str or ~azure.mgmt.automation.models.GraphRunbookType
"""
super(RawGraphicalRunbookContent, self).__init__(**kwargs)
self.schema_version = schema_version
self.runbook_definition = runbook_definition
self.runbook_type = runbook_type
class RunAsCredentialAssociationProperty(msrest.serialization.Model):
"""Definition of RunAs credential to use for hybrid worker.
:ivar name: Gets or sets the name of the credential.
:vartype name: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the credential.
:paramtype name: str
"""
super(RunAsCredentialAssociationProperty, self).__init__(**kwargs)
self.name = name
class Runbook(TrackedResource):
"""Definition of the runbook type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar tags: A set of tags. Resource tags.
:vartype tags: dict[str, str]
:ivar location: The Azure Region where the resource lives.
:vartype location: str
:ivar etag: Gets or sets the etag of the resource.
:vartype etag: str
:ivar runbook_type: Gets or sets the type of the runbook. Known values are: "Script", "Graph",
"PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", "Python2",
"Python3".
:vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum
:ivar publish_content_link: Gets or sets the published runbook content link.
:vartype publish_content_link: ~azure.mgmt.automation.models.ContentLink
:ivar state: Gets or sets the state of the runbook. Known values are: "New", "Edit",
"Published".
:vartype state: str or ~azure.mgmt.automation.models.RunbookState
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar log_progress: Gets or sets progress log option.
:vartype log_progress: bool
:ivar log_activity_trace: Gets or sets the option to log activity trace of the runbook.
:vartype log_activity_trace: int
:ivar job_count: Gets or sets the job count of the runbook.
:vartype job_count: int
:ivar parameters: Gets or sets the runbook parameters.
:vartype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter]
:ivar output_types: Gets or sets the runbook output types.
:vartype output_types: list[str]
:ivar draft: Gets or sets the draft runbook properties.
:vartype draft: ~azure.mgmt.automation.models.RunbookDraft
:ivar provisioning_state: Gets or sets the provisioning state of the runbook. The only
acceptable values to pass in are None and "Succeeded". The default value is None.
:vartype provisioning_state: str
:ivar last_modified_by: Gets or sets the last modified by.
:vartype last_modified_by: str
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: 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'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
'runbook_type': {'key': 'properties.runbookType', 'type': 'str'},
'publish_content_link': {'key': 'properties.publishContentLink', 'type': 'ContentLink'},
'state': {'key': 'properties.state', 'type': 'str'},
'log_verbose': {'key': 'properties.logVerbose', 'type': 'bool'},
'log_progress': {'key': 'properties.logProgress', 'type': 'bool'},
'log_activity_trace': {'key': 'properties.logActivityTrace', 'type': 'int'},
'job_count': {'key': 'properties.jobCount', 'type': 'int'},
'parameters': {'key': 'properties.parameters', 'type': '{RunbookParameter}'},
'output_types': {'key': 'properties.outputTypes', 'type': '[str]'},
'draft': {'key': 'properties.draft', 'type': 'RunbookDraft'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
etag: Optional[str] = None,
runbook_type: Optional[Union[str, "_models.RunbookTypeEnum"]] = None,
publish_content_link: Optional["_models.ContentLink"] = None,
state: Optional[Union[str, "_models.RunbookState"]] = None,
log_verbose: Optional[bool] = None,
log_progress: Optional[bool] = None,
log_activity_trace: Optional[int] = None,
job_count: Optional[int] = None,
parameters: Optional[Dict[str, "_models.RunbookParameter"]] = None,
output_types: Optional[List[str]] = None,
draft: Optional["_models.RunbookDraft"] = None,
provisioning_state: Optional[str] = None,
last_modified_by: Optional[str] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The Azure Region where the resource lives.
:paramtype location: str
:keyword etag: Gets or sets the etag of the resource.
:paramtype etag: str
:keyword runbook_type: Gets or sets the type of the runbook. Known values are: "Script",
"Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell",
"Python2", "Python3".
:paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum
:keyword publish_content_link: Gets or sets the published runbook content link.
:paramtype publish_content_link: ~azure.mgmt.automation.models.ContentLink
:keyword state: Gets or sets the state of the runbook. Known values are: "New", "Edit",
"Published".
:paramtype state: str or ~azure.mgmt.automation.models.RunbookState
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword log_progress: Gets or sets progress log option.
:paramtype log_progress: bool
:keyword log_activity_trace: Gets or sets the option to log activity trace of the runbook.
:paramtype log_activity_trace: int
:keyword job_count: Gets or sets the job count of the runbook.
:paramtype job_count: int
:keyword parameters: Gets or sets the runbook parameters.
:paramtype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter]
:keyword output_types: Gets or sets the runbook output types.
:paramtype output_types: list[str]
:keyword draft: Gets or sets the draft runbook properties.
:paramtype draft: ~azure.mgmt.automation.models.RunbookDraft
:keyword provisioning_state: Gets or sets the provisioning state of the runbook. The only
acceptable values to pass in are None and "Succeeded". The default value is None.
:paramtype provisioning_state: str
:keyword last_modified_by: Gets or sets the last modified by.
:paramtype last_modified_by: str
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Runbook, self).__init__(tags=tags, location=location, **kwargs)
self.etag = etag
self.runbook_type = runbook_type
self.publish_content_link = publish_content_link
self.state = state
self.log_verbose = log_verbose
self.log_progress = log_progress
self.log_activity_trace = log_activity_trace
self.job_count = job_count
self.parameters = parameters
self.output_types = output_types
self.draft = draft
self.provisioning_state = provisioning_state
self.last_modified_by = last_modified_by
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.description = description
class RunbookAssociationProperty(msrest.serialization.Model):
"""The runbook property associated with the entity.
:ivar name: Gets or sets the name of the runbook.
:vartype name: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the runbook.
:paramtype name: str
"""
super(RunbookAssociationProperty, self).__init__(**kwargs)
self.name = name
class RunbookCreateOrUpdateDraftParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update runbook operation.
All required parameters must be populated in order to send to Azure.
:ivar runbook_content: Required. Content of the Runbook.
:vartype runbook_content: str
"""
_validation = {
'runbook_content': {'required': True},
}
_attribute_map = {
'runbook_content': {'key': 'runbookContent', 'type': 'str'},
}
def __init__(
self,
*,
runbook_content: str,
**kwargs
):
"""
:keyword runbook_content: Required. Content of the Runbook.
:paramtype runbook_content: str
"""
super(RunbookCreateOrUpdateDraftParameters, self).__init__(**kwargs)
self.runbook_content = runbook_content
class RunbookCreateOrUpdateDraftProperties(msrest.serialization.Model):
"""The parameters supplied to the create or update draft runbook properties.
All required parameters must be populated in order to send to Azure.
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar log_progress: Gets or sets progress log option.
:vartype log_progress: bool
:ivar runbook_type: Required. Gets or sets the type of the runbook. Known values are: "Script",
"Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell",
"Python2", "Python3".
:vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum
:ivar draft: Required. Gets or sets the draft runbook properties.
:vartype draft: ~azure.mgmt.automation.models.RunbookDraft
:ivar description: Gets or sets the description of the runbook.
:vartype description: str
:ivar log_activity_trace: Gets or sets the activity-level tracing options of the runbook.
:vartype log_activity_trace: int
"""
_validation = {
'runbook_type': {'required': True},
'draft': {'required': True},
}
_attribute_map = {
'log_verbose': {'key': 'logVerbose', 'type': 'bool'},
'log_progress': {'key': 'logProgress', 'type': 'bool'},
'runbook_type': {'key': 'runbookType', 'type': 'str'},
'draft': {'key': 'draft', 'type': 'RunbookDraft'},
'description': {'key': 'description', 'type': 'str'},
'log_activity_trace': {'key': 'logActivityTrace', 'type': 'int'},
}
def __init__(
self,
*,
runbook_type: Union[str, "_models.RunbookTypeEnum"],
draft: "_models.RunbookDraft",
log_verbose: Optional[bool] = None,
log_progress: Optional[bool] = None,
description: Optional[str] = None,
log_activity_trace: Optional[int] = None,
**kwargs
):
"""
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword log_progress: Gets or sets progress log option.
:paramtype log_progress: bool
:keyword runbook_type: Required. Gets or sets the type of the runbook. Known values are:
"Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow",
"GraphPowerShell", "Python2", "Python3".
:paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum
:keyword draft: Required. Gets or sets the draft runbook properties.
:paramtype draft: ~azure.mgmt.automation.models.RunbookDraft
:keyword description: Gets or sets the description of the runbook.
:paramtype description: str
:keyword log_activity_trace: Gets or sets the activity-level tracing options of the runbook.
:paramtype log_activity_trace: int
"""
super(RunbookCreateOrUpdateDraftProperties, self).__init__(**kwargs)
self.log_verbose = log_verbose
self.log_progress = log_progress
self.runbook_type = runbook_type
self.draft = draft
self.description = description
self.log_activity_trace = log_activity_trace
class RunbookCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update runbook operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Gets or sets the name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar log_progress: Gets or sets progress log option.
:vartype log_progress: bool
:ivar runbook_type: Required. Gets or sets the type of the runbook. Known values are: "Script",
"Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell",
"Python2", "Python3".
:vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum
:ivar draft: Gets or sets the draft runbook properties.
:vartype draft: ~azure.mgmt.automation.models.RunbookDraft
:ivar publish_content_link: Gets or sets the published runbook content link.
:vartype publish_content_link: ~azure.mgmt.automation.models.ContentLink
:ivar description: Gets or sets the description of the runbook.
:vartype description: str
:ivar log_activity_trace: Gets or sets the activity-level tracing options of the runbook.
:vartype log_activity_trace: int
"""
_validation = {
'runbook_type': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'log_verbose': {'key': 'properties.logVerbose', 'type': 'bool'},
'log_progress': {'key': 'properties.logProgress', 'type': 'bool'},
'runbook_type': {'key': 'properties.runbookType', 'type': 'str'},
'draft': {'key': 'properties.draft', 'type': 'RunbookDraft'},
'publish_content_link': {'key': 'properties.publishContentLink', 'type': 'ContentLink'},
'description': {'key': 'properties.description', 'type': 'str'},
'log_activity_trace': {'key': 'properties.logActivityTrace', 'type': 'int'},
}
def __init__(
self,
*,
runbook_type: Union[str, "_models.RunbookTypeEnum"],
name: Optional[str] = None,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
log_verbose: Optional[bool] = None,
log_progress: Optional[bool] = None,
draft: Optional["_models.RunbookDraft"] = None,
publish_content_link: Optional["_models.ContentLink"] = None,
description: Optional[str] = None,
log_activity_trace: Optional[int] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword log_progress: Gets or sets progress log option.
:paramtype log_progress: bool
:keyword runbook_type: Required. Gets or sets the type of the runbook. Known values are:
"Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow",
"GraphPowerShell", "Python2", "Python3".
:paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum
:keyword draft: Gets or sets the draft runbook properties.
:paramtype draft: ~azure.mgmt.automation.models.RunbookDraft
:keyword publish_content_link: Gets or sets the published runbook content link.
:paramtype publish_content_link: ~azure.mgmt.automation.models.ContentLink
:keyword description: Gets or sets the description of the runbook.
:paramtype description: str
:keyword log_activity_trace: Gets or sets the activity-level tracing options of the runbook.
:paramtype log_activity_trace: int
"""
super(RunbookCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.tags = tags
self.log_verbose = log_verbose
self.log_progress = log_progress
self.runbook_type = runbook_type
self.draft = draft
self.publish_content_link = publish_content_link
self.description = description
self.log_activity_trace = log_activity_trace
class RunbookDraft(msrest.serialization.Model):
"""RunbookDraft.
:ivar in_edit: Gets or sets whether runbook is in edit mode.
:vartype in_edit: bool
:ivar draft_content_link: Gets or sets the draft runbook content link.
:vartype draft_content_link: ~azure.mgmt.automation.models.ContentLink
:ivar creation_time: Gets or sets the creation time of the runbook draft.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time of the runbook draft.
:vartype last_modified_time: ~datetime.datetime
:ivar parameters: Gets or sets the runbook draft parameters.
:vartype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter]
:ivar output_types: Gets or sets the runbook output types.
:vartype output_types: list[str]
"""
_attribute_map = {
'in_edit': {'key': 'inEdit', 'type': 'bool'},
'draft_content_link': {'key': 'draftContentLink', 'type': 'ContentLink'},
'creation_time': {'key': 'creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'},
'parameters': {'key': 'parameters', 'type': '{RunbookParameter}'},
'output_types': {'key': 'outputTypes', 'type': '[str]'},
}
def __init__(
self,
*,
in_edit: Optional[bool] = None,
draft_content_link: Optional["_models.ContentLink"] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
parameters: Optional[Dict[str, "_models.RunbookParameter"]] = None,
output_types: Optional[List[str]] = None,
**kwargs
):
"""
:keyword in_edit: Gets or sets whether runbook is in edit mode.
:paramtype in_edit: bool
:keyword draft_content_link: Gets or sets the draft runbook content link.
:paramtype draft_content_link: ~azure.mgmt.automation.models.ContentLink
:keyword creation_time: Gets or sets the creation time of the runbook draft.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time of the runbook draft.
:paramtype last_modified_time: ~datetime.datetime
:keyword parameters: Gets or sets the runbook draft parameters.
:paramtype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter]
:keyword output_types: Gets or sets the runbook output types.
:paramtype output_types: list[str]
"""
super(RunbookDraft, self).__init__(**kwargs)
self.in_edit = in_edit
self.draft_content_link = draft_content_link
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.parameters = parameters
self.output_types = output_types
class RunbookDraftUndoEditResult(msrest.serialization.Model):
"""The response model for the undo edit runbook operation.
:ivar status_code: Known values are: "Continue", "SwitchingProtocols", "OK", "Created",
"Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent",
"MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther",
"RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb",
"BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed",
"NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone",
"LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong",
"UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired",
"InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout",
"HttpVersionNotSupported".
:vartype status_code: str or ~azure.mgmt.automation.models.HttpStatusCode
:ivar request_id:
:vartype request_id: str
"""
_attribute_map = {
'status_code': {'key': 'statusCode', 'type': 'str'},
'request_id': {'key': 'requestId', 'type': 'str'},
}
def __init__(
self,
*,
status_code: Optional[Union[str, "_models.HttpStatusCode"]] = None,
request_id: Optional[str] = None,
**kwargs
):
"""
:keyword status_code: Known values are: "Continue", "SwitchingProtocols", "OK", "Created",
"Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent",
"MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther",
"RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb",
"BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed",
"NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone",
"LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong",
"UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired",
"InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout",
"HttpVersionNotSupported".
:paramtype status_code: str or ~azure.mgmt.automation.models.HttpStatusCode
:keyword request_id:
:paramtype request_id: str
"""
super(RunbookDraftUndoEditResult, self).__init__(**kwargs)
self.status_code = status_code
self.request_id = request_id
class RunbookListResult(msrest.serialization.Model):
"""The response model for the list runbook operation.
:ivar value: Gets or sets a list of runbooks.
:vartype value: list[~azure.mgmt.automation.models.Runbook]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Runbook]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Runbook"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of runbooks.
:paramtype value: list[~azure.mgmt.automation.models.Runbook]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(RunbookListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class RunbookParameter(msrest.serialization.Model):
"""Definition of the runbook parameter type.
:ivar type: Gets or sets the type of the parameter.
:vartype type: str
:ivar is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is mandatory
or not.
:vartype is_mandatory: bool
:ivar position: Get or sets the position of the parameter.
:vartype position: int
:ivar default_value: Gets or sets the default value of parameter.
:vartype default_value: str
"""
_attribute_map = {
'type': {'key': 'type', 'type': 'str'},
'is_mandatory': {'key': 'isMandatory', 'type': 'bool'},
'position': {'key': 'position', 'type': 'int'},
'default_value': {'key': 'defaultValue', 'type': 'str'},
}
def __init__(
self,
*,
type: Optional[str] = None,
is_mandatory: Optional[bool] = None,
position: Optional[int] = None,
default_value: Optional[str] = None,
**kwargs
):
"""
:keyword type: Gets or sets the type of the parameter.
:paramtype type: str
:keyword is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is
mandatory or not.
:paramtype is_mandatory: bool
:keyword position: Get or sets the position of the parameter.
:paramtype position: int
:keyword default_value: Gets or sets the default value of parameter.
:paramtype default_value: str
"""
super(RunbookParameter, self).__init__(**kwargs)
self.type = type
self.is_mandatory = is_mandatory
self.position = position
self.default_value = default_value
class RunbookUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update runbook operation.
:ivar name: Gets or sets the name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar description: Gets or sets the description of the runbook.
:vartype description: str
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar log_progress: Gets or sets progress log option.
:vartype log_progress: bool
:ivar log_activity_trace: Gets or sets the activity-level tracing options of the runbook.
:vartype log_activity_trace: int
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'description': {'key': 'properties.description', 'type': 'str'},
'log_verbose': {'key': 'properties.logVerbose', 'type': 'bool'},
'log_progress': {'key': 'properties.logProgress', 'type': 'bool'},
'log_activity_trace': {'key': 'properties.logActivityTrace', 'type': 'int'},
}
def __init__(
self,
*,
name: Optional[str] = None,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
description: Optional[str] = None,
log_verbose: Optional[bool] = None,
log_progress: Optional[bool] = None,
log_activity_trace: Optional[int] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword description: Gets or sets the description of the runbook.
:paramtype description: str
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword log_progress: Gets or sets progress log option.
:paramtype log_progress: bool
:keyword log_activity_trace: Gets or sets the activity-level tracing options of the runbook.
:paramtype log_activity_trace: int
"""
super(RunbookUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.tags = tags
self.description = description
self.log_verbose = log_verbose
self.log_progress = log_progress
self.log_activity_trace = log_activity_trace
class Schedule(ProxyResource):
"""Definition of the schedule.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar start_time: Gets or sets the start time of the schedule.
:vartype start_time: ~datetime.datetime
:ivar start_time_offset_minutes: Gets the start time's offset in minutes.
:vartype start_time_offset_minutes: float
:ivar expiry_time: Gets or sets the end time of the schedule.
:vartype expiry_time: ~datetime.datetime
:ivar expiry_time_offset_minutes: Gets or sets the expiry time's offset in minutes.
:vartype expiry_time_offset_minutes: float
:ivar is_enabled: Gets or sets a value indicating whether this schedule is enabled.
:vartype is_enabled: bool
:ivar next_run: Gets or sets the next run time of the schedule.
:vartype next_run: ~datetime.datetime
:ivar next_run_offset_minutes: Gets or sets the next run time's offset in minutes.
:vartype next_run_offset_minutes: float
:ivar interval: Gets or sets the interval of the schedule.
:vartype interval: any
:ivar frequency: Gets or sets the frequency of the schedule. Known values are: "OneTime",
"Day", "Hour", "Week", "Month", "Minute".
:vartype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:ivar time_zone: Gets or sets the time zone of the schedule.
:vartype time_zone: str
:ivar advanced_schedule: Gets or sets the advanced schedule.
:vartype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'start_time_offset_minutes': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'start_time_offset_minutes': {'key': 'properties.startTimeOffsetMinutes', 'type': 'float'},
'expiry_time': {'key': 'properties.expiryTime', 'type': 'iso-8601'},
'expiry_time_offset_minutes': {'key': 'properties.expiryTimeOffsetMinutes', 'type': 'float'},
'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'},
'next_run': {'key': 'properties.nextRun', 'type': 'iso-8601'},
'next_run_offset_minutes': {'key': 'properties.nextRunOffsetMinutes', 'type': 'float'},
'interval': {'key': 'properties.interval', 'type': 'object'},
'frequency': {'key': 'properties.frequency', 'type': 'str'},
'time_zone': {'key': 'properties.timeZone', 'type': 'str'},
'advanced_schedule': {'key': 'properties.advancedSchedule', 'type': 'AdvancedSchedule'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
start_time: Optional[datetime.datetime] = None,
expiry_time: Optional[datetime.datetime] = None,
expiry_time_offset_minutes: Optional[float] = None,
is_enabled: Optional[bool] = False,
next_run: Optional[datetime.datetime] = None,
next_run_offset_minutes: Optional[float] = None,
interval: Optional[Any] = None,
frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = None,
time_zone: Optional[str] = None,
advanced_schedule: Optional["_models.AdvancedSchedule"] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword start_time: Gets or sets the start time of the schedule.
:paramtype start_time: ~datetime.datetime
:keyword expiry_time: Gets or sets the end time of the schedule.
:paramtype expiry_time: ~datetime.datetime
:keyword expiry_time_offset_minutes: Gets or sets the expiry time's offset in minutes.
:paramtype expiry_time_offset_minutes: float
:keyword is_enabled: Gets or sets a value indicating whether this schedule is enabled.
:paramtype is_enabled: bool
:keyword next_run: Gets or sets the next run time of the schedule.
:paramtype next_run: ~datetime.datetime
:keyword next_run_offset_minutes: Gets or sets the next run time's offset in minutes.
:paramtype next_run_offset_minutes: float
:keyword interval: Gets or sets the interval of the schedule.
:paramtype interval: any
:keyword frequency: Gets or sets the frequency of the schedule. Known values are: "OneTime",
"Day", "Hour", "Week", "Month", "Minute".
:paramtype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:keyword time_zone: Gets or sets the time zone of the schedule.
:paramtype time_zone: str
:keyword advanced_schedule: Gets or sets the advanced schedule.
:paramtype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Schedule, self).__init__(**kwargs)
self.start_time = start_time
self.start_time_offset_minutes = None
self.expiry_time = expiry_time
self.expiry_time_offset_minutes = expiry_time_offset_minutes
self.is_enabled = is_enabled
self.next_run = next_run
self.next_run_offset_minutes = next_run_offset_minutes
self.interval = interval
self.frequency = frequency
self.time_zone = time_zone
self.advanced_schedule = advanced_schedule
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.description = description
class ScheduleAssociationProperty(msrest.serialization.Model):
"""The schedule property associated with the entity.
:ivar name: Gets or sets the name of the Schedule.
:vartype name: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the Schedule.
:paramtype name: str
"""
super(ScheduleAssociationProperty, self).__init__(**kwargs)
self.name = name
class ScheduleCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update schedule operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the Schedule.
:vartype name: str
:ivar description: Gets or sets the description of the schedule.
:vartype description: str
:ivar start_time: Required. Gets or sets the start time of the schedule.
:vartype start_time: ~datetime.datetime
:ivar expiry_time: Gets or sets the end time of the schedule.
:vartype expiry_time: ~datetime.datetime
:ivar interval: Gets or sets the interval of the schedule.
:vartype interval: any
:ivar frequency: Required. Gets or sets the frequency of the schedule. Known values are:
"OneTime", "Day", "Hour", "Week", "Month", "Minute".
:vartype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:ivar time_zone: Gets or sets the time zone of the schedule.
:vartype time_zone: str
:ivar advanced_schedule: Gets or sets the AdvancedSchedule.
:vartype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule
"""
_validation = {
'name': {'required': True},
'start_time': {'required': True},
'frequency': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'expiry_time': {'key': 'properties.expiryTime', 'type': 'iso-8601'},
'interval': {'key': 'properties.interval', 'type': 'object'},
'frequency': {'key': 'properties.frequency', 'type': 'str'},
'time_zone': {'key': 'properties.timeZone', 'type': 'str'},
'advanced_schedule': {'key': 'properties.advancedSchedule', 'type': 'AdvancedSchedule'},
}
def __init__(
self,
*,
name: str,
start_time: datetime.datetime,
frequency: Union[str, "_models.ScheduleFrequency"],
description: Optional[str] = None,
expiry_time: Optional[datetime.datetime] = None,
interval: Optional[Any] = None,
time_zone: Optional[str] = None,
advanced_schedule: Optional["_models.AdvancedSchedule"] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the Schedule.
:paramtype name: str
:keyword description: Gets or sets the description of the schedule.
:paramtype description: str
:keyword start_time: Required. Gets or sets the start time of the schedule.
:paramtype start_time: ~datetime.datetime
:keyword expiry_time: Gets or sets the end time of the schedule.
:paramtype expiry_time: ~datetime.datetime
:keyword interval: Gets or sets the interval of the schedule.
:paramtype interval: any
:keyword frequency: Required. Gets or sets the frequency of the schedule. Known values are:
"OneTime", "Day", "Hour", "Week", "Month", "Minute".
:paramtype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:keyword time_zone: Gets or sets the time zone of the schedule.
:paramtype time_zone: str
:keyword advanced_schedule: Gets or sets the AdvancedSchedule.
:paramtype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule
"""
super(ScheduleCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.description = description
self.start_time = start_time
self.expiry_time = expiry_time
self.interval = interval
self.frequency = frequency
self.time_zone = time_zone
self.advanced_schedule = advanced_schedule
class ScheduleListResult(msrest.serialization.Model):
"""The response model for the list schedule operation.
:ivar value: Gets or sets a list of schedules.
:vartype value: list[~azure.mgmt.automation.models.Schedule]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Schedule]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Schedule"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of schedules.
:paramtype value: list[~azure.mgmt.automation.models.Schedule]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(ScheduleListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class ScheduleUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update schedule operation.
:ivar name: Gets or sets the name of the Schedule.
:vartype name: str
:ivar description: Gets or sets the description of the schedule.
:vartype description: str
:ivar is_enabled: Gets or sets a value indicating whether this schedule is enabled.
:vartype is_enabled: bool
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'},
}
def __init__(
self,
*,
name: Optional[str] = None,
description: Optional[str] = None,
is_enabled: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the Schedule.
:paramtype name: str
:keyword description: Gets or sets the description of the schedule.
:paramtype description: str
:keyword is_enabled: Gets or sets a value indicating whether this schedule is enabled.
:paramtype is_enabled: bool
"""
super(ScheduleUpdateParameters, self).__init__(**kwargs)
self.name = name
self.description = description
self.is_enabled = is_enabled
class Sku(msrest.serialization.Model):
"""The account SKU.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the SKU name of the account. Known values are: "Free",
"Basic".
:vartype name: str or ~azure.mgmt.automation.models.SkuNameEnum
:ivar family: Gets or sets the SKU family.
:vartype family: str
:ivar capacity: Gets or sets the SKU capacity.
:vartype capacity: int
"""
_validation = {
'name': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'family': {'key': 'family', 'type': 'str'},
'capacity': {'key': 'capacity', 'type': 'int'},
}
def __init__(
self,
*,
name: Union[str, "_models.SkuNameEnum"],
family: Optional[str] = None,
capacity: Optional[int] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the SKU name of the account. Known values are: "Free",
"Basic".
:paramtype name: str or ~azure.mgmt.automation.models.SkuNameEnum
:keyword family: Gets or sets the SKU family.
:paramtype family: str
:keyword capacity: Gets or sets the SKU capacity.
:paramtype capacity: int
"""
super(Sku, self).__init__(**kwargs)
self.name = name
self.family = family
self.capacity = capacity
class SoftwareUpdateConfiguration(msrest.serialization.Model):
"""Software update configuration properties.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar name: Resource name.
:vartype name: str
:ivar id: Resource Id.
:vartype id: str
:ivar type: Resource type.
:vartype type: str
:ivar update_configuration: Required. update specific properties for the Software update
configuration.
:vartype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration
:ivar schedule_info: Required. Schedule information for the Software update configuration.
:vartype schedule_info: ~azure.mgmt.automation.models.SUCScheduleProperties
:ivar provisioning_state: Provisioning state for the software update configuration, which only
appears in the response.
:vartype provisioning_state: str
:ivar error: Details of provisioning error.
:vartype error: ~azure.mgmt.automation.models.ErrorResponse
:ivar creation_time: Creation time of the resource, which only appears in the response.
:vartype creation_time: ~datetime.datetime
:ivar created_by: CreatedBy property, which only appears in the response.
:vartype created_by: str
:ivar last_modified_time: Last time resource was modified, which only appears in the response.
:vartype last_modified_time: ~datetime.datetime
:ivar last_modified_by: LastModifiedBy property, which only appears in the response.
:vartype last_modified_by: str
:ivar tasks: Tasks information for the Software update configuration.
:vartype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks
"""
_validation = {
'name': {'readonly': True},
'id': {'readonly': True},
'type': {'readonly': True},
'update_configuration': {'required': True},
'schedule_info': {'required': True},
'provisioning_state': {'readonly': True},
'creation_time': {'readonly': True},
'created_by': {'readonly': True},
'last_modified_time': {'readonly': True},
'last_modified_by': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'update_configuration': {'key': 'properties.updateConfiguration', 'type': 'UpdateConfiguration'},
'schedule_info': {'key': 'properties.scheduleInfo', 'type': 'SUCScheduleProperties'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'error': {'key': 'properties.error', 'type': 'ErrorResponse'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'created_by': {'key': 'properties.createdBy', 'type': 'str'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'tasks': {'key': 'properties.tasks', 'type': 'SoftwareUpdateConfigurationTasks'},
}
def __init__(
self,
*,
update_configuration: "_models.UpdateConfiguration",
schedule_info: "_models.SUCScheduleProperties",
error: Optional["_models.ErrorResponse"] = None,
tasks: Optional["_models.SoftwareUpdateConfigurationTasks"] = None,
**kwargs
):
"""
:keyword update_configuration: Required. update specific properties for the Software update
configuration.
:paramtype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration
:keyword schedule_info: Required. Schedule information for the Software update configuration.
:paramtype schedule_info: ~azure.mgmt.automation.models.SUCScheduleProperties
:keyword error: Details of provisioning error.
:paramtype error: ~azure.mgmt.automation.models.ErrorResponse
:keyword tasks: Tasks information for the Software update configuration.
:paramtype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks
"""
super(SoftwareUpdateConfiguration, self).__init__(**kwargs)
self.name = None
self.id = None
self.type = None
self.update_configuration = update_configuration
self.schedule_info = schedule_info
self.provisioning_state = None
self.error = error
self.creation_time = None
self.created_by = None
self.last_modified_time = None
self.last_modified_by = None
self.tasks = tasks
class SoftwareUpdateConfigurationCollectionItem(msrest.serialization.Model):
"""Software update configuration collection item properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: Name of the software update configuration.
:vartype name: str
:ivar id: Resource Id of the software update configuration.
:vartype id: str
:ivar update_configuration: Update specific properties of the software update configuration.
:vartype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration
:ivar tasks: Pre and Post Tasks defined.
:vartype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks
:ivar frequency: execution frequency of the schedule associated with the software update
configuration. Known values are: "OneTime", "Day", "Hour", "Week", "Month", "Minute".
:vartype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:ivar start_time: the start time of the update.
:vartype start_time: ~datetime.datetime
:ivar creation_time: Creation time of the software update configuration, which only appears in
the response.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Last time software update configuration was modified, which only
appears in the response.
:vartype last_modified_time: ~datetime.datetime
:ivar provisioning_state: Provisioning state for the software update configuration, which only
appears in the response.
:vartype provisioning_state: str
:ivar next_run: ext run time of the update.
:vartype next_run: ~datetime.datetime
"""
_validation = {
'name': {'readonly': True},
'id': {'readonly': True},
'creation_time': {'readonly': True},
'last_modified_time': {'readonly': True},
'provisioning_state': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'update_configuration': {'key': 'properties.updateConfiguration', 'type': 'UpdateConfiguration'},
'tasks': {'key': 'properties.tasks', 'type': 'SoftwareUpdateConfigurationTasks'},
'frequency': {'key': 'properties.frequency', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'next_run': {'key': 'properties.nextRun', 'type': 'iso-8601'},
}
def __init__(
self,
*,
update_configuration: Optional["_models.UpdateConfiguration"] = None,
tasks: Optional["_models.SoftwareUpdateConfigurationTasks"] = None,
frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = None,
start_time: Optional[datetime.datetime] = None,
next_run: Optional[datetime.datetime] = None,
**kwargs
):
"""
:keyword update_configuration: Update specific properties of the software update configuration.
:paramtype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration
:keyword tasks: Pre and Post Tasks defined.
:paramtype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks
:keyword frequency: execution frequency of the schedule associated with the software update
configuration. Known values are: "OneTime", "Day", "Hour", "Week", "Month", "Minute".
:paramtype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:keyword start_time: the start time of the update.
:paramtype start_time: ~datetime.datetime
:keyword next_run: ext run time of the update.
:paramtype next_run: ~datetime.datetime
"""
super(SoftwareUpdateConfigurationCollectionItem, self).__init__(**kwargs)
self.name = None
self.id = None
self.update_configuration = update_configuration
self.tasks = tasks
self.frequency = frequency
self.start_time = start_time
self.creation_time = None
self.last_modified_time = None
self.provisioning_state = None
self.next_run = next_run
class SoftwareUpdateConfigurationListResult(msrest.serialization.Model):
"""result of listing all software update configuration.
:ivar value: outer object returned when listing all software update configurations.
:vartype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationCollectionItem]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[SoftwareUpdateConfigurationCollectionItem]'},
}
def __init__(
self,
*,
value: Optional[List["_models.SoftwareUpdateConfigurationCollectionItem"]] = None,
**kwargs
):
"""
:keyword value: outer object returned when listing all software update configurations.
:paramtype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationCollectionItem]
"""
super(SoftwareUpdateConfigurationListResult, self).__init__(**kwargs)
self.value = value
class SoftwareUpdateConfigurationMachineRun(msrest.serialization.Model):
"""Software update configuration machine run model.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: Name of the software update configuration machine run.
:vartype name: str
:ivar id: Resource Id of the software update configuration machine run.
:vartype id: str
:ivar target_computer: name of the updated computer.
:vartype target_computer: str
:ivar target_computer_type: type of the updated computer.
:vartype target_computer_type: str
:ivar software_update_configuration: software update configuration triggered this run.
:vartype software_update_configuration:
~azure.mgmt.automation.models.UpdateConfigurationNavigation
:ivar status: Status of the software update configuration machine run.
:vartype status: str
:ivar os_type: Operating system target of the software update configuration triggered this run.
:vartype os_type: str
:ivar correlation_id: correlation id of the software update configuration machine run.
:vartype correlation_id: str
:ivar source_computer_id: source computer id of the software update configuration machine run.
:vartype source_computer_id: str
:ivar start_time: Start time of the software update configuration machine run.
:vartype start_time: ~datetime.datetime
:ivar end_time: End time of the software update configuration machine run.
:vartype end_time: ~datetime.datetime
:ivar configured_duration: configured duration for the software update configuration run.
:vartype configured_duration: str
:ivar job: Job associated with the software update configuration machine run.
:vartype job: ~azure.mgmt.automation.models.JobNavigation
:ivar creation_time: Creation time of the resource, which only appears in the response.
:vartype creation_time: ~datetime.datetime
:ivar created_by: createdBy property, which only appears in the response.
:vartype created_by: str
:ivar last_modified_time: Last time resource was modified, which only appears in the response.
:vartype last_modified_time: ~datetime.datetime
:ivar last_modified_by: lastModifiedBy property, which only appears in the response.
:vartype last_modified_by: str
:ivar error: Details of provisioning error.
:vartype error: ~azure.mgmt.automation.models.ErrorResponse
"""
_validation = {
'name': {'readonly': True},
'id': {'readonly': True},
'target_computer': {'readonly': True},
'target_computer_type': {'readonly': True},
'status': {'readonly': True},
'os_type': {'readonly': True},
'correlation_id': {'readonly': True},
'source_computer_id': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
'configured_duration': {'readonly': True},
'creation_time': {'readonly': True},
'created_by': {'readonly': True},
'last_modified_time': {'readonly': True},
'last_modified_by': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'target_computer': {'key': 'properties.targetComputer', 'type': 'str'},
'target_computer_type': {'key': 'properties.targetComputerType', 'type': 'str'},
'software_update_configuration': {'key': 'properties.softwareUpdateConfiguration', 'type': 'UpdateConfigurationNavigation'},
'status': {'key': 'properties.status', 'type': 'str'},
'os_type': {'key': 'properties.osType', 'type': 'str'},
'correlation_id': {'key': 'properties.correlationId', 'type': 'str'},
'source_computer_id': {'key': 'properties.sourceComputerId', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'configured_duration': {'key': 'properties.configuredDuration', 'type': 'str'},
'job': {'key': 'properties.job', 'type': 'JobNavigation'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'created_by': {'key': 'properties.createdBy', 'type': 'str'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'error': {'key': 'properties.error', 'type': 'ErrorResponse'},
}
def __init__(
self,
*,
software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = None,
job: Optional["_models.JobNavigation"] = None,
error: Optional["_models.ErrorResponse"] = None,
**kwargs
):
"""
:keyword software_update_configuration: software update configuration triggered this run.
:paramtype software_update_configuration:
~azure.mgmt.automation.models.UpdateConfigurationNavigation
:keyword job: Job associated with the software update configuration machine run.
:paramtype job: ~azure.mgmt.automation.models.JobNavigation
:keyword error: Details of provisioning error.
:paramtype error: ~azure.mgmt.automation.models.ErrorResponse
"""
super(SoftwareUpdateConfigurationMachineRun, self).__init__(**kwargs)
self.name = None
self.id = None
self.target_computer = None
self.target_computer_type = None
self.software_update_configuration = software_update_configuration
self.status = None
self.os_type = None
self.correlation_id = None
self.source_computer_id = None
self.start_time = None
self.end_time = None
self.configured_duration = None
self.job = job
self.creation_time = None
self.created_by = None
self.last_modified_time = None
self.last_modified_by = None
self.error = error
class SoftwareUpdateConfigurationMachineRunListResult(msrest.serialization.Model):
"""result of listing all software update configuration machine runs.
:ivar value: outer object returned when listing all software update configuration machine runs.
:vartype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun]
:ivar next_link: link to next page of results.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[SoftwareUpdateConfigurationMachineRun]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.SoftwareUpdateConfigurationMachineRun"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: outer object returned when listing all software update configuration machine
runs.
:paramtype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun]
:keyword next_link: link to next page of results.
:paramtype next_link: str
"""
super(SoftwareUpdateConfigurationMachineRunListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class SoftwareUpdateConfigurationRun(msrest.serialization.Model):
"""Software update configuration Run properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: Name of the software update configuration run.
:vartype name: str
:ivar id: Resource Id of the software update configuration run.
:vartype id: str
:ivar software_update_configuration: software update configuration triggered this run.
:vartype software_update_configuration:
~azure.mgmt.automation.models.UpdateConfigurationNavigation
:ivar status: Status of the software update configuration run.
:vartype status: str
:ivar configured_duration: Configured duration for the software update configuration run.
:vartype configured_duration: str
:ivar os_type: Operating system target of the software update configuration triggered this run.
:vartype os_type: str
:ivar start_time: Start time of the software update configuration run.
:vartype start_time: ~datetime.datetime
:ivar end_time: End time of the software update configuration run.
:vartype end_time: ~datetime.datetime
:ivar computer_count: Number of computers in the software update configuration run.
:vartype computer_count: int
:ivar failed_count: Number of computers with failed status.
:vartype failed_count: int
:ivar creation_time: Creation time of the resource, which only appears in the response.
:vartype creation_time: ~datetime.datetime
:ivar created_by: CreatedBy property, which only appears in the response.
:vartype created_by: str
:ivar last_modified_time: Last time resource was modified, which only appears in the response.
:vartype last_modified_time: ~datetime.datetime
:ivar last_modified_by: LastModifiedBy property, which only appears in the response.
:vartype last_modified_by: str
:ivar tasks: Software update configuration tasks triggered in this run.
:vartype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTasks
"""
_validation = {
'name': {'readonly': True},
'id': {'readonly': True},
'status': {'readonly': True},
'configured_duration': {'readonly': True},
'os_type': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
'computer_count': {'readonly': True},
'failed_count': {'readonly': True},
'creation_time': {'readonly': True},
'created_by': {'readonly': True},
'last_modified_time': {'readonly': True},
'last_modified_by': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'software_update_configuration': {'key': 'properties.softwareUpdateConfiguration', 'type': 'UpdateConfigurationNavigation'},
'status': {'key': 'properties.status', 'type': 'str'},
'configured_duration': {'key': 'properties.configuredDuration', 'type': 'str'},
'os_type': {'key': 'properties.osType', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'computer_count': {'key': 'properties.computerCount', 'type': 'int'},
'failed_count': {'key': 'properties.failedCount', 'type': 'int'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'created_by': {'key': 'properties.createdBy', 'type': 'str'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'tasks': {'key': 'properties.tasks', 'type': 'SoftwareUpdateConfigurationRunTasks'},
}
def __init__(
self,
*,
software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = None,
tasks: Optional["_models.SoftwareUpdateConfigurationRunTasks"] = None,
**kwargs
):
"""
:keyword software_update_configuration: software update configuration triggered this run.
:paramtype software_update_configuration:
~azure.mgmt.automation.models.UpdateConfigurationNavigation
:keyword tasks: Software update configuration tasks triggered in this run.
:paramtype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTasks
"""
super(SoftwareUpdateConfigurationRun, self).__init__(**kwargs)
self.name = None
self.id = None
self.software_update_configuration = software_update_configuration
self.status = None
self.configured_duration = None
self.os_type = None
self.start_time = None
self.end_time = None
self.computer_count = None
self.failed_count = None
self.creation_time = None
self.created_by = None
self.last_modified_time = None
self.last_modified_by = None
self.tasks = tasks
class SoftwareUpdateConfigurationRunListResult(msrest.serialization.Model):
"""result of listing all software update configuration runs.
:ivar value: outer object returned when listing all software update configuration runs.
:vartype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun]
:ivar next_link: link to next page of results.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[SoftwareUpdateConfigurationRun]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.SoftwareUpdateConfigurationRun"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: outer object returned when listing all software update configuration runs.
:paramtype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun]
:keyword next_link: link to next page of results.
:paramtype next_link: str
"""
super(SoftwareUpdateConfigurationRunListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class SoftwareUpdateConfigurationRunTaskProperties(msrest.serialization.Model):
"""Task properties of the software update configuration.
:ivar status: The status of the task.
:vartype status: str
:ivar source: The name of the source of the task.
:vartype source: str
:ivar job_id: The job id of the task.
:vartype job_id: str
"""
_attribute_map = {
'status': {'key': 'status', 'type': 'str'},
'source': {'key': 'source', 'type': 'str'},
'job_id': {'key': 'jobId', 'type': 'str'},
}
def __init__(
self,
*,
status: Optional[str] = None,
source: Optional[str] = None,
job_id: Optional[str] = None,
**kwargs
):
"""
:keyword status: The status of the task.
:paramtype status: str
:keyword source: The name of the source of the task.
:paramtype source: str
:keyword job_id: The job id of the task.
:paramtype job_id: str
"""
super(SoftwareUpdateConfigurationRunTaskProperties, self).__init__(**kwargs)
self.status = status
self.source = source
self.job_id = job_id
class SoftwareUpdateConfigurationRunTasks(msrest.serialization.Model):
"""Software update configuration run tasks model.
:ivar pre_task: Pre task properties.
:vartype pre_task: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties
:ivar post_task: Post task properties.
:vartype post_task: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties
"""
_attribute_map = {
'pre_task': {'key': 'preTask', 'type': 'SoftwareUpdateConfigurationRunTaskProperties'},
'post_task': {'key': 'postTask', 'type': 'SoftwareUpdateConfigurationRunTaskProperties'},
}
def __init__(
self,
*,
pre_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = None,
post_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = None,
**kwargs
):
"""
:keyword pre_task: Pre task properties.
:paramtype pre_task: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties
:keyword post_task: Post task properties.
:paramtype post_task:
~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties
"""
super(SoftwareUpdateConfigurationRunTasks, self).__init__(**kwargs)
self.pre_task = pre_task
self.post_task = post_task
class SoftwareUpdateConfigurationTasks(msrest.serialization.Model):
"""Task properties of the software update configuration.
:ivar pre_task: Pre task properties.
:vartype pre_task: ~azure.mgmt.automation.models.TaskProperties
:ivar post_task: Post task properties.
:vartype post_task: ~azure.mgmt.automation.models.TaskProperties
"""
_attribute_map = {
'pre_task': {'key': 'preTask', 'type': 'TaskProperties'},
'post_task': {'key': 'postTask', 'type': 'TaskProperties'},
}
def __init__(
self,
*,
pre_task: Optional["_models.TaskProperties"] = None,
post_task: Optional["_models.TaskProperties"] = None,
**kwargs
):
"""
:keyword pre_task: Pre task properties.
:paramtype pre_task: ~azure.mgmt.automation.models.TaskProperties
:keyword post_task: Post task properties.
:paramtype post_task: ~azure.mgmt.automation.models.TaskProperties
"""
super(SoftwareUpdateConfigurationTasks, self).__init__(**kwargs)
self.pre_task = pre_task
self.post_task = post_task
class SourceControl(ProxyResource):
"""Definition of the source control.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar repo_url: The repo url of the source control.
:vartype repo_url: str
:ivar branch: The repo branch of the source control. Include branch as empty string for
VsoTfvc.
:vartype branch: str
:ivar folder_path: The folder path of the source control.
:vartype folder_path: str
:ivar auto_sync: The auto sync of the source control. Default is false.
:vartype auto_sync: bool
:ivar publish_runbook: The auto publish of the source control. Default is true.
:vartype publish_runbook: bool
:ivar source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub. Known values are:
"VsoGit", "VsoTfvc", "GitHub".
:vartype source_type: str or ~azure.mgmt.automation.models.SourceType
:ivar description: The description.
:vartype description: str
:ivar creation_time: The creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: The last modified time.
:vartype last_modified_time: ~datetime.datetime
"""
_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'},
'repo_url': {'key': 'properties.repoUrl', 'type': 'str'},
'branch': {'key': 'properties.branch', 'type': 'str'},
'folder_path': {'key': 'properties.folderPath', 'type': 'str'},
'auto_sync': {'key': 'properties.autoSync', 'type': 'bool'},
'publish_runbook': {'key': 'properties.publishRunbook', 'type': 'bool'},
'source_type': {'key': 'properties.sourceType', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
}
def __init__(
self,
*,
repo_url: Optional[str] = None,
branch: Optional[str] = None,
folder_path: Optional[str] = None,
auto_sync: Optional[bool] = None,
publish_runbook: Optional[bool] = None,
source_type: Optional[Union[str, "_models.SourceType"]] = None,
description: Optional[str] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
**kwargs
):
"""
:keyword repo_url: The repo url of the source control.
:paramtype repo_url: str
:keyword branch: The repo branch of the source control. Include branch as empty string for
VsoTfvc.
:paramtype branch: str
:keyword folder_path: The folder path of the source control.
:paramtype folder_path: str
:keyword auto_sync: The auto sync of the source control. Default is false.
:paramtype auto_sync: bool
:keyword publish_runbook: The auto publish of the source control. Default is true.
:paramtype publish_runbook: bool
:keyword source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub. Known values
are: "VsoGit", "VsoTfvc", "GitHub".
:paramtype source_type: str or ~azure.mgmt.automation.models.SourceType
:keyword description: The description.
:paramtype description: str
:keyword creation_time: The creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: The last modified time.
:paramtype last_modified_time: ~datetime.datetime
"""
super(SourceControl, self).__init__(**kwargs)
self.repo_url = repo_url
self.branch = branch
self.folder_path = folder_path
self.auto_sync = auto_sync
self.publish_runbook = publish_runbook
self.source_type = source_type
self.description = description
self.creation_time = creation_time
self.last_modified_time = last_modified_time
class SourceControlCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update source control operation.
:ivar repo_url: The repo url of the source control.
:vartype repo_url: str
:ivar branch: The repo branch of the source control. Include branch as empty string for
VsoTfvc.
:vartype branch: str
:ivar folder_path: The folder path of the source control. Path must be relative.
:vartype folder_path: str
:ivar auto_sync: The auto async of the source control. Default is false.
:vartype auto_sync: bool
:ivar publish_runbook: The auto publish of the source control. Default is true.
:vartype publish_runbook: bool
:ivar source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub, case sensitive.
Known values are: "VsoGit", "VsoTfvc", "GitHub".
:vartype source_type: str or ~azure.mgmt.automation.models.SourceType
:ivar security_token: The authorization token for the repo of the source control.
:vartype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties
:ivar description: The user description of the source control.
:vartype description: str
"""
_validation = {
'repo_url': {'max_length': 2000, 'min_length': 0},
'branch': {'max_length': 255, 'min_length': 0},
'folder_path': {'max_length': 255, 'min_length': 0},
'description': {'max_length': 512, 'min_length': 0},
}
_attribute_map = {
'repo_url': {'key': 'properties.repoUrl', 'type': 'str'},
'branch': {'key': 'properties.branch', 'type': 'str'},
'folder_path': {'key': 'properties.folderPath', 'type': 'str'},
'auto_sync': {'key': 'properties.autoSync', 'type': 'bool'},
'publish_runbook': {'key': 'properties.publishRunbook', 'type': 'bool'},
'source_type': {'key': 'properties.sourceType', 'type': 'str'},
'security_token': {'key': 'properties.securityToken', 'type': 'SourceControlSecurityTokenProperties'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
repo_url: Optional[str] = None,
branch: Optional[str] = None,
folder_path: Optional[str] = None,
auto_sync: Optional[bool] = None,
publish_runbook: Optional[bool] = None,
source_type: Optional[Union[str, "_models.SourceType"]] = None,
security_token: Optional["_models.SourceControlSecurityTokenProperties"] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword repo_url: The repo url of the source control.
:paramtype repo_url: str
:keyword branch: The repo branch of the source control. Include branch as empty string for
VsoTfvc.
:paramtype branch: str
:keyword folder_path: The folder path of the source control. Path must be relative.
:paramtype folder_path: str
:keyword auto_sync: The auto async of the source control. Default is false.
:paramtype auto_sync: bool
:keyword publish_runbook: The auto publish of the source control. Default is true.
:paramtype publish_runbook: bool
:keyword source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub, case sensitive.
Known values are: "VsoGit", "VsoTfvc", "GitHub".
:paramtype source_type: str or ~azure.mgmt.automation.models.SourceType
:keyword security_token: The authorization token for the repo of the source control.
:paramtype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties
:keyword description: The user description of the source control.
:paramtype description: str
"""
super(SourceControlCreateOrUpdateParameters, self).__init__(**kwargs)
self.repo_url = repo_url
self.branch = branch
self.folder_path = folder_path
self.auto_sync = auto_sync
self.publish_runbook = publish_runbook
self.source_type = source_type
self.security_token = security_token
self.description = description
class SourceControlListResult(msrest.serialization.Model):
"""The response model for the list source controls operation.
:ivar value: The list of source controls.
:vartype value: list[~azure.mgmt.automation.models.SourceControl]
:ivar next_link: The next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[SourceControl]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.SourceControl"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: The list of source controls.
:paramtype value: list[~azure.mgmt.automation.models.SourceControl]
:keyword next_link: The next link.
:paramtype next_link: str
"""
super(SourceControlListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class SourceControlSecurityTokenProperties(msrest.serialization.Model):
"""SourceControlSecurityTokenProperties.
:ivar access_token: The access token.
:vartype access_token: str
:ivar refresh_token: The refresh token.
:vartype refresh_token: str
:ivar token_type: The token type. Must be either PersonalAccessToken or Oauth. Known values
are: "PersonalAccessToken", "Oauth".
:vartype token_type: str or ~azure.mgmt.automation.models.TokenType
"""
_validation = {
'access_token': {'max_length': 1024, 'min_length': 0},
'refresh_token': {'max_length': 1024, 'min_length': 0},
}
_attribute_map = {
'access_token': {'key': 'accessToken', 'type': 'str'},
'refresh_token': {'key': 'refreshToken', 'type': 'str'},
'token_type': {'key': 'tokenType', 'type': 'str'},
}
def __init__(
self,
*,
access_token: Optional[str] = None,
refresh_token: Optional[str] = None,
token_type: Optional[Union[str, "_models.TokenType"]] = None,
**kwargs
):
"""
:keyword access_token: The access token.
:paramtype access_token: str
:keyword refresh_token: The refresh token.
:paramtype refresh_token: str
:keyword token_type: The token type. Must be either PersonalAccessToken or Oauth. Known values
are: "PersonalAccessToken", "Oauth".
:paramtype token_type: str or ~azure.mgmt.automation.models.TokenType
"""
super(SourceControlSecurityTokenProperties, self).__init__(**kwargs)
self.access_token = access_token
self.refresh_token = refresh_token
self.token_type = token_type
class SourceControlSyncJob(msrest.serialization.Model):
"""Definition of the source control sync job.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar id: Resource id.
:vartype id: str
:ivar source_control_sync_job_id: The source control sync job id.
:vartype source_control_sync_job_id: str
:ivar creation_time: The creation time of the job.
:vartype creation_time: ~datetime.datetime
:ivar provisioning_state: The provisioning state of the job. Known values are: "Completed",
"Failed", "Running".
:vartype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState
:ivar start_time: The start time of the job.
:vartype start_time: ~datetime.datetime
:ivar end_time: The end time of the job.
:vartype end_time: ~datetime.datetime
:ivar sync_type: The sync type. Known values are: "PartialSync", "FullSync".
:vartype sync_type: str or ~azure.mgmt.automation.models.SyncType
"""
_validation = {
'name': {'readonly': True},
'type': {'readonly': True},
'id': {'readonly': True},
'creation_time': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'source_control_sync_job_id': {'key': 'properties.sourceControlSyncJobId', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'sync_type': {'key': 'properties.syncType', 'type': 'str'},
}
def __init__(
self,
*,
source_control_sync_job_id: Optional[str] = None,
provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None,
sync_type: Optional[Union[str, "_models.SyncType"]] = None,
**kwargs
):
"""
:keyword source_control_sync_job_id: The source control sync job id.
:paramtype source_control_sync_job_id: str
:keyword provisioning_state: The provisioning state of the job. Known values are: "Completed",
"Failed", "Running".
:paramtype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState
:keyword sync_type: The sync type. Known values are: "PartialSync", "FullSync".
:paramtype sync_type: str or ~azure.mgmt.automation.models.SyncType
"""
super(SourceControlSyncJob, self).__init__(**kwargs)
self.name = None
self.type = None
self.id = None
self.source_control_sync_job_id = source_control_sync_job_id
self.creation_time = None
self.provisioning_state = provisioning_state
self.start_time = None
self.end_time = None
self.sync_type = sync_type
class SourceControlSyncJobById(msrest.serialization.Model):
"""Definition of the source control sync job.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The id of the job.
:vartype id: str
:ivar source_control_sync_job_id: The source control sync job id.
:vartype source_control_sync_job_id: str
:ivar creation_time: The creation time of the job.
:vartype creation_time: ~datetime.datetime
:ivar provisioning_state: The provisioning state of the job. Known values are: "Completed",
"Failed", "Running".
:vartype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState
:ivar start_time: The start time of the job.
:vartype start_time: ~datetime.datetime
:ivar end_time: The end time of the job.
:vartype end_time: ~datetime.datetime
:ivar sync_type: The sync type. Known values are: "PartialSync", "FullSync".
:vartype sync_type: str or ~azure.mgmt.automation.models.SyncType
:ivar exception: The exceptions that occurred while running the sync job.
:vartype exception: str
"""
_validation = {
'creation_time': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'source_control_sync_job_id': {'key': 'properties.sourceControlSyncJobId', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'sync_type': {'key': 'properties.syncType', 'type': 'str'},
'exception': {'key': 'properties.exception', 'type': 'str'},
}
def __init__(
self,
*,
id: Optional[str] = None,
source_control_sync_job_id: Optional[str] = None,
provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None,
sync_type: Optional[Union[str, "_models.SyncType"]] = None,
exception: Optional[str] = None,
**kwargs
):
"""
:keyword id: The id of the job.
:paramtype id: str
:keyword source_control_sync_job_id: The source control sync job id.
:paramtype source_control_sync_job_id: str
:keyword provisioning_state: The provisioning state of the job. Known values are: "Completed",
"Failed", "Running".
:paramtype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState
:keyword sync_type: The sync type. Known values are: "PartialSync", "FullSync".
:paramtype sync_type: str or ~azure.mgmt.automation.models.SyncType
:keyword exception: The exceptions that occurred while running the sync job.
:paramtype exception: str
"""
super(SourceControlSyncJobById, self).__init__(**kwargs)
self.id = id
self.source_control_sync_job_id = source_control_sync_job_id
self.creation_time = None
self.provisioning_state = provisioning_state
self.start_time = None
self.end_time = None
self.sync_type = sync_type
self.exception = exception
class SourceControlSyncJobCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create source control sync job operation.
All required parameters must be populated in order to send to Azure.
:ivar commit_id: Required. The commit id of the source control sync job. If not syncing to a
commitId, enter an empty string.
:vartype commit_id: str
"""
_validation = {
'commit_id': {'required': True},
}
_attribute_map = {
'commit_id': {'key': 'properties.commitId', 'type': 'str'},
}
def __init__(
self,
*,
commit_id: str,
**kwargs
):
"""
:keyword commit_id: Required. The commit id of the source control sync job. If not syncing to a
commitId, enter an empty string.
:paramtype commit_id: str
"""
super(SourceControlSyncJobCreateParameters, self).__init__(**kwargs)
self.commit_id = commit_id
class SourceControlSyncJobListResult(msrest.serialization.Model):
"""The response model for the list source control sync jobs operation.
:ivar value: The list of source control sync jobs.
:vartype value: list[~azure.mgmt.automation.models.SourceControlSyncJob]
:ivar next_link: The next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[SourceControlSyncJob]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.SourceControlSyncJob"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: The list of source control sync jobs.
:paramtype value: list[~azure.mgmt.automation.models.SourceControlSyncJob]
:keyword next_link: The next link.
:paramtype next_link: str
"""
super(SourceControlSyncJobListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class SourceControlSyncJobStream(msrest.serialization.Model):
"""Definition of the source control sync job stream.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource id.
:vartype id: str
:ivar source_control_sync_job_stream_id: The sync job stream id.
:vartype source_control_sync_job_stream_id: str
:ivar summary: The summary of the sync job stream.
:vartype summary: str
:ivar time: The time of the sync job stream.
:vartype time: ~datetime.datetime
:ivar stream_type: The type of the sync job stream. Known values are: "Error", "Output".
:vartype stream_type: str or ~azure.mgmt.automation.models.StreamType
"""
_validation = {
'id': {'readonly': True},
'time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'source_control_sync_job_stream_id': {'key': 'properties.sourceControlSyncJobStreamId', 'type': 'str'},
'summary': {'key': 'properties.summary', 'type': 'str'},
'time': {'key': 'properties.time', 'type': 'iso-8601'},
'stream_type': {'key': 'properties.streamType', 'type': 'str'},
}
def __init__(
self,
*,
source_control_sync_job_stream_id: Optional[str] = None,
summary: Optional[str] = None,
stream_type: Optional[Union[str, "_models.StreamType"]] = None,
**kwargs
):
"""
:keyword source_control_sync_job_stream_id: The sync job stream id.
:paramtype source_control_sync_job_stream_id: str
:keyword summary: The summary of the sync job stream.
:paramtype summary: str
:keyword stream_type: The type of the sync job stream. Known values are: "Error", "Output".
:paramtype stream_type: str or ~azure.mgmt.automation.models.StreamType
"""
super(SourceControlSyncJobStream, self).__init__(**kwargs)
self.id = None
self.source_control_sync_job_stream_id = source_control_sync_job_stream_id
self.summary = summary
self.time = None
self.stream_type = stream_type
class SourceControlSyncJobStreamById(msrest.serialization.Model):
"""Definition of the source control sync job stream by id.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource id.
:vartype id: str
:ivar source_control_sync_job_stream_id: The sync job stream id.
:vartype source_control_sync_job_stream_id: str
:ivar summary: The summary of the sync job stream.
:vartype summary: str
:ivar time: The time of the sync job stream.
:vartype time: ~datetime.datetime
:ivar stream_type: The type of the sync job stream. Known values are: "Error", "Output".
:vartype stream_type: str or ~azure.mgmt.automation.models.StreamType
:ivar stream_text: The text of the sync job stream.
:vartype stream_text: str
:ivar value: The values of the job stream.
:vartype value: dict[str, any]
"""
_validation = {
'id': {'readonly': True},
'time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'source_control_sync_job_stream_id': {'key': 'properties.sourceControlSyncJobStreamId', 'type': 'str'},
'summary': {'key': 'properties.summary', 'type': 'str'},
'time': {'key': 'properties.time', 'type': 'iso-8601'},
'stream_type': {'key': 'properties.streamType', 'type': 'str'},
'stream_text': {'key': 'properties.streamText', 'type': 'str'},
'value': {'key': 'properties.value', 'type': '{object}'},
}
def __init__(
self,
*,
source_control_sync_job_stream_id: Optional[str] = None,
summary: Optional[str] = None,
stream_type: Optional[Union[str, "_models.StreamType"]] = None,
stream_text: Optional[str] = None,
value: Optional[Dict[str, Any]] = None,
**kwargs
):
"""
:keyword source_control_sync_job_stream_id: The sync job stream id.
:paramtype source_control_sync_job_stream_id: str
:keyword summary: The summary of the sync job stream.
:paramtype summary: str
:keyword stream_type: The type of the sync job stream. Known values are: "Error", "Output".
:paramtype stream_type: str or ~azure.mgmt.automation.models.StreamType
:keyword stream_text: The text of the sync job stream.
:paramtype stream_text: str
:keyword value: The values of the job stream.
:paramtype value: dict[str, any]
"""
super(SourceControlSyncJobStreamById, self).__init__(**kwargs)
self.id = None
self.source_control_sync_job_stream_id = source_control_sync_job_stream_id
self.summary = summary
self.time = None
self.stream_type = stream_type
self.stream_text = stream_text
self.value = value
class SourceControlSyncJobStreamsListBySyncJob(msrest.serialization.Model):
"""The response model for the list source control sync job streams operation.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The list of source control sync job streams.
:vartype value: list[~azure.mgmt.automation.models.SourceControlSyncJobStream]
:ivar next_link: The next link.
:vartype next_link: str
"""
_validation = {
'next_link': {'readonly': True},
}
_attribute_map = {
'value': {'key': 'value', 'type': '[SourceControlSyncJobStream]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.SourceControlSyncJobStream"]] = None,
**kwargs
):
"""
:keyword value: The list of source control sync job streams.
:paramtype value: list[~azure.mgmt.automation.models.SourceControlSyncJobStream]
"""
super(SourceControlSyncJobStreamsListBySyncJob, self).__init__(**kwargs)
self.value = value
self.next_link = None
class SourceControlUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update source control operation.
:ivar branch: The repo branch of the source control.
:vartype branch: str
:ivar folder_path: The folder path of the source control. Path must be relative.
:vartype folder_path: str
:ivar auto_sync: The auto sync of the source control. Default is false.
:vartype auto_sync: bool
:ivar publish_runbook: The auto publish of the source control. Default is true.
:vartype publish_runbook: bool
:ivar security_token: The authorization token for the repo of the source control.
:vartype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties
:ivar description: The user description of the source control.
:vartype description: str
"""
_attribute_map = {
'branch': {'key': 'properties.branch', 'type': 'str'},
'folder_path': {'key': 'properties.folderPath', 'type': 'str'},
'auto_sync': {'key': 'properties.autoSync', 'type': 'bool'},
'publish_runbook': {'key': 'properties.publishRunbook', 'type': 'bool'},
'security_token': {'key': 'properties.securityToken', 'type': 'SourceControlSecurityTokenProperties'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
branch: Optional[str] = None,
folder_path: Optional[str] = None,
auto_sync: Optional[bool] = None,
publish_runbook: Optional[bool] = None,
security_token: Optional["_models.SourceControlSecurityTokenProperties"] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword branch: The repo branch of the source control.
:paramtype branch: str
:keyword folder_path: The folder path of the source control. Path must be relative.
:paramtype folder_path: str
:keyword auto_sync: The auto sync of the source control. Default is false.
:paramtype auto_sync: bool
:keyword publish_runbook: The auto publish of the source control. Default is true.
:paramtype publish_runbook: bool
:keyword security_token: The authorization token for the repo of the source control.
:paramtype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties
:keyword description: The user description of the source control.
:paramtype description: str
"""
super(SourceControlUpdateParameters, self).__init__(**kwargs)
self.branch = branch
self.folder_path = folder_path
self.auto_sync = auto_sync
self.publish_runbook = publish_runbook
self.security_token = security_token
self.description = description
class Statistics(msrest.serialization.Model):
"""Definition of the statistic.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar counter_property: Gets the property value of the statistic.
:vartype counter_property: str
:ivar counter_value: Gets the value of the statistic.
:vartype counter_value: long
:ivar start_time: Gets the startTime of the statistic.
:vartype start_time: ~datetime.datetime
:ivar end_time: Gets the endTime of the statistic.
:vartype end_time: ~datetime.datetime
:ivar id: Gets the id.
:vartype id: str
"""
_validation = {
'counter_property': {'readonly': True},
'counter_value': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
'id': {'readonly': True},
}
_attribute_map = {
'counter_property': {'key': 'counterProperty', 'type': 'str'},
'counter_value': {'key': 'counterValue', 'type': 'long'},
'start_time': {'key': 'startTime', 'type': 'iso-8601'},
'end_time': {'key': 'endTime', 'type': 'iso-8601'},
'id': {'key': 'id', 'type': 'str'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(Statistics, self).__init__(**kwargs)
self.counter_property = None
self.counter_value = None
self.start_time = None
self.end_time = None
self.id = None
class StatisticsListResult(msrest.serialization.Model):
"""The response model for the list statistics operation.
:ivar value: Gets or sets a list of statistics.
:vartype value: list[~azure.mgmt.automation.models.Statistics]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Statistics]'},
}
def __init__(
self,
*,
value: Optional[List["_models.Statistics"]] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of statistics.
:paramtype value: list[~azure.mgmt.automation.models.Statistics]
"""
super(StatisticsListResult, self).__init__(**kwargs)
self.value = value
class SUCScheduleProperties(msrest.serialization.Model):
"""Definition of schedule parameters.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar start_time: Gets or sets the start time of the schedule.
:vartype start_time: ~datetime.datetime
:ivar start_time_offset_minutes: Gets the start time's offset in minutes.
:vartype start_time_offset_minutes: float
:ivar expiry_time: Gets or sets the end time of the schedule.
:vartype expiry_time: ~datetime.datetime
:ivar expiry_time_offset_minutes: Gets or sets the expiry time's offset in minutes.
:vartype expiry_time_offset_minutes: float
:ivar is_enabled: Gets or sets a value indicating whether this schedule is enabled.
:vartype is_enabled: bool
:ivar next_run: Gets or sets the next run time of the schedule.
:vartype next_run: ~datetime.datetime
:ivar next_run_offset_minutes: Gets or sets the next run time's offset in minutes.
:vartype next_run_offset_minutes: float
:ivar interval: Gets or sets the interval of the schedule.
:vartype interval: long
:ivar frequency: Gets or sets the frequency of the schedule. Known values are: "OneTime",
"Day", "Hour", "Week", "Month", "Minute".
:vartype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:ivar time_zone: Gets or sets the time zone of the schedule.
:vartype time_zone: str
:ivar advanced_schedule: Gets or sets the advanced schedule.
:vartype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'start_time_offset_minutes': {'readonly': True},
}
_attribute_map = {
'start_time': {'key': 'startTime', 'type': 'iso-8601'},
'start_time_offset_minutes': {'key': 'startTimeOffsetMinutes', 'type': 'float'},
'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'},
'expiry_time_offset_minutes': {'key': 'expiryTimeOffsetMinutes', 'type': 'float'},
'is_enabled': {'key': 'isEnabled', 'type': 'bool'},
'next_run': {'key': 'nextRun', 'type': 'iso-8601'},
'next_run_offset_minutes': {'key': 'nextRunOffsetMinutes', 'type': 'float'},
'interval': {'key': 'interval', 'type': 'long'},
'frequency': {'key': 'frequency', 'type': 'str'},
'time_zone': {'key': 'timeZone', 'type': 'str'},
'advanced_schedule': {'key': 'advancedSchedule', 'type': 'AdvancedSchedule'},
'creation_time': {'key': 'creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'description', 'type': 'str'},
}
def __init__(
self,
*,
start_time: Optional[datetime.datetime] = None,
expiry_time: Optional[datetime.datetime] = None,
expiry_time_offset_minutes: Optional[float] = None,
is_enabled: Optional[bool] = False,
next_run: Optional[datetime.datetime] = None,
next_run_offset_minutes: Optional[float] = None,
interval: Optional[int] = None,
frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = None,
time_zone: Optional[str] = None,
advanced_schedule: Optional["_models.AdvancedSchedule"] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword start_time: Gets or sets the start time of the schedule.
:paramtype start_time: ~datetime.datetime
:keyword expiry_time: Gets or sets the end time of the schedule.
:paramtype expiry_time: ~datetime.datetime
:keyword expiry_time_offset_minutes: Gets or sets the expiry time's offset in minutes.
:paramtype expiry_time_offset_minutes: float
:keyword is_enabled: Gets or sets a value indicating whether this schedule is enabled.
:paramtype is_enabled: bool
:keyword next_run: Gets or sets the next run time of the schedule.
:paramtype next_run: ~datetime.datetime
:keyword next_run_offset_minutes: Gets or sets the next run time's offset in minutes.
:paramtype next_run_offset_minutes: float
:keyword interval: Gets or sets the interval of the schedule.
:paramtype interval: long
:keyword frequency: Gets or sets the frequency of the schedule. Known values are: "OneTime",
"Day", "Hour", "Week", "Month", "Minute".
:paramtype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:keyword time_zone: Gets or sets the time zone of the schedule.
:paramtype time_zone: str
:keyword advanced_schedule: Gets or sets the advanced schedule.
:paramtype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(SUCScheduleProperties, self).__init__(**kwargs)
self.start_time = start_time
self.start_time_offset_minutes = None
self.expiry_time = expiry_time
self.expiry_time_offset_minutes = expiry_time_offset_minutes
self.is_enabled = is_enabled
self.next_run = next_run
self.next_run_offset_minutes = next_run_offset_minutes
self.interval = interval
self.frequency = frequency
self.time_zone = time_zone
self.advanced_schedule = advanced_schedule
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.description = description
class SystemData(msrest.serialization.Model):
"""Metadata pertaining to creation and last modification of the resource.
:ivar created_by: The identity that created the resource.
:vartype created_by: str
:ivar created_by_type: The type of identity that created the resource. Known values are:
"User", "Application", "ManagedIdentity", "Key".
:vartype created_by_type: str or ~azure.mgmt.automation.models.CreatedByType
:ivar created_at: The timestamp of resource creation (UTC).
:vartype created_at: ~datetime.datetime
:ivar last_modified_by: The identity that last modified the resource.
:vartype last_modified_by: str
:ivar last_modified_by_type: The type of identity that last modified the resource. Known values
are: "User", "Application", "ManagedIdentity", "Key".
:vartype last_modified_by_type: str or ~azure.mgmt.automation.models.CreatedByType
:ivar last_modified_at: The timestamp of resource last modification (UTC).
:vartype last_modified_at: ~datetime.datetime
"""
_attribute_map = {
'created_by': {'key': 'createdBy', 'type': 'str'},
'created_by_type': {'key': 'createdByType', 'type': 'str'},
'created_at': {'key': 'createdAt', 'type': 'iso-8601'},
'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'},
'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'},
'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'},
}
def __init__(
self,
*,
created_by: Optional[str] = None,
created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
created_at: Optional[datetime.datetime] = None,
last_modified_by: Optional[str] = None,
last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
last_modified_at: Optional[datetime.datetime] = None,
**kwargs
):
"""
:keyword created_by: The identity that created the resource.
:paramtype created_by: str
:keyword created_by_type: The type of identity that created the resource. Known values are:
"User", "Application", "ManagedIdentity", "Key".
:paramtype created_by_type: str or ~azure.mgmt.automation.models.CreatedByType
:keyword created_at: The timestamp of resource creation (UTC).
:paramtype created_at: ~datetime.datetime
:keyword last_modified_by: The identity that last modified the resource.
:paramtype last_modified_by: str
:keyword last_modified_by_type: The type of identity that last modified the resource. Known
values are: "User", "Application", "ManagedIdentity", "Key".
:paramtype last_modified_by_type: str or ~azure.mgmt.automation.models.CreatedByType
:keyword last_modified_at: The timestamp of resource last modification (UTC).
:paramtype last_modified_at: ~datetime.datetime
"""
super(SystemData, self).__init__(**kwargs)
self.created_by = created_by
self.created_by_type = created_by_type
self.created_at = created_at
self.last_modified_by = last_modified_by
self.last_modified_by_type = last_modified_by_type
self.last_modified_at = last_modified_at
class TagSettingsProperties(msrest.serialization.Model):
"""Tag filter information for the VM.
:ivar tags: A set of tags. Dictionary of tags with its list of values.
:vartype tags: dict[str, list[str]]
:ivar filter_operator: Filter VMs by Any or All specified tags. Known values are: "All", "Any".
:vartype filter_operator: str or ~azure.mgmt.automation.models.TagOperators
"""
_attribute_map = {
'tags': {'key': 'tags', 'type': '{[str]}'},
'filter_operator': {'key': 'filterOperator', 'type': 'str'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, List[str]]] = None,
filter_operator: Optional[Union[str, "_models.TagOperators"]] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Dictionary of tags with its list of values.
:paramtype tags: dict[str, list[str]]
:keyword filter_operator: Filter VMs by Any or All specified tags. Known values are: "All",
"Any".
:paramtype filter_operator: str or ~azure.mgmt.automation.models.TagOperators
"""
super(TagSettingsProperties, self).__init__(**kwargs)
self.tags = tags
self.filter_operator = filter_operator
class TargetProperties(msrest.serialization.Model):
"""Group specific to the update configuration.
:ivar azure_queries: List of Azure queries in the software update configuration.
:vartype azure_queries: list[~azure.mgmt.automation.models.AzureQueryProperties]
:ivar non_azure_queries: List of non Azure queries in the software update configuration.
:vartype non_azure_queries: list[~azure.mgmt.automation.models.NonAzureQueryProperties]
"""
_attribute_map = {
'azure_queries': {'key': 'azureQueries', 'type': '[AzureQueryProperties]'},
'non_azure_queries': {'key': 'nonAzureQueries', 'type': '[NonAzureQueryProperties]'},
}
def __init__(
self,
*,
azure_queries: Optional[List["_models.AzureQueryProperties"]] = None,
non_azure_queries: Optional[List["_models.NonAzureQueryProperties"]] = None,
**kwargs
):
"""
:keyword azure_queries: List of Azure queries in the software update configuration.
:paramtype azure_queries: list[~azure.mgmt.automation.models.AzureQueryProperties]
:keyword non_azure_queries: List of non Azure queries in the software update configuration.
:paramtype non_azure_queries: list[~azure.mgmt.automation.models.NonAzureQueryProperties]
"""
super(TargetProperties, self).__init__(**kwargs)
self.azure_queries = azure_queries
self.non_azure_queries = non_azure_queries
class TaskProperties(msrest.serialization.Model):
"""Task properties of the software update configuration.
:ivar parameters: Gets or sets the parameters of the task.
:vartype parameters: dict[str, str]
:ivar source: Gets or sets the name of the runbook.
:vartype source: str
"""
_attribute_map = {
'parameters': {'key': 'parameters', 'type': '{str}'},
'source': {'key': 'source', 'type': 'str'},
}
def __init__(
self,
*,
parameters: Optional[Dict[str, str]] = None,
source: Optional[str] = None,
**kwargs
):
"""
:keyword parameters: Gets or sets the parameters of the task.
:paramtype parameters: dict[str, str]
:keyword source: Gets or sets the name of the runbook.
:paramtype source: str
"""
super(TaskProperties, self).__init__(**kwargs)
self.parameters = parameters
self.source = source
class TestJob(msrest.serialization.Model):
"""Definition of the test job.
:ivar creation_time: Gets or sets the creation time of the test job.
:vartype creation_time: ~datetime.datetime
:ivar status: Gets or sets the status of the test job.
:vartype status: str
:ivar status_details: Gets or sets the status details of the test job.
:vartype status_details: str
:ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:vartype run_on: str
:ivar start_time: Gets or sets the start time of the test job.
:vartype start_time: ~datetime.datetime
:ivar end_time: Gets or sets the end time of the test job.
:vartype end_time: ~datetime.datetime
:ivar exception: Gets or sets the exception of the test job.
:vartype exception: str
:ivar last_modified_time: Gets or sets the last modified time of the test job.
:vartype last_modified_time: ~datetime.datetime
:ivar last_status_modified_time: Gets or sets the last status modified time of the test job.
:vartype last_status_modified_time: ~datetime.datetime
:ivar parameters: Gets or sets the parameters of the test job.
:vartype parameters: dict[str, str]
:ivar log_activity_trace: The activity-level tracing options of the runbook.
:vartype log_activity_trace: int
"""
_attribute_map = {
'creation_time': {'key': 'creationTime', 'type': 'iso-8601'},
'status': {'key': 'status', 'type': 'str'},
'status_details': {'key': 'statusDetails', 'type': 'str'},
'run_on': {'key': 'runOn', 'type': 'str'},
'start_time': {'key': 'startTime', 'type': 'iso-8601'},
'end_time': {'key': 'endTime', 'type': 'iso-8601'},
'exception': {'key': 'exception', 'type': 'str'},
'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'},
'last_status_modified_time': {'key': 'lastStatusModifiedTime', 'type': 'iso-8601'},
'parameters': {'key': 'parameters', 'type': '{str}'},
'log_activity_trace': {'key': 'logActivityTrace', 'type': 'int'},
}
def __init__(
self,
*,
creation_time: Optional[datetime.datetime] = None,
status: Optional[str] = None,
status_details: Optional[str] = None,
run_on: Optional[str] = None,
start_time: Optional[datetime.datetime] = None,
end_time: Optional[datetime.datetime] = None,
exception: Optional[str] = None,
last_modified_time: Optional[datetime.datetime] = None,
last_status_modified_time: Optional[datetime.datetime] = None,
parameters: Optional[Dict[str, str]] = None,
log_activity_trace: Optional[int] = None,
**kwargs
):
"""
:keyword creation_time: Gets or sets the creation time of the test job.
:paramtype creation_time: ~datetime.datetime
:keyword status: Gets or sets the status of the test job.
:paramtype status: str
:keyword status_details: Gets or sets the status details of the test job.
:paramtype status_details: str
:keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:paramtype run_on: str
:keyword start_time: Gets or sets the start time of the test job.
:paramtype start_time: ~datetime.datetime
:keyword end_time: Gets or sets the end time of the test job.
:paramtype end_time: ~datetime.datetime
:keyword exception: Gets or sets the exception of the test job.
:paramtype exception: str
:keyword last_modified_time: Gets or sets the last modified time of the test job.
:paramtype last_modified_time: ~datetime.datetime
:keyword last_status_modified_time: Gets or sets the last status modified time of the test job.
:paramtype last_status_modified_time: ~datetime.datetime
:keyword parameters: Gets or sets the parameters of the test job.
:paramtype parameters: dict[str, str]
:keyword log_activity_trace: The activity-level tracing options of the runbook.
:paramtype log_activity_trace: int
"""
super(TestJob, self).__init__(**kwargs)
self.creation_time = creation_time
self.status = status
self.status_details = status_details
self.run_on = run_on
self.start_time = start_time
self.end_time = end_time
self.exception = exception
self.last_modified_time = last_modified_time
self.last_status_modified_time = last_status_modified_time
self.parameters = parameters
self.log_activity_trace = log_activity_trace
class TestJobCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create test job operation.
:ivar parameters: Gets or sets the parameters of the test job.
:vartype parameters: dict[str, str]
:ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:vartype run_on: str
"""
_attribute_map = {
'parameters': {'key': 'parameters', 'type': '{str}'},
'run_on': {'key': 'runOn', 'type': 'str'},
}
def __init__(
self,
*,
parameters: Optional[Dict[str, str]] = None,
run_on: Optional[str] = None,
**kwargs
):
"""
:keyword parameters: Gets or sets the parameters of the test job.
:paramtype parameters: dict[str, str]
:keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:paramtype run_on: str
"""
super(TestJobCreateParameters, self).__init__(**kwargs)
self.parameters = parameters
self.run_on = run_on
class TypeField(msrest.serialization.Model):
"""Information about a field of a type.
:ivar name: Gets or sets the name of the field.
:vartype name: str
:ivar type: Gets or sets the type of the field.
:vartype type: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
type: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the field.
:paramtype name: str
:keyword type: Gets or sets the type of the field.
:paramtype type: str
"""
super(TypeField, self).__init__(**kwargs)
self.name = name
self.type = type
class TypeFieldListResult(msrest.serialization.Model):
"""The response model for the list fields operation.
:ivar value: Gets or sets a list of fields.
:vartype value: list[~azure.mgmt.automation.models.TypeField]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[TypeField]'},
}
def __init__(
self,
*,
value: Optional[List["_models.TypeField"]] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of fields.
:paramtype value: list[~azure.mgmt.automation.models.TypeField]
"""
super(TypeFieldListResult, self).__init__(**kwargs)
self.value = value
class UpdateConfiguration(msrest.serialization.Model):
"""Update specific properties of the software update configuration.
All required parameters must be populated in order to send to Azure.
:ivar operating_system: Required. operating system of target machines. Known values are:
"Windows", "Linux".
:vartype operating_system: str or ~azure.mgmt.automation.models.OperatingSystemType
:ivar windows: Windows specific update configuration.
:vartype windows: ~azure.mgmt.automation.models.WindowsProperties
:ivar linux: Linux specific update configuration.
:vartype linux: ~azure.mgmt.automation.models.LinuxProperties
:ivar duration: Maximum time allowed for the software update configuration run. Duration needs
to be specified using the format PT[n]H[n]M[n]S as per ISO8601.
:vartype duration: ~datetime.timedelta
:ivar azure_virtual_machines: List of azure resource Ids for azure virtual machines targeted by
the software update configuration.
:vartype azure_virtual_machines: list[str]
:ivar non_azure_computer_names: List of names of non-azure machines targeted by the software
update configuration.
:vartype non_azure_computer_names: list[str]
:ivar targets: Group targets for the software update configuration.
:vartype targets: ~azure.mgmt.automation.models.TargetProperties
"""
_validation = {
'operating_system': {'required': True},
}
_attribute_map = {
'operating_system': {'key': 'operatingSystem', 'type': 'str'},
'windows': {'key': 'windows', 'type': 'WindowsProperties'},
'linux': {'key': 'linux', 'type': 'LinuxProperties'},
'duration': {'key': 'duration', 'type': 'duration'},
'azure_virtual_machines': {'key': 'azureVirtualMachines', 'type': '[str]'},
'non_azure_computer_names': {'key': 'nonAzureComputerNames', 'type': '[str]'},
'targets': {'key': 'targets', 'type': 'TargetProperties'},
}
def __init__(
self,
*,
operating_system: Union[str, "_models.OperatingSystemType"],
windows: Optional["_models.WindowsProperties"] = None,
linux: Optional["_models.LinuxProperties"] = None,
duration: Optional[datetime.timedelta] = None,
azure_virtual_machines: Optional[List[str]] = None,
non_azure_computer_names: Optional[List[str]] = None,
targets: Optional["_models.TargetProperties"] = None,
**kwargs
):
"""
:keyword operating_system: Required. operating system of target machines. Known values are:
"Windows", "Linux".
:paramtype operating_system: str or ~azure.mgmt.automation.models.OperatingSystemType
:keyword windows: Windows specific update configuration.
:paramtype windows: ~azure.mgmt.automation.models.WindowsProperties
:keyword linux: Linux specific update configuration.
:paramtype linux: ~azure.mgmt.automation.models.LinuxProperties
:keyword duration: Maximum time allowed for the software update configuration run. Duration
needs to be specified using the format PT[n]H[n]M[n]S as per ISO8601.
:paramtype duration: ~datetime.timedelta
:keyword azure_virtual_machines: List of azure resource Ids for azure virtual machines targeted
by the software update configuration.
:paramtype azure_virtual_machines: list[str]
:keyword non_azure_computer_names: List of names of non-azure machines targeted by the software
update configuration.
:paramtype non_azure_computer_names: list[str]
:keyword targets: Group targets for the software update configuration.
:paramtype targets: ~azure.mgmt.automation.models.TargetProperties
"""
super(UpdateConfiguration, self).__init__(**kwargs)
self.operating_system = operating_system
self.windows = windows
self.linux = linux
self.duration = duration
self.azure_virtual_machines = azure_virtual_machines
self.non_azure_computer_names = non_azure_computer_names
self.targets = targets
class UpdateConfigurationNavigation(msrest.serialization.Model):
"""Software update configuration Run Navigation model.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: Name of the software update configuration triggered the software update
configuration run.
:vartype name: str
"""
_validation = {
'name': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(UpdateConfigurationNavigation, self).__init__(**kwargs)
self.name = None
class Usage(msrest.serialization.Model):
"""Definition of Usage.
:ivar id: Gets or sets the id of the resource.
:vartype id: str
:ivar name: Gets or sets the usage counter name.
:vartype name: ~azure.mgmt.automation.models.UsageCounterName
:ivar unit: Gets or sets the usage unit name.
:vartype unit: str
:ivar current_value: Gets or sets the current usage value.
:vartype current_value: float
:ivar limit: Gets or sets max limit. -1 for unlimited.
:vartype limit: long
:ivar throttle_status: Gets or sets the throttle status.
:vartype throttle_status: str
"""
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'UsageCounterName'},
'unit': {'key': 'unit', 'type': 'str'},
'current_value': {'key': 'currentValue', 'type': 'float'},
'limit': {'key': 'limit', 'type': 'long'},
'throttle_status': {'key': 'throttleStatus', 'type': 'str'},
}
def __init__(
self,
*,
id: Optional[str] = None,
name: Optional["_models.UsageCounterName"] = None,
unit: Optional[str] = None,
current_value: Optional[float] = None,
limit: Optional[int] = None,
throttle_status: Optional[str] = None,
**kwargs
):
"""
:keyword id: Gets or sets the id of the resource.
:paramtype id: str
:keyword name: Gets or sets the usage counter name.
:paramtype name: ~azure.mgmt.automation.models.UsageCounterName
:keyword unit: Gets or sets the usage unit name.
:paramtype unit: str
:keyword current_value: Gets or sets the current usage value.
:paramtype current_value: float
:keyword limit: Gets or sets max limit. -1 for unlimited.
:paramtype limit: long
:keyword throttle_status: Gets or sets the throttle status.
:paramtype throttle_status: str
"""
super(Usage, self).__init__(**kwargs)
self.id = id
self.name = name
self.unit = unit
self.current_value = current_value
self.limit = limit
self.throttle_status = throttle_status
class UsageCounterName(msrest.serialization.Model):
"""Definition of usage counter name.
:ivar value: Gets or sets the usage counter name.
:vartype value: str
:ivar localized_value: Gets or sets the localized usage counter name.
:vartype localized_value: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': 'str'},
'localized_value': {'key': 'localizedValue', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[str] = None,
localized_value: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets the usage counter name.
:paramtype value: str
:keyword localized_value: Gets or sets the localized usage counter name.
:paramtype localized_value: str
"""
super(UsageCounterName, self).__init__(**kwargs)
self.value = value
self.localized_value = localized_value
class UsageListResult(msrest.serialization.Model):
"""The response model for the get usage operation.
:ivar value: Gets or sets usage.
:vartype value: list[~azure.mgmt.automation.models.Usage]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Usage]'},
}
def __init__(
self,
*,
value: Optional[List["_models.Usage"]] = None,
**kwargs
):
"""
:keyword value: Gets or sets usage.
:paramtype value: list[~azure.mgmt.automation.models.Usage]
"""
super(UsageListResult, self).__init__(**kwargs)
self.value = value
class Variable(ProxyResource):
"""Definition of the variable.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar value: Gets or sets the value of the variable.
:vartype value: str
:ivar is_encrypted: Gets or sets the encrypted flag of the variable.
:vartype is_encrypted: bool
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: 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'},
'value': {'key': 'properties.value', 'type': 'str'},
'is_encrypted': {'key': 'properties.isEncrypted', 'type': 'bool'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[str] = None,
is_encrypted: Optional[bool] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets the value of the variable.
:paramtype value: str
:keyword is_encrypted: Gets or sets the encrypted flag of the variable.
:paramtype is_encrypted: bool
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Variable, self).__init__(**kwargs)
self.value = value
self.is_encrypted = is_encrypted
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.description = description
class VariableCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update variable operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the variable.
:vartype name: str
:ivar value: Gets or sets the value of the variable.
:vartype value: str
:ivar description: Gets or sets the description of the variable.
:vartype description: str
:ivar is_encrypted: Gets or sets the encrypted flag of the variable.
:vartype is_encrypted: bool
"""
_validation = {
'name': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'value': {'key': 'properties.value', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'is_encrypted': {'key': 'properties.isEncrypted', 'type': 'bool'},
}
def __init__(
self,
*,
name: str,
value: Optional[str] = None,
description: Optional[str] = None,
is_encrypted: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the variable.
:paramtype name: str
:keyword value: Gets or sets the value of the variable.
:paramtype value: str
:keyword description: Gets or sets the description of the variable.
:paramtype description: str
:keyword is_encrypted: Gets or sets the encrypted flag of the variable.
:paramtype is_encrypted: bool
"""
super(VariableCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.value = value
self.description = description
self.is_encrypted = is_encrypted
class VariableListResult(msrest.serialization.Model):
"""The response model for the list variables operation.
:ivar value: Gets or sets a list of variables.
:vartype value: list[~azure.mgmt.automation.models.Variable]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Variable]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Variable"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of variables.
:paramtype value: list[~azure.mgmt.automation.models.Variable]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(VariableListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class VariableUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update variable operation.
:ivar name: Gets or sets the name of the variable.
:vartype name: str
:ivar value: Gets or sets the value of the variable.
:vartype value: str
:ivar description: Gets or sets the description of the variable.
:vartype description: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'value': {'key': 'properties.value', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
value: Optional[str] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the variable.
:paramtype name: str
:keyword value: Gets or sets the value of the variable.
:paramtype value: str
:keyword description: Gets or sets the description of the variable.
:paramtype description: str
"""
super(VariableUpdateParameters, self).__init__(**kwargs)
self.name = name
self.value = value
self.description = description
class Watcher(Resource):
"""Definition of the watcher type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar etag: Gets or sets the etag of the resource.
:vartype etag: str
:ivar tags: A set of tags. Resource tags.
:vartype tags: dict[str, str]
:ivar location: The geo-location where the resource lives.
:vartype location: str
:ivar execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is
invoked.
:vartype execution_frequency_in_seconds: long
:ivar script_name: Gets or sets the name of the script the watcher is attached to, i.e. the
name of an existing runbook.
:vartype script_name: str
:ivar script_parameters: Gets or sets the parameters of the script.
:vartype script_parameters: dict[str, str]
:ivar script_run_on: Gets or sets the name of the hybrid worker group the watcher will run on.
:vartype script_run_on: str
:ivar status: Gets the current status of the watcher.
:vartype status: str
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar last_modified_by: Details of the user who last modified the watcher.
:vartype last_modified_by: str
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'status': {'readonly': True},
'creation_time': {'readonly': True},
'last_modified_time': {'readonly': True},
'last_modified_by': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'execution_frequency_in_seconds': {'key': 'properties.executionFrequencyInSeconds', 'type': 'long'},
'script_name': {'key': 'properties.scriptName', 'type': 'str'},
'script_parameters': {'key': 'properties.scriptParameters', 'type': '{str}'},
'script_run_on': {'key': 'properties.scriptRunOn', 'type': 'str'},
'status': {'key': 'properties.status', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
etag: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
execution_frequency_in_seconds: Optional[int] = None,
script_name: Optional[str] = None,
script_parameters: Optional[Dict[str, str]] = None,
script_run_on: Optional[str] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword etag: Gets or sets the etag of the resource.
:paramtype etag: str
:keyword tags: A set of tags. Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The geo-location where the resource lives.
:paramtype location: str
:keyword execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is
invoked.
:paramtype execution_frequency_in_seconds: long
:keyword script_name: Gets or sets the name of the script the watcher is attached to, i.e. the
name of an existing runbook.
:paramtype script_name: str
:keyword script_parameters: Gets or sets the parameters of the script.
:paramtype script_parameters: dict[str, str]
:keyword script_run_on: Gets or sets the name of the hybrid worker group the watcher will run
on.
:paramtype script_run_on: str
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Watcher, self).__init__(**kwargs)
self.etag = etag
self.tags = tags
self.location = location
self.execution_frequency_in_seconds = execution_frequency_in_seconds
self.script_name = script_name
self.script_parameters = script_parameters
self.script_run_on = script_run_on
self.status = None
self.creation_time = None
self.last_modified_time = None
self.last_modified_by = None
self.description = description
class WatcherListResult(msrest.serialization.Model):
"""The response model for the list watcher operation.
:ivar value: Gets or sets a list of watchers.
:vartype value: list[~azure.mgmt.automation.models.Watcher]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Watcher]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Watcher"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of watchers.
:paramtype value: list[~azure.mgmt.automation.models.Watcher]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(WatcherListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class WatcherUpdateParameters(msrest.serialization.Model):
"""WatcherUpdateParameters.
:ivar name: Gets or sets the name of the resource.
:vartype name: str
:ivar execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is
invoked.
:vartype execution_frequency_in_seconds: long
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'execution_frequency_in_seconds': {'key': 'properties.executionFrequencyInSeconds', 'type': 'long'},
}
def __init__(
self,
*,
name: Optional[str] = None,
execution_frequency_in_seconds: Optional[int] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the resource.
:paramtype name: str
:keyword execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is
invoked.
:paramtype execution_frequency_in_seconds: long
"""
super(WatcherUpdateParameters, self).__init__(**kwargs)
self.name = name
self.execution_frequency_in_seconds = execution_frequency_in_seconds
class Webhook(ProxyResource):
"""Definition of the webhook type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar is_enabled: Gets or sets the value of the enabled flag of the webhook.
:vartype is_enabled: bool
:ivar uri: Gets or sets the webhook uri.
:vartype uri: str
:ivar expiry_time: Gets or sets the expiry time.
:vartype expiry_time: ~datetime.datetime
:ivar last_invoked_time: Gets or sets the last invoked time.
:vartype last_invoked_time: ~datetime.datetime
:ivar parameters: Gets or sets the parameters of the job that is created when the webhook calls
the runbook it is associated with.
:vartype parameters: dict[str, str]
:ivar runbook: Gets or sets the runbook the webhook is associated with.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar run_on: Gets or sets the name of the hybrid worker group the webhook job will run on.
:vartype run_on: str
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar last_modified_by: Details of the user who last modified the Webhook.
:vartype last_modified_by: str
:ivar description: Gets or sets the description.
:vartype description: 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'},
'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'},
'uri': {'key': 'properties.uri', 'type': 'str'},
'expiry_time': {'key': 'properties.expiryTime', 'type': 'iso-8601'},
'last_invoked_time': {'key': 'properties.lastInvokedTime', 'type': 'iso-8601'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
is_enabled: Optional[bool] = False,
uri: Optional[str] = None,
expiry_time: Optional[datetime.datetime] = None,
last_invoked_time: Optional[datetime.datetime] = None,
parameters: Optional[Dict[str, str]] = None,
runbook: Optional["_models.RunbookAssociationProperty"] = None,
run_on: Optional[str] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
last_modified_by: Optional[str] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword is_enabled: Gets or sets the value of the enabled flag of the webhook.
:paramtype is_enabled: bool
:keyword uri: Gets or sets the webhook uri.
:paramtype uri: str
:keyword expiry_time: Gets or sets the expiry time.
:paramtype expiry_time: ~datetime.datetime
:keyword last_invoked_time: Gets or sets the last invoked time.
:paramtype last_invoked_time: ~datetime.datetime
:keyword parameters: Gets or sets the parameters of the job that is created when the webhook
calls the runbook it is associated with.
:paramtype parameters: dict[str, str]
:keyword runbook: Gets or sets the runbook the webhook is associated with.
:paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:keyword run_on: Gets or sets the name of the hybrid worker group the webhook job will run on.
:paramtype run_on: str
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword last_modified_by: Details of the user who last modified the Webhook.
:paramtype last_modified_by: str
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Webhook, self).__init__(**kwargs)
self.is_enabled = is_enabled
self.uri = uri
self.expiry_time = expiry_time
self.last_invoked_time = last_invoked_time
self.parameters = parameters
self.runbook = runbook
self.run_on = run_on
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.last_modified_by = last_modified_by
self.description = description
class WebhookCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update webhook operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the webhook.
:vartype name: str
:ivar is_enabled: Gets or sets the value of the enabled flag of webhook.
:vartype is_enabled: bool
:ivar uri: Gets or sets the uri.
:vartype uri: str
:ivar expiry_time: Gets or sets the expiry time.
:vartype expiry_time: ~datetime.datetime
:ivar parameters: Gets or sets the parameters of the job.
:vartype parameters: dict[str, str]
:ivar runbook: Gets or sets the runbook.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar run_on: Gets or sets the name of the hybrid worker group the webhook job will run on.
:vartype run_on: str
"""
_validation = {
'name': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'},
'uri': {'key': 'properties.uri', 'type': 'str'},
'expiry_time': {'key': 'properties.expiryTime', 'type': 'iso-8601'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
}
def __init__(
self,
*,
name: str,
is_enabled: Optional[bool] = None,
uri: Optional[str] = None,
expiry_time: Optional[datetime.datetime] = None,
parameters: Optional[Dict[str, str]] = None,
runbook: Optional["_models.RunbookAssociationProperty"] = None,
run_on: Optional[str] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the webhook.
:paramtype name: str
:keyword is_enabled: Gets or sets the value of the enabled flag of webhook.
:paramtype is_enabled: bool
:keyword uri: Gets or sets the uri.
:paramtype uri: str
:keyword expiry_time: Gets or sets the expiry time.
:paramtype expiry_time: ~datetime.datetime
:keyword parameters: Gets or sets the parameters of the job.
:paramtype parameters: dict[str, str]
:keyword runbook: Gets or sets the runbook.
:paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:keyword run_on: Gets or sets the name of the hybrid worker group the webhook job will run on.
:paramtype run_on: str
"""
super(WebhookCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.is_enabled = is_enabled
self.uri = uri
self.expiry_time = expiry_time
self.parameters = parameters
self.runbook = runbook
self.run_on = run_on
class WebhookListResult(msrest.serialization.Model):
"""The response model for the list webhook operation.
:ivar value: Gets or sets a list of webhooks.
:vartype value: list[~azure.mgmt.automation.models.Webhook]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Webhook]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Webhook"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of webhooks.
:paramtype value: list[~azure.mgmt.automation.models.Webhook]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(WebhookListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class WebhookUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update webhook operation.
:ivar name: Gets or sets the name of the webhook.
:vartype name: str
:ivar is_enabled: Gets or sets the value of the enabled flag of webhook.
:vartype is_enabled: bool
:ivar run_on: Gets or sets the name of the hybrid worker group the webhook job will run on.
:vartype run_on: str
:ivar parameters: Gets or sets the parameters of the job.
:vartype parameters: dict[str, str]
:ivar description: Gets or sets the description of the webhook.
:vartype description: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
is_enabled: Optional[bool] = None,
run_on: Optional[str] = None,
parameters: Optional[Dict[str, str]] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the webhook.
:paramtype name: str
:keyword is_enabled: Gets or sets the value of the enabled flag of webhook.
:paramtype is_enabled: bool
:keyword run_on: Gets or sets the name of the hybrid worker group the webhook job will run on.
:paramtype run_on: str
:keyword parameters: Gets or sets the parameters of the job.
:paramtype parameters: dict[str, str]
:keyword description: Gets or sets the description of the webhook.
:paramtype description: str
"""
super(WebhookUpdateParameters, self).__init__(**kwargs)
self.name = name
self.is_enabled = is_enabled
self.run_on = run_on
self.parameters = parameters
self.description = description
class WindowsProperties(msrest.serialization.Model):
"""Windows specific update configuration.
:ivar included_update_classifications: Update classification included in the software update
configuration. A comma separated string with required values. Known values are: "Unclassified",
"Critical", "Security", "UpdateRollup", "FeaturePack", "ServicePack", "Definition", "Tools",
"Updates".
:vartype included_update_classifications: str or
~azure.mgmt.automation.models.WindowsUpdateClasses
:ivar excluded_kb_numbers: KB numbers excluded from the software update configuration.
:vartype excluded_kb_numbers: list[str]
:ivar included_kb_numbers: KB numbers included from the software update configuration.
:vartype included_kb_numbers: list[str]
:ivar reboot_setting: Reboot setting for the software update configuration.
:vartype reboot_setting: str
"""
_attribute_map = {
'included_update_classifications': {'key': 'includedUpdateClassifications', 'type': 'str'},
'excluded_kb_numbers': {'key': 'excludedKbNumbers', 'type': '[str]'},
'included_kb_numbers': {'key': 'includedKbNumbers', 'type': '[str]'},
'reboot_setting': {'key': 'rebootSetting', 'type': 'str'},
}
def __init__(
self,
*,
included_update_classifications: Optional[Union[str, "_models.WindowsUpdateClasses"]] = None,
excluded_kb_numbers: Optional[List[str]] = None,
included_kb_numbers: Optional[List[str]] = None,
reboot_setting: Optional[str] = None,
**kwargs
):
"""
:keyword included_update_classifications: Update classification included in the software update
configuration. A comma separated string with required values. Known values are: "Unclassified",
"Critical", "Security", "UpdateRollup", "FeaturePack", "ServicePack", "Definition", "Tools",
"Updates".
:paramtype included_update_classifications: str or
~azure.mgmt.automation.models.WindowsUpdateClasses
:keyword excluded_kb_numbers: KB numbers excluded from the software update configuration.
:paramtype excluded_kb_numbers: list[str]
:keyword included_kb_numbers: KB numbers included from the software update configuration.
:paramtype included_kb_numbers: list[str]
:keyword reboot_setting: Reboot setting for the software update configuration.
:paramtype reboot_setting: str
"""
super(WindowsProperties, self).__init__(**kwargs)
self.included_update_classifications = included_update_classifications
self.excluded_kb_numbers = excluded_kb_numbers
self.included_kb_numbers = included_kb_numbers
self.reboot_setting = reboot_setting
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/models/_models_py3.py
|
_models_py3.py
|
import datetime
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
from azure.core.exceptions import HttpResponseError
import msrest.serialization
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
import __init__ as _models
class Activity(msrest.serialization.Model):
"""Definition of the activity.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Gets or sets the id of the resource.
:vartype id: str
:ivar name: Gets the name of the activity.
:vartype name: str
:ivar definition: Gets or sets the user name of the activity.
:vartype definition: str
:ivar parameter_sets: Gets or sets the parameter sets of the activity.
:vartype parameter_sets: list[~azure.mgmt.automation.models.ActivityParameterSet]
:ivar output_types: Gets or sets the output types of the activity.
:vartype output_types: list[~azure.mgmt.automation.models.ActivityOutputType]
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'name': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'definition': {'key': 'properties.definition', 'type': 'str'},
'parameter_sets': {'key': 'properties.parameterSets', 'type': '[ActivityParameterSet]'},
'output_types': {'key': 'properties.outputTypes', 'type': '[ActivityOutputType]'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
id: Optional[str] = None,
definition: Optional[str] = None,
parameter_sets: Optional[List["_models.ActivityParameterSet"]] = None,
output_types: Optional[List["_models.ActivityOutputType"]] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword id: Gets or sets the id of the resource.
:paramtype id: str
:keyword definition: Gets or sets the user name of the activity.
:paramtype definition: str
:keyword parameter_sets: Gets or sets the parameter sets of the activity.
:paramtype parameter_sets: list[~azure.mgmt.automation.models.ActivityParameterSet]
:keyword output_types: Gets or sets the output types of the activity.
:paramtype output_types: list[~azure.mgmt.automation.models.ActivityOutputType]
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Activity, self).__init__(**kwargs)
self.id = id
self.name = None
self.definition = definition
self.parameter_sets = parameter_sets
self.output_types = output_types
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.description = description
class ActivityListResult(msrest.serialization.Model):
"""The response model for the list activity operation.
:ivar value: Gets or sets a list of activities.
:vartype value: list[~azure.mgmt.automation.models.Activity]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Activity]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Activity"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of activities.
:paramtype value: list[~azure.mgmt.automation.models.Activity]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(ActivityListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class ActivityOutputType(msrest.serialization.Model):
"""Definition of the activity output type.
:ivar name: Gets or sets the name of the activity output type.
:vartype name: str
:ivar type: Gets or sets the type of the activity output type.
:vartype type: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
type: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the activity output type.
:paramtype name: str
:keyword type: Gets or sets the type of the activity output type.
:paramtype type: str
"""
super(ActivityOutputType, self).__init__(**kwargs)
self.name = name
self.type = type
class ActivityParameter(msrest.serialization.Model):
"""Definition of the activity parameter.
:ivar name: Gets or sets the name of the activity parameter.
:vartype name: str
:ivar type: Gets or sets the type of the activity parameter.
:vartype type: str
:ivar is_mandatory: Gets or sets a Boolean value that indicates true if the parameter is
required. If the value is false, the parameter is optional.
:vartype is_mandatory: bool
:ivar is_dynamic: Gets or sets a Boolean value that indicates true if the parameter is dynamic.
:vartype is_dynamic: bool
:ivar position: Gets or sets the position of the activity parameter.
:vartype position: long
:ivar value_from_pipeline: Gets or sets a Boolean value that indicates true if the parameter
can take values from the incoming pipeline objects. This setting is used if the cmdlet must
access the complete input object. false indicates that the parameter cannot take values from
the complete input object.
:vartype value_from_pipeline: bool
:ivar value_from_pipeline_by_property_name: Gets or sets a Boolean value that indicates true if
the parameter can be filled from a property of the incoming pipeline object that has the same
name as this parameter. false indicates that the parameter cannot be filled from the incoming
pipeline object property with the same name.
:vartype value_from_pipeline_by_property_name: bool
:ivar value_from_remaining_arguments: Gets or sets a Boolean value that indicates true if the
cmdlet parameter accepts all the remaining command-line arguments that are associated with this
parameter in the form of an array. false if the cmdlet parameter does not accept all the
remaining argument values.
:vartype value_from_remaining_arguments: bool
:ivar description: Gets or sets the description of the activity parameter.
:vartype description: str
:ivar validation_set: Gets or sets the validation set of activity parameter.
:vartype validation_set: list[~azure.mgmt.automation.models.ActivityParameterValidationSet]
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'is_mandatory': {'key': 'isMandatory', 'type': 'bool'},
'is_dynamic': {'key': 'isDynamic', 'type': 'bool'},
'position': {'key': 'position', 'type': 'long'},
'value_from_pipeline': {'key': 'valueFromPipeline', 'type': 'bool'},
'value_from_pipeline_by_property_name': {'key': 'valueFromPipelineByPropertyName', 'type': 'bool'},
'value_from_remaining_arguments': {'key': 'valueFromRemainingArguments', 'type': 'bool'},
'description': {'key': 'description', 'type': 'str'},
'validation_set': {'key': 'validationSet', 'type': '[ActivityParameterValidationSet]'},
}
def __init__(
self,
*,
name: Optional[str] = None,
type: Optional[str] = None,
is_mandatory: Optional[bool] = None,
is_dynamic: Optional[bool] = None,
position: Optional[int] = None,
value_from_pipeline: Optional[bool] = None,
value_from_pipeline_by_property_name: Optional[bool] = None,
value_from_remaining_arguments: Optional[bool] = None,
description: Optional[str] = None,
validation_set: Optional[List["_models.ActivityParameterValidationSet"]] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the activity parameter.
:paramtype name: str
:keyword type: Gets or sets the type of the activity parameter.
:paramtype type: str
:keyword is_mandatory: Gets or sets a Boolean value that indicates true if the parameter is
required. If the value is false, the parameter is optional.
:paramtype is_mandatory: bool
:keyword is_dynamic: Gets or sets a Boolean value that indicates true if the parameter is
dynamic.
:paramtype is_dynamic: bool
:keyword position: Gets or sets the position of the activity parameter.
:paramtype position: long
:keyword value_from_pipeline: Gets or sets a Boolean value that indicates true if the parameter
can take values from the incoming pipeline objects. This setting is used if the cmdlet must
access the complete input object. false indicates that the parameter cannot take values from
the complete input object.
:paramtype value_from_pipeline: bool
:keyword value_from_pipeline_by_property_name: Gets or sets a Boolean value that indicates true
if the parameter can be filled from a property of the incoming pipeline object that has the
same name as this parameter. false indicates that the parameter cannot be filled from the
incoming pipeline object property with the same name.
:paramtype value_from_pipeline_by_property_name: bool
:keyword value_from_remaining_arguments: Gets or sets a Boolean value that indicates true if
the cmdlet parameter accepts all the remaining command-line arguments that are associated with
this parameter in the form of an array. false if the cmdlet parameter does not accept all the
remaining argument values.
:paramtype value_from_remaining_arguments: bool
:keyword description: Gets or sets the description of the activity parameter.
:paramtype description: str
:keyword validation_set: Gets or sets the validation set of activity parameter.
:paramtype validation_set: list[~azure.mgmt.automation.models.ActivityParameterValidationSet]
"""
super(ActivityParameter, self).__init__(**kwargs)
self.name = name
self.type = type
self.is_mandatory = is_mandatory
self.is_dynamic = is_dynamic
self.position = position
self.value_from_pipeline = value_from_pipeline
self.value_from_pipeline_by_property_name = value_from_pipeline_by_property_name
self.value_from_remaining_arguments = value_from_remaining_arguments
self.description = description
self.validation_set = validation_set
class ActivityParameterSet(msrest.serialization.Model):
"""Definition of the activity parameter set.
:ivar name: Gets or sets the name of the activity parameter set.
:vartype name: str
:ivar parameters: Gets or sets the parameters of the activity parameter set.
:vartype parameters: list[~azure.mgmt.automation.models.ActivityParameter]
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'parameters': {'key': 'parameters', 'type': '[ActivityParameter]'},
}
def __init__(
self,
*,
name: Optional[str] = None,
parameters: Optional[List["_models.ActivityParameter"]] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the activity parameter set.
:paramtype name: str
:keyword parameters: Gets or sets the parameters of the activity parameter set.
:paramtype parameters: list[~azure.mgmt.automation.models.ActivityParameter]
"""
super(ActivityParameterSet, self).__init__(**kwargs)
self.name = name
self.parameters = parameters
class ActivityParameterValidationSet(msrest.serialization.Model):
"""Definition of the activity parameter validation set.
:ivar member_value: Gets or sets the name of the activity parameter validation set member.
:vartype member_value: str
"""
_attribute_map = {
'member_value': {'key': 'memberValue', 'type': 'str'},
}
def __init__(
self,
*,
member_value: Optional[str] = None,
**kwargs
):
"""
:keyword member_value: Gets or sets the name of the activity parameter validation set member.
:paramtype member_value: str
"""
super(ActivityParameterValidationSet, self).__init__(**kwargs)
self.member_value = member_value
class AdvancedSchedule(msrest.serialization.Model):
"""The properties of the create Advanced Schedule.
:ivar week_days: Days of the week that the job should execute on.
:vartype week_days: list[str]
:ivar month_days: Days of the month that the job should execute on. Must be between 1 and 31.
:vartype month_days: list[int]
:ivar monthly_occurrences: Occurrences of days within a month.
:vartype monthly_occurrences:
list[~azure.mgmt.automation.models.AdvancedScheduleMonthlyOccurrence]
"""
_attribute_map = {
'week_days': {'key': 'weekDays', 'type': '[str]'},
'month_days': {'key': 'monthDays', 'type': '[int]'},
'monthly_occurrences': {'key': 'monthlyOccurrences', 'type': '[AdvancedScheduleMonthlyOccurrence]'},
}
def __init__(
self,
*,
week_days: Optional[List[str]] = None,
month_days: Optional[List[int]] = None,
monthly_occurrences: Optional[List["_models.AdvancedScheduleMonthlyOccurrence"]] = None,
**kwargs
):
"""
:keyword week_days: Days of the week that the job should execute on.
:paramtype week_days: list[str]
:keyword month_days: Days of the month that the job should execute on. Must be between 1 and
31.
:paramtype month_days: list[int]
:keyword monthly_occurrences: Occurrences of days within a month.
:paramtype monthly_occurrences:
list[~azure.mgmt.automation.models.AdvancedScheduleMonthlyOccurrence]
"""
super(AdvancedSchedule, self).__init__(**kwargs)
self.week_days = week_days
self.month_days = month_days
self.monthly_occurrences = monthly_occurrences
class AdvancedScheduleMonthlyOccurrence(msrest.serialization.Model):
"""The properties of the create advanced schedule monthly occurrence.
:ivar occurrence: Occurrence of the week within the month. Must be between 1 and 5.
:vartype occurrence: int
:ivar day: Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday,
saturday, sunday. Known values are: "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
"Saturday", "Sunday".
:vartype day: str or ~azure.mgmt.automation.models.ScheduleDay
"""
_attribute_map = {
'occurrence': {'key': 'occurrence', 'type': 'int'},
'day': {'key': 'day', 'type': 'str'},
}
def __init__(
self,
*,
occurrence: Optional[int] = None,
day: Optional[Union[str, "_models.ScheduleDay"]] = None,
**kwargs
):
"""
:keyword occurrence: Occurrence of the week within the month. Must be between 1 and 5.
:paramtype occurrence: int
:keyword day: Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday,
friday, saturday, sunday. Known values are: "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday", "Sunday".
:paramtype day: str or ~azure.mgmt.automation.models.ScheduleDay
"""
super(AdvancedScheduleMonthlyOccurrence, self).__init__(**kwargs)
self.occurrence = occurrence
self.day = day
class AgentRegistration(msrest.serialization.Model):
"""Definition of the agent registration information type.
:ivar dsc_meta_configuration: Gets or sets the dsc meta configuration.
:vartype dsc_meta_configuration: str
:ivar endpoint: Gets or sets the dsc server endpoint.
:vartype endpoint: str
:ivar keys: Gets or sets the agent registration keys.
:vartype keys: ~azure.mgmt.automation.models.AgentRegistrationKeys
:ivar id: Gets or sets the id.
:vartype id: str
"""
_attribute_map = {
'dsc_meta_configuration': {'key': 'dscMetaConfiguration', 'type': 'str'},
'endpoint': {'key': 'endpoint', 'type': 'str'},
'keys': {'key': 'keys', 'type': 'AgentRegistrationKeys'},
'id': {'key': 'id', 'type': 'str'},
}
def __init__(
self,
*,
dsc_meta_configuration: Optional[str] = None,
endpoint: Optional[str] = None,
keys: Optional["_models.AgentRegistrationKeys"] = None,
id: Optional[str] = None,
**kwargs
):
"""
:keyword dsc_meta_configuration: Gets or sets the dsc meta configuration.
:paramtype dsc_meta_configuration: str
:keyword endpoint: Gets or sets the dsc server endpoint.
:paramtype endpoint: str
:keyword keys: Gets or sets the agent registration keys.
:paramtype keys: ~azure.mgmt.automation.models.AgentRegistrationKeys
:keyword id: Gets or sets the id.
:paramtype id: str
"""
super(AgentRegistration, self).__init__(**kwargs)
self.dsc_meta_configuration = dsc_meta_configuration
self.endpoint = endpoint
self.keys = keys
self.id = id
class AgentRegistrationKeys(msrest.serialization.Model):
"""Definition of the agent registration keys.
:ivar primary: Gets or sets the primary key.
:vartype primary: str
:ivar secondary: Gets or sets the secondary key.
:vartype secondary: str
"""
_attribute_map = {
'primary': {'key': 'primary', 'type': 'str'},
'secondary': {'key': 'secondary', 'type': 'str'},
}
def __init__(
self,
*,
primary: Optional[str] = None,
secondary: Optional[str] = None,
**kwargs
):
"""
:keyword primary: Gets or sets the primary key.
:paramtype primary: str
:keyword secondary: Gets or sets the secondary key.
:paramtype secondary: str
"""
super(AgentRegistrationKeys, self).__init__(**kwargs)
self.primary = primary
self.secondary = secondary
class AgentRegistrationRegenerateKeyParameter(msrest.serialization.Model):
"""The parameters supplied to the regenerate keys operation.
All required parameters must be populated in order to send to Azure.
:ivar key_name: Required. Gets or sets the agent registration key name - primary or secondary.
Known values are: "primary", "secondary".
:vartype key_name: str or ~azure.mgmt.automation.models.AgentRegistrationKeyName
"""
_validation = {
'key_name': {'required': True},
}
_attribute_map = {
'key_name': {'key': 'keyName', 'type': 'str'},
}
def __init__(
self,
*,
key_name: Union[str, "_models.AgentRegistrationKeyName"],
**kwargs
):
"""
:keyword key_name: Required. Gets or sets the agent registration key name - primary or
secondary. Known values are: "primary", "secondary".
:paramtype key_name: str or ~azure.mgmt.automation.models.AgentRegistrationKeyName
"""
super(AgentRegistrationRegenerateKeyParameter, self).__init__(**kwargs)
self.key_name = key_name
class Resource(msrest.serialization.Model):
"""The core properties of ARM resources.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: 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'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(Resource, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None
class TrackedResource(Resource):
"""The resource model definition for a ARM tracked top level resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar tags: A set of tags. Resource tags.
:vartype tags: dict[str, str]
:ivar location: The Azure Region where the resource lives.
:vartype location: 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'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The Azure Region where the resource lives.
:paramtype location: str
"""
super(TrackedResource, self).__init__(**kwargs)
self.tags = tags
self.location = location
class AutomationAccount(TrackedResource):
"""Definition of the automation account type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar tags: A set of tags. Resource tags.
:vartype tags: dict[str, str]
:ivar location: The Azure Region where the resource lives.
:vartype location: str
:ivar etag: Gets or sets the etag of the resource.
:vartype etag: str
:ivar identity: Identity for the resource.
:vartype identity: ~azure.mgmt.automation.models.Identity
:ivar system_data: Resource system metadata.
:vartype system_data: ~azure.mgmt.automation.models.SystemData
:ivar sku: Gets or sets the SKU of account.
:vartype sku: ~azure.mgmt.automation.models.Sku
:ivar last_modified_by: Gets or sets the last modified by.
:vartype last_modified_by: str
:ivar state: Gets status of account. Known values are: "Ok", "Unavailable", "Suspended".
:vartype state: str or ~azure.mgmt.automation.models.AutomationAccountState
:ivar creation_time: Gets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
:ivar encryption: Encryption properties for the automation account.
:vartype encryption: ~azure.mgmt.automation.models.EncryptionProperties
:ivar private_endpoint_connections: List of Automation operations supported by the Automation
resource provider.
:vartype private_endpoint_connections:
list[~azure.mgmt.automation.models.PrivateEndpointConnection]
:ivar public_network_access: Indicates whether traffic on the non-ARM endpoint (Webhook/Agent)
is allowed from the public internet.
:vartype public_network_access: bool
:ivar disable_local_auth: Indicates whether requests using non-AAD authentication are blocked.
:vartype disable_local_auth: bool
:ivar automation_hybrid_service_url: URL of automation hybrid service which is used for hybrid
worker on-boarding.
:vartype automation_hybrid_service_url: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'system_data': {'readonly': True},
'state': {'readonly': True},
'creation_time': {'readonly': True},
'last_modified_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
'identity': {'key': 'identity', 'type': 'Identity'},
'system_data': {'key': 'systemData', 'type': 'SystemData'},
'sku': {'key': 'properties.sku', 'type': 'Sku'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'state': {'key': 'properties.state', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'},
'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'},
'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'bool'},
'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'},
'automation_hybrid_service_url': {'key': 'properties.automationHybridServiceUrl', 'type': 'str'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
etag: Optional[str] = None,
identity: Optional["_models.Identity"] = None,
sku: Optional["_models.Sku"] = None,
last_modified_by: Optional[str] = None,
description: Optional[str] = None,
encryption: Optional["_models.EncryptionProperties"] = None,
private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = None,
public_network_access: Optional[bool] = None,
disable_local_auth: Optional[bool] = None,
automation_hybrid_service_url: Optional[str] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The Azure Region where the resource lives.
:paramtype location: str
:keyword etag: Gets or sets the etag of the resource.
:paramtype etag: str
:keyword identity: Identity for the resource.
:paramtype identity: ~azure.mgmt.automation.models.Identity
:keyword sku: Gets or sets the SKU of account.
:paramtype sku: ~azure.mgmt.automation.models.Sku
:keyword last_modified_by: Gets or sets the last modified by.
:paramtype last_modified_by: str
:keyword description: Gets or sets the description.
:paramtype description: str
:keyword encryption: Encryption properties for the automation account.
:paramtype encryption: ~azure.mgmt.automation.models.EncryptionProperties
:keyword private_endpoint_connections: List of Automation operations supported by the
Automation resource provider.
:paramtype private_endpoint_connections:
list[~azure.mgmt.automation.models.PrivateEndpointConnection]
:keyword public_network_access: Indicates whether traffic on the non-ARM endpoint
(Webhook/Agent) is allowed from the public internet.
:paramtype public_network_access: bool
:keyword disable_local_auth: Indicates whether requests using non-AAD authentication are
blocked.
:paramtype disable_local_auth: bool
:keyword automation_hybrid_service_url: URL of automation hybrid service which is used for
hybrid worker on-boarding.
:paramtype automation_hybrid_service_url: str
"""
super(AutomationAccount, self).__init__(tags=tags, location=location, **kwargs)
self.etag = etag
self.identity = identity
self.system_data = None
self.sku = sku
self.last_modified_by = last_modified_by
self.state = None
self.creation_time = None
self.last_modified_time = None
self.description = description
self.encryption = encryption
self.private_endpoint_connections = private_endpoint_connections
self.public_network_access = public_network_access
self.disable_local_auth = disable_local_auth
self.automation_hybrid_service_url = automation_hybrid_service_url
class AutomationAccountCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update automation account operation.
:ivar name: Gets or sets name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar identity: Sets the identity property for automation account.
:vartype identity: ~azure.mgmt.automation.models.Identity
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar sku: Gets or sets account SKU.
:vartype sku: ~azure.mgmt.automation.models.Sku
:ivar encryption: Set the encryption properties for the automation account.
:vartype encryption: ~azure.mgmt.automation.models.EncryptionProperties
:ivar public_network_access: Indicates whether traffic on the non-ARM endpoint (Webhook/Agent)
is allowed from the public internet.
:vartype public_network_access: bool
:ivar disable_local_auth: Indicates whether requests using non-AAD authentication are blocked.
:vartype disable_local_auth: bool
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'identity': {'key': 'identity', 'type': 'Identity'},
'tags': {'key': 'tags', 'type': '{str}'},
'sku': {'key': 'properties.sku', 'type': 'Sku'},
'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'},
'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'bool'},
'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'},
}
def __init__(
self,
*,
name: Optional[str] = None,
location: Optional[str] = None,
identity: Optional["_models.Identity"] = None,
tags: Optional[Dict[str, str]] = None,
sku: Optional["_models.Sku"] = None,
encryption: Optional["_models.EncryptionProperties"] = None,
public_network_access: Optional[bool] = None,
disable_local_auth: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Gets or sets name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword identity: Sets the identity property for automation account.
:paramtype identity: ~azure.mgmt.automation.models.Identity
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword sku: Gets or sets account SKU.
:paramtype sku: ~azure.mgmt.automation.models.Sku
:keyword encryption: Set the encryption properties for the automation account.
:paramtype encryption: ~azure.mgmt.automation.models.EncryptionProperties
:keyword public_network_access: Indicates whether traffic on the non-ARM endpoint
(Webhook/Agent) is allowed from the public internet.
:paramtype public_network_access: bool
:keyword disable_local_auth: Indicates whether requests using non-AAD authentication are
blocked.
:paramtype disable_local_auth: bool
"""
super(AutomationAccountCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.identity = identity
self.tags = tags
self.sku = sku
self.encryption = encryption
self.public_network_access = public_network_access
self.disable_local_auth = disable_local_auth
class AutomationAccountListResult(msrest.serialization.Model):
"""The response model for the list account operation.
:ivar value: Gets or sets list of accounts.
:vartype value: list[~azure.mgmt.automation.models.AutomationAccount]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[AutomationAccount]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.AutomationAccount"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets list of accounts.
:paramtype value: list[~azure.mgmt.automation.models.AutomationAccount]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(AutomationAccountListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class AutomationAccountUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update automation account operation.
:ivar name: Gets or sets the name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar identity: Sets the identity property for automation account.
:vartype identity: ~azure.mgmt.automation.models.Identity
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar sku: Gets or sets account SKU.
:vartype sku: ~azure.mgmt.automation.models.Sku
:ivar encryption: Set the encryption properties for the automation account.
:vartype encryption: ~azure.mgmt.automation.models.EncryptionProperties
:ivar public_network_access: Indicates whether traffic on the non-ARM endpoint (Webhook/Agent)
is allowed from the public internet.
:vartype public_network_access: bool
:ivar disable_local_auth: Indicates whether requests using non-AAD authentication are blocked.
:vartype disable_local_auth: bool
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'identity': {'key': 'identity', 'type': 'Identity'},
'tags': {'key': 'tags', 'type': '{str}'},
'sku': {'key': 'properties.sku', 'type': 'Sku'},
'encryption': {'key': 'properties.encryption', 'type': 'EncryptionProperties'},
'public_network_access': {'key': 'properties.publicNetworkAccess', 'type': 'bool'},
'disable_local_auth': {'key': 'properties.disableLocalAuth', 'type': 'bool'},
}
def __init__(
self,
*,
name: Optional[str] = None,
location: Optional[str] = None,
identity: Optional["_models.Identity"] = None,
tags: Optional[Dict[str, str]] = None,
sku: Optional["_models.Sku"] = None,
encryption: Optional["_models.EncryptionProperties"] = None,
public_network_access: Optional[bool] = None,
disable_local_auth: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword identity: Sets the identity property for automation account.
:paramtype identity: ~azure.mgmt.automation.models.Identity
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword sku: Gets or sets account SKU.
:paramtype sku: ~azure.mgmt.automation.models.Sku
:keyword encryption: Set the encryption properties for the automation account.
:paramtype encryption: ~azure.mgmt.automation.models.EncryptionProperties
:keyword public_network_access: Indicates whether traffic on the non-ARM endpoint
(Webhook/Agent) is allowed from the public internet.
:paramtype public_network_access: bool
:keyword disable_local_auth: Indicates whether requests using non-AAD authentication are
blocked.
:paramtype disable_local_auth: bool
"""
super(AutomationAccountUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.identity = identity
self.tags = tags
self.sku = sku
self.encryption = encryption
self.public_network_access = public_network_access
self.disable_local_auth = disable_local_auth
class AzureQueryProperties(msrest.serialization.Model):
"""Azure query for the update configuration.
:ivar scope: List of Subscription or Resource Group ARM Ids.
:vartype scope: list[str]
:ivar locations: List of locations to scope the query to.
:vartype locations: list[str]
:ivar tag_settings: Tag settings for the VM.
:vartype tag_settings: ~azure.mgmt.automation.models.TagSettingsProperties
"""
_attribute_map = {
'scope': {'key': 'scope', 'type': '[str]'},
'locations': {'key': 'locations', 'type': '[str]'},
'tag_settings': {'key': 'tagSettings', 'type': 'TagSettingsProperties'},
}
def __init__(
self,
*,
scope: Optional[List[str]] = None,
locations: Optional[List[str]] = None,
tag_settings: Optional["_models.TagSettingsProperties"] = None,
**kwargs
):
"""
:keyword scope: List of Subscription or Resource Group ARM Ids.
:paramtype scope: list[str]
:keyword locations: List of locations to scope the query to.
:paramtype locations: list[str]
:keyword tag_settings: Tag settings for the VM.
:paramtype tag_settings: ~azure.mgmt.automation.models.TagSettingsProperties
"""
super(AzureQueryProperties, self).__init__(**kwargs)
self.scope = scope
self.locations = locations
self.tag_settings = tag_settings
class ProxyResource(Resource):
"""ARM proxy resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: 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'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(ProxyResource, self).__init__(**kwargs)
class Certificate(ProxyResource):
"""Definition of the certificate.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar thumbprint: Gets the thumbprint of the certificate.
:vartype thumbprint: str
:ivar expiry_time: Gets the expiry time of the certificate.
:vartype expiry_time: ~datetime.datetime
:ivar is_exportable: Gets the is exportable flag of the certificate.
:vartype is_exportable: bool
:ivar creation_time: Gets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'thumbprint': {'readonly': True},
'expiry_time': {'readonly': True},
'is_exportable': {'readonly': True},
'creation_time': {'readonly': True},
'last_modified_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'},
'expiry_time': {'key': 'properties.expiryTime', 'type': 'iso-8601'},
'is_exportable': {'key': 'properties.isExportable', 'type': 'bool'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
description: Optional[str] = None,
**kwargs
):
"""
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Certificate, self).__init__(**kwargs)
self.thumbprint = None
self.expiry_time = None
self.is_exportable = None
self.creation_time = None
self.last_modified_time = None
self.description = description
class CertificateCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update or replace certificate operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the certificate.
:vartype name: str
:ivar base64_value: Required. Gets or sets the base64 encoded value of the certificate.
:vartype base64_value: str
:ivar description: Gets or sets the description of the certificate.
:vartype description: str
:ivar thumbprint: Gets or sets the thumbprint of the certificate.
:vartype thumbprint: str
:ivar is_exportable: Gets or sets the is exportable flag of the certificate.
:vartype is_exportable: bool
"""
_validation = {
'name': {'required': True},
'base64_value': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'base64_value': {'key': 'properties.base64Value', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'thumbprint': {'key': 'properties.thumbprint', 'type': 'str'},
'is_exportable': {'key': 'properties.isExportable', 'type': 'bool'},
}
def __init__(
self,
*,
name: str,
base64_value: str,
description: Optional[str] = None,
thumbprint: Optional[str] = None,
is_exportable: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the certificate.
:paramtype name: str
:keyword base64_value: Required. Gets or sets the base64 encoded value of the certificate.
:paramtype base64_value: str
:keyword description: Gets or sets the description of the certificate.
:paramtype description: str
:keyword thumbprint: Gets or sets the thumbprint of the certificate.
:paramtype thumbprint: str
:keyword is_exportable: Gets or sets the is exportable flag of the certificate.
:paramtype is_exportable: bool
"""
super(CertificateCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.base64_value = base64_value
self.description = description
self.thumbprint = thumbprint
self.is_exportable = is_exportable
class CertificateListResult(msrest.serialization.Model):
"""The response model for the list certificate operation.
:ivar value: Gets or sets a list of certificates.
:vartype value: list[~azure.mgmt.automation.models.Certificate]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Certificate]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Certificate"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of certificates.
:paramtype value: list[~azure.mgmt.automation.models.Certificate]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(CertificateListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class CertificateUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update certificate operation.
:ivar name: Gets or sets the name of the certificate.
:vartype name: str
:ivar description: Gets or sets the description of the certificate.
:vartype description: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the certificate.
:paramtype name: str
:keyword description: Gets or sets the description of the certificate.
:paramtype description: str
"""
super(CertificateUpdateParameters, self).__init__(**kwargs)
self.name = name
self.description = description
class ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties(msrest.serialization.Model):
"""ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar principal_id: The principal id of user assigned identity.
:vartype principal_id: str
:ivar client_id: The client id of user assigned identity.
:vartype client_id: str
"""
_validation = {
'principal_id': {'readonly': True},
'client_id': {'readonly': True},
}
_attribute_map = {
'principal_id': {'key': 'principalId', 'type': 'str'},
'client_id': {'key': 'clientId', 'type': 'str'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties, self).__init__(**kwargs)
self.principal_id = None
self.client_id = None
class Connection(ProxyResource):
"""Definition of the connection.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar connection_type: Gets or sets the connectionType of the connection.
:vartype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty
:ivar field_definition_values: Gets the field definition values of the connection.
:vartype field_definition_values: dict[str, str]
:ivar creation_time: Gets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'field_definition_values': {'readonly': True},
'creation_time': {'readonly': True},
'last_modified_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'connection_type': {'key': 'properties.connectionType', 'type': 'ConnectionTypeAssociationProperty'},
'field_definition_values': {'key': 'properties.fieldDefinitionValues', 'type': '{str}'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
connection_type: Optional["_models.ConnectionTypeAssociationProperty"] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword connection_type: Gets or sets the connectionType of the connection.
:paramtype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Connection, self).__init__(**kwargs)
self.connection_type = connection_type
self.field_definition_values = None
self.creation_time = None
self.last_modified_time = None
self.description = description
class ConnectionCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update connection operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the connection.
:vartype name: str
:ivar description: Gets or sets the description of the connection.
:vartype description: str
:ivar connection_type: Required. Gets or sets the connectionType of the connection.
:vartype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty
:ivar field_definition_values: Gets or sets the field definition properties of the connection.
:vartype field_definition_values: dict[str, str]
"""
_validation = {
'name': {'required': True},
'connection_type': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'connection_type': {'key': 'properties.connectionType', 'type': 'ConnectionTypeAssociationProperty'},
'field_definition_values': {'key': 'properties.fieldDefinitionValues', 'type': '{str}'},
}
def __init__(
self,
*,
name: str,
connection_type: "_models.ConnectionTypeAssociationProperty",
description: Optional[str] = None,
field_definition_values: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the connection.
:paramtype name: str
:keyword description: Gets or sets the description of the connection.
:paramtype description: str
:keyword connection_type: Required. Gets or sets the connectionType of the connection.
:paramtype connection_type: ~azure.mgmt.automation.models.ConnectionTypeAssociationProperty
:keyword field_definition_values: Gets or sets the field definition properties of the
connection.
:paramtype field_definition_values: dict[str, str]
"""
super(ConnectionCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.description = description
self.connection_type = connection_type
self.field_definition_values = field_definition_values
class ConnectionListResult(msrest.serialization.Model):
"""The response model for the list connection operation.
:ivar value: Gets or sets a list of connection.
:vartype value: list[~azure.mgmt.automation.models.Connection]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Connection]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Connection"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of connection.
:paramtype value: list[~azure.mgmt.automation.models.Connection]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(ConnectionListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class ConnectionType(msrest.serialization.Model):
"""Definition of the connection type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Gets the id of the resource.
:vartype id: str
:ivar name: Gets the name of the connection type.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar is_global: Gets or sets a Boolean value to indicate if the connection type is global.
:vartype is_global: bool
:ivar field_definitions: Gets the field definitions of the connection type.
:vartype field_definitions: dict[str, ~azure.mgmt.automation.models.FieldDefinition]
:ivar creation_time: Gets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'field_definitions': {'readonly': True},
'creation_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'is_global': {'key': 'properties.isGlobal', 'type': 'bool'},
'field_definitions': {'key': 'properties.fieldDefinitions', 'type': '{FieldDefinition}'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
is_global: Optional[bool] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword is_global: Gets or sets a Boolean value to indicate if the connection type is global.
:paramtype is_global: bool
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(ConnectionType, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None
self.is_global = is_global
self.field_definitions = None
self.creation_time = None
self.last_modified_time = last_modified_time
self.description = description
class ConnectionTypeAssociationProperty(msrest.serialization.Model):
"""The connection type property associated with the entity.
:ivar name: Gets or sets the name of the connection type.
:vartype name: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the connection type.
:paramtype name: str
"""
super(ConnectionTypeAssociationProperty, self).__init__(**kwargs)
self.name = name
class ConnectionTypeCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update connection type operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the connection type.
:vartype name: str
:ivar is_global: Gets or sets a Boolean value to indicate if the connection type is global.
:vartype is_global: bool
:ivar field_definitions: Required. Gets or sets the field definitions of the connection type.
:vartype field_definitions: dict[str, ~azure.mgmt.automation.models.FieldDefinition]
"""
_validation = {
'name': {'required': True},
'field_definitions': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'is_global': {'key': 'properties.isGlobal', 'type': 'bool'},
'field_definitions': {'key': 'properties.fieldDefinitions', 'type': '{FieldDefinition}'},
}
def __init__(
self,
*,
name: str,
field_definitions: Dict[str, "_models.FieldDefinition"],
is_global: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the connection type.
:paramtype name: str
:keyword is_global: Gets or sets a Boolean value to indicate if the connection type is global.
:paramtype is_global: bool
:keyword field_definitions: Required. Gets or sets the field definitions of the connection
type.
:paramtype field_definitions: dict[str, ~azure.mgmt.automation.models.FieldDefinition]
"""
super(ConnectionTypeCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.is_global = is_global
self.field_definitions = field_definitions
class ConnectionTypeListResult(msrest.serialization.Model):
"""The response model for the list connection type operation.
:ivar value: Gets or sets a list of connection types.
:vartype value: list[~azure.mgmt.automation.models.ConnectionType]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[ConnectionType]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.ConnectionType"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of connection types.
:paramtype value: list[~azure.mgmt.automation.models.ConnectionType]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(ConnectionTypeListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class ConnectionUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update connection operation.
:ivar name: Gets or sets the name of the connection.
:vartype name: str
:ivar description: Gets or sets the description of the connection.
:vartype description: str
:ivar field_definition_values: Gets or sets the field definition values of the connection.
:vartype field_definition_values: dict[str, str]
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'field_definition_values': {'key': 'properties.fieldDefinitionValues', 'type': '{str}'},
}
def __init__(
self,
*,
name: Optional[str] = None,
description: Optional[str] = None,
field_definition_values: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the connection.
:paramtype name: str
:keyword description: Gets or sets the description of the connection.
:paramtype description: str
:keyword field_definition_values: Gets or sets the field definition values of the connection.
:paramtype field_definition_values: dict[str, str]
"""
super(ConnectionUpdateParameters, self).__init__(**kwargs)
self.name = name
self.description = description
self.field_definition_values = field_definition_values
class ContentHash(msrest.serialization.Model):
"""Definition of the runbook property type.
All required parameters must be populated in order to send to Azure.
:ivar algorithm: Required. Gets or sets the content hash algorithm used to hash the content.
:vartype algorithm: str
:ivar value: Required. Gets or sets expected hash value of the content.
:vartype value: str
"""
_validation = {
'algorithm': {'required': True},
'value': {'required': True},
}
_attribute_map = {
'algorithm': {'key': 'algorithm', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'},
}
def __init__(
self,
*,
algorithm: str,
value: str,
**kwargs
):
"""
:keyword algorithm: Required. Gets or sets the content hash algorithm used to hash the content.
:paramtype algorithm: str
:keyword value: Required. Gets or sets expected hash value of the content.
:paramtype value: str
"""
super(ContentHash, self).__init__(**kwargs)
self.algorithm = algorithm
self.value = value
class ContentLink(msrest.serialization.Model):
"""Definition of the content link.
:ivar uri: Gets or sets the uri of the runbook content.
:vartype uri: str
:ivar content_hash: Gets or sets the hash.
:vartype content_hash: ~azure.mgmt.automation.models.ContentHash
:ivar version: Gets or sets the version of the content.
:vartype version: str
"""
_attribute_map = {
'uri': {'key': 'uri', 'type': 'str'},
'content_hash': {'key': 'contentHash', 'type': 'ContentHash'},
'version': {'key': 'version', 'type': 'str'},
}
def __init__(
self,
*,
uri: Optional[str] = None,
content_hash: Optional["_models.ContentHash"] = None,
version: Optional[str] = None,
**kwargs
):
"""
:keyword uri: Gets or sets the uri of the runbook content.
:paramtype uri: str
:keyword content_hash: Gets or sets the hash.
:paramtype content_hash: ~azure.mgmt.automation.models.ContentHash
:keyword version: Gets or sets the version of the content.
:paramtype version: str
"""
super(ContentLink, self).__init__(**kwargs)
self.uri = uri
self.content_hash = content_hash
self.version = version
class ContentSource(msrest.serialization.Model):
"""Definition of the content source.
:ivar hash: Gets or sets the hash.
:vartype hash: ~azure.mgmt.automation.models.ContentHash
:ivar type: Gets or sets the content source type. Known values are: "embeddedContent", "uri".
:vartype type: str or ~azure.mgmt.automation.models.ContentSourceType
:ivar value: Gets or sets the value of the content. This is based on the content source type.
:vartype value: str
:ivar version: Gets or sets the version of the content.
:vartype version: str
"""
_attribute_map = {
'hash': {'key': 'hash', 'type': 'ContentHash'},
'type': {'key': 'type', 'type': 'str'},
'value': {'key': 'value', 'type': 'str'},
'version': {'key': 'version', 'type': 'str'},
}
def __init__(
self,
*,
hash: Optional["_models.ContentHash"] = None,
type: Optional[Union[str, "_models.ContentSourceType"]] = None,
value: Optional[str] = None,
version: Optional[str] = None,
**kwargs
):
"""
:keyword hash: Gets or sets the hash.
:paramtype hash: ~azure.mgmt.automation.models.ContentHash
:keyword type: Gets or sets the content source type. Known values are: "embeddedContent",
"uri".
:paramtype type: str or ~azure.mgmt.automation.models.ContentSourceType
:keyword value: Gets or sets the value of the content. This is based on the content source
type.
:paramtype value: str
:keyword version: Gets or sets the version of the content.
:paramtype version: str
"""
super(ContentSource, self).__init__(**kwargs)
self.hash = hash
self.type = type
self.value = value
self.version = version
class Credential(ProxyResource):
"""Definition of the credential.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar user_name: Gets the user name of the credential.
:vartype user_name: str
:ivar creation_time: Gets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'user_name': {'readonly': True},
'creation_time': {'readonly': True},
'last_modified_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'user_name': {'key': 'properties.userName', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
description: Optional[str] = None,
**kwargs
):
"""
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Credential, self).__init__(**kwargs)
self.user_name = None
self.creation_time = None
self.last_modified_time = None
self.description = description
class CredentialCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update credential operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the credential.
:vartype name: str
:ivar user_name: Required. Gets or sets the user name of the credential.
:vartype user_name: str
:ivar password: Required. Gets or sets the password of the credential.
:vartype password: str
:ivar description: Gets or sets the description of the credential.
:vartype description: str
"""
_validation = {
'name': {'required': True},
'user_name': {'required': True},
'password': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'user_name': {'key': 'properties.userName', 'type': 'str'},
'password': {'key': 'properties.password', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
name: str,
user_name: str,
password: str,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the credential.
:paramtype name: str
:keyword user_name: Required. Gets or sets the user name of the credential.
:paramtype user_name: str
:keyword password: Required. Gets or sets the password of the credential.
:paramtype password: str
:keyword description: Gets or sets the description of the credential.
:paramtype description: str
"""
super(CredentialCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.user_name = user_name
self.password = password
self.description = description
class CredentialListResult(msrest.serialization.Model):
"""The response model for the list credential operation.
:ivar value: Gets or sets a list of credentials.
:vartype value: list[~azure.mgmt.automation.models.Credential]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Credential]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Credential"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of credentials.
:paramtype value: list[~azure.mgmt.automation.models.Credential]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(CredentialListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class CredentialUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the Update credential operation.
:ivar name: Gets or sets the name of the credential.
:vartype name: str
:ivar user_name: Gets or sets the user name of the credential.
:vartype user_name: str
:ivar password: Gets or sets the password of the credential.
:vartype password: str
:ivar description: Gets or sets the description of the credential.
:vartype description: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'user_name': {'key': 'properties.userName', 'type': 'str'},
'password': {'key': 'properties.password', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
user_name: Optional[str] = None,
password: Optional[str] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the credential.
:paramtype name: str
:keyword user_name: Gets or sets the user name of the credential.
:paramtype user_name: str
:keyword password: Gets or sets the password of the credential.
:paramtype password: str
:keyword description: Gets or sets the description of the credential.
:paramtype description: str
"""
super(CredentialUpdateParameters, self).__init__(**kwargs)
self.name = name
self.user_name = user_name
self.password = password
self.description = description
class DscCompilationJob(ProxyResource):
"""Definition of the Dsc Compilation job.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar configuration: Gets or sets the configuration.
:vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:ivar started_by: Gets the compilation job started by.
:vartype started_by: str
:ivar job_id: Gets the id of the job.
:vartype job_id: str
:ivar creation_time: Gets the creation time of the job.
:vartype creation_time: ~datetime.datetime
:ivar provisioning_state: The current provisioning state of the job. Known values are:
"Failed", "Succeeded", "Suspended", "Processing".
:vartype provisioning_state: str or ~azure.mgmt.automation.models.JobProvisioningState
:ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:vartype run_on: str
:ivar status: Gets or sets the status of the job. Known values are: "New", "Activating",
"Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected",
"Suspending", "Stopping", "Resuming", "Removing".
:vartype status: str or ~azure.mgmt.automation.models.JobStatus
:ivar status_details: Gets or sets the status details of the job.
:vartype status_details: str
:ivar start_time: Gets the start time of the job.
:vartype start_time: ~datetime.datetime
:ivar end_time: Gets the end time of the job.
:vartype end_time: ~datetime.datetime
:ivar exception: Gets the exception of the job.
:vartype exception: str
:ivar last_modified_time: Gets the last modified time of the job.
:vartype last_modified_time: ~datetime.datetime
:ivar last_status_modified_time: Gets the last status modified time of the job.
:vartype last_status_modified_time: ~datetime.datetime
:ivar parameters: Gets or sets the parameters of the job.
:vartype parameters: dict[str, str]
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'started_by': {'readonly': True},
'job_id': {'readonly': True},
'creation_time': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
'exception': {'readonly': True},
'last_modified_time': {'readonly': True},
'last_status_modified_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'configuration': {'key': 'properties.configuration', 'type': 'DscConfigurationAssociationProperty'},
'started_by': {'key': 'properties.startedBy', 'type': 'str'},
'job_id': {'key': 'properties.jobId', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
'status': {'key': 'properties.status', 'type': 'str'},
'status_details': {'key': 'properties.statusDetails', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'exception': {'key': 'properties.exception', 'type': 'str'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_status_modified_time': {'key': 'properties.lastStatusModifiedTime', 'type': 'iso-8601'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
}
def __init__(
self,
*,
configuration: Optional["_models.DscConfigurationAssociationProperty"] = None,
provisioning_state: Optional[Union[str, "_models.JobProvisioningState"]] = None,
run_on: Optional[str] = None,
status: Optional[Union[str, "_models.JobStatus"]] = None,
status_details: Optional[str] = None,
parameters: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword configuration: Gets or sets the configuration.
:paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:keyword provisioning_state: The current provisioning state of the job. Known values are:
"Failed", "Succeeded", "Suspended", "Processing".
:paramtype provisioning_state: str or ~azure.mgmt.automation.models.JobProvisioningState
:keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:paramtype run_on: str
:keyword status: Gets or sets the status of the job. Known values are: "New", "Activating",
"Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected",
"Suspending", "Stopping", "Resuming", "Removing".
:paramtype status: str or ~azure.mgmt.automation.models.JobStatus
:keyword status_details: Gets or sets the status details of the job.
:paramtype status_details: str
:keyword parameters: Gets or sets the parameters of the job.
:paramtype parameters: dict[str, str]
"""
super(DscCompilationJob, self).__init__(**kwargs)
self.configuration = configuration
self.started_by = None
self.job_id = None
self.creation_time = None
self.provisioning_state = provisioning_state
self.run_on = run_on
self.status = status
self.status_details = status_details
self.start_time = None
self.end_time = None
self.exception = None
self.last_modified_time = None
self.last_status_modified_time = None
self.parameters = parameters
class DscCompilationJobCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create compilation job operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Gets or sets name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar configuration: Required. Gets or sets the configuration.
:vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:ivar parameters: Gets or sets the parameters of the job.
:vartype parameters: dict[str, str]
:ivar increment_node_configuration_build: If a new build version of NodeConfiguration is
required.
:vartype increment_node_configuration_build: bool
"""
_validation = {
'configuration': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'configuration': {'key': 'properties.configuration', 'type': 'DscConfigurationAssociationProperty'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
'increment_node_configuration_build': {'key': 'properties.incrementNodeConfigurationBuild', 'type': 'bool'},
}
def __init__(
self,
*,
configuration: "_models.DscConfigurationAssociationProperty",
name: Optional[str] = None,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
parameters: Optional[Dict[str, str]] = None,
increment_node_configuration_build: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Gets or sets name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword configuration: Required. Gets or sets the configuration.
:paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:keyword parameters: Gets or sets the parameters of the job.
:paramtype parameters: dict[str, str]
:keyword increment_node_configuration_build: If a new build version of NodeConfiguration is
required.
:paramtype increment_node_configuration_build: bool
"""
super(DscCompilationJobCreateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.tags = tags
self.configuration = configuration
self.parameters = parameters
self.increment_node_configuration_build = increment_node_configuration_build
class DscCompilationJobListResult(msrest.serialization.Model):
"""The response model for the list job operation.
:ivar value: Gets or sets a list of Dsc Compilation jobs.
:vartype value: list[~azure.mgmt.automation.models.DscCompilationJob]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[DscCompilationJob]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.DscCompilationJob"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of Dsc Compilation jobs.
:paramtype value: list[~azure.mgmt.automation.models.DscCompilationJob]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(DscCompilationJobListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class DscConfiguration(TrackedResource):
"""Definition of the configuration type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar tags: A set of tags. Resource tags.
:vartype tags: dict[str, str]
:ivar location: The Azure Region where the resource lives.
:vartype location: str
:ivar etag: Gets or sets the etag of the resource.
:vartype etag: str
:ivar provisioning_state: Gets or sets the provisioning state of the configuration. The only
acceptable values to pass in are None and "Succeeded". The default value is None.
:vartype provisioning_state: str
:ivar job_count: Gets or sets the job count of the configuration.
:vartype job_count: int
:ivar parameters: Gets or sets the configuration parameters.
:vartype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter]
:ivar source: Gets or sets the source.
:vartype source: ~azure.mgmt.automation.models.ContentSource
:ivar state: Gets or sets the state of the configuration. Known values are: "New", "Edit",
"Published".
:vartype state: str or ~azure.mgmt.automation.models.DscConfigurationState
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar node_configuration_count: Gets the number of compiled node configurations.
:vartype node_configuration_count: int
:ivar description: Gets or sets the description.
:vartype description: 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'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'job_count': {'key': 'properties.jobCount', 'type': 'int'},
'parameters': {'key': 'properties.parameters', 'type': '{DscConfigurationParameter}'},
'source': {'key': 'properties.source', 'type': 'ContentSource'},
'state': {'key': 'properties.state', 'type': 'str'},
'log_verbose': {'key': 'properties.logVerbose', 'type': 'bool'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'node_configuration_count': {'key': 'properties.nodeConfigurationCount', 'type': 'int'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
etag: Optional[str] = None,
provisioning_state: Optional[str] = None,
job_count: Optional[int] = None,
parameters: Optional[Dict[str, "_models.DscConfigurationParameter"]] = None,
source: Optional["_models.ContentSource"] = None,
state: Optional[Union[str, "_models.DscConfigurationState"]] = None,
log_verbose: Optional[bool] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
node_configuration_count: Optional[int] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The Azure Region where the resource lives.
:paramtype location: str
:keyword etag: Gets or sets the etag of the resource.
:paramtype etag: str
:keyword provisioning_state: Gets or sets the provisioning state of the configuration. The only
acceptable values to pass in are None and "Succeeded". The default value is None.
:paramtype provisioning_state: str
:keyword job_count: Gets or sets the job count of the configuration.
:paramtype job_count: int
:keyword parameters: Gets or sets the configuration parameters.
:paramtype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter]
:keyword source: Gets or sets the source.
:paramtype source: ~azure.mgmt.automation.models.ContentSource
:keyword state: Gets or sets the state of the configuration. Known values are: "New", "Edit",
"Published".
:paramtype state: str or ~azure.mgmt.automation.models.DscConfigurationState
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword node_configuration_count: Gets the number of compiled node configurations.
:paramtype node_configuration_count: int
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(DscConfiguration, self).__init__(tags=tags, location=location, **kwargs)
self.etag = etag
self.provisioning_state = provisioning_state
self.job_count = job_count
self.parameters = parameters
self.source = source
self.state = state
self.log_verbose = log_verbose
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.node_configuration_count = node_configuration_count
self.description = description
class DscConfigurationAssociationProperty(msrest.serialization.Model):
"""The Dsc configuration property associated with the entity.
:ivar name: Gets or sets the name of the Dsc configuration.
:vartype name: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the Dsc configuration.
:paramtype name: str
"""
super(DscConfigurationAssociationProperty, self).__init__(**kwargs)
self.name = name
class DscConfigurationCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update configuration operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Gets or sets name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar log_progress: Gets or sets progress log option.
:vartype log_progress: bool
:ivar source: Required. Gets or sets the source.
:vartype source: ~azure.mgmt.automation.models.ContentSource
:ivar parameters: Gets or sets the configuration parameters.
:vartype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter]
:ivar description: Gets or sets the description of the configuration.
:vartype description: str
"""
_validation = {
'source': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'log_verbose': {'key': 'properties.logVerbose', 'type': 'bool'},
'log_progress': {'key': 'properties.logProgress', 'type': 'bool'},
'source': {'key': 'properties.source', 'type': 'ContentSource'},
'parameters': {'key': 'properties.parameters', 'type': '{DscConfigurationParameter}'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
source: "_models.ContentSource",
name: Optional[str] = None,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
log_verbose: Optional[bool] = None,
log_progress: Optional[bool] = None,
parameters: Optional[Dict[str, "_models.DscConfigurationParameter"]] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword log_progress: Gets or sets progress log option.
:paramtype log_progress: bool
:keyword source: Required. Gets or sets the source.
:paramtype source: ~azure.mgmt.automation.models.ContentSource
:keyword parameters: Gets or sets the configuration parameters.
:paramtype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter]
:keyword description: Gets or sets the description of the configuration.
:paramtype description: str
"""
super(DscConfigurationCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.tags = tags
self.log_verbose = log_verbose
self.log_progress = log_progress
self.source = source
self.parameters = parameters
self.description = description
class DscConfigurationListResult(msrest.serialization.Model):
"""The response model for the list configuration operation.
:ivar value: Gets or sets a list of configurations.
:vartype value: list[~azure.mgmt.automation.models.DscConfiguration]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
:ivar total_count: Gets the total number of configurations matching filter criteria.
:vartype total_count: int
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[DscConfiguration]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
'total_count': {'key': 'totalCount', 'type': 'int'},
}
def __init__(
self,
*,
value: Optional[List["_models.DscConfiguration"]] = None,
next_link: Optional[str] = None,
total_count: Optional[int] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of configurations.
:paramtype value: list[~azure.mgmt.automation.models.DscConfiguration]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
:keyword total_count: Gets the total number of configurations matching filter criteria.
:paramtype total_count: int
"""
super(DscConfigurationListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
self.total_count = total_count
class DscConfigurationParameter(msrest.serialization.Model):
"""Definition of the configuration parameter type.
:ivar type: Gets or sets the type of the parameter.
:vartype type: str
:ivar is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is mandatory
or not.
:vartype is_mandatory: bool
:ivar position: Get or sets the position of the parameter.
:vartype position: int
:ivar default_value: Gets or sets the default value of parameter.
:vartype default_value: str
"""
_attribute_map = {
'type': {'key': 'type', 'type': 'str'},
'is_mandatory': {'key': 'isMandatory', 'type': 'bool'},
'position': {'key': 'position', 'type': 'int'},
'default_value': {'key': 'defaultValue', 'type': 'str'},
}
def __init__(
self,
*,
type: Optional[str] = None,
is_mandatory: Optional[bool] = None,
position: Optional[int] = None,
default_value: Optional[str] = None,
**kwargs
):
"""
:keyword type: Gets or sets the type of the parameter.
:paramtype type: str
:keyword is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is
mandatory or not.
:paramtype is_mandatory: bool
:keyword position: Get or sets the position of the parameter.
:paramtype position: int
:keyword default_value: Gets or sets the default value of parameter.
:paramtype default_value: str
"""
super(DscConfigurationParameter, self).__init__(**kwargs)
self.type = type
self.is_mandatory = is_mandatory
self.position = position
self.default_value = default_value
class DscConfigurationUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update configuration operation.
:ivar name: Gets or sets name of the resource.
:vartype name: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar log_progress: Gets or sets progress log option.
:vartype log_progress: bool
:ivar source: Gets or sets the source.
:vartype source: ~azure.mgmt.automation.models.ContentSource
:ivar parameters: Gets or sets the configuration parameters.
:vartype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter]
:ivar description: Gets or sets the description of the configuration.
:vartype description: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'log_verbose': {'key': 'properties.logVerbose', 'type': 'bool'},
'log_progress': {'key': 'properties.logProgress', 'type': 'bool'},
'source': {'key': 'properties.source', 'type': 'ContentSource'},
'parameters': {'key': 'properties.parameters', 'type': '{DscConfigurationParameter}'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
log_verbose: Optional[bool] = None,
log_progress: Optional[bool] = None,
source: Optional["_models.ContentSource"] = None,
parameters: Optional[Dict[str, "_models.DscConfigurationParameter"]] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets name of the resource.
:paramtype name: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword log_progress: Gets or sets progress log option.
:paramtype log_progress: bool
:keyword source: Gets or sets the source.
:paramtype source: ~azure.mgmt.automation.models.ContentSource
:keyword parameters: Gets or sets the configuration parameters.
:paramtype parameters: dict[str, ~azure.mgmt.automation.models.DscConfigurationParameter]
:keyword description: Gets or sets the description of the configuration.
:paramtype description: str
"""
super(DscConfigurationUpdateParameters, self).__init__(**kwargs)
self.name = name
self.tags = tags
self.log_verbose = log_verbose
self.log_progress = log_progress
self.source = source
self.parameters = parameters
self.description = description
class DscMetaConfiguration(msrest.serialization.Model):
"""Definition of the DSC Meta Configuration.
:ivar configuration_mode_frequency_mins: Gets or sets the ConfigurationModeFrequencyMins value
of the meta configuration.
:vartype configuration_mode_frequency_mins: int
:ivar reboot_node_if_needed: Gets or sets the RebootNodeIfNeeded value of the meta
configuration.
:vartype reboot_node_if_needed: bool
:ivar configuration_mode: Gets or sets the ConfigurationMode value of the meta configuration.
:vartype configuration_mode: str
:ivar action_after_reboot: Gets or sets the ActionAfterReboot value of the meta configuration.
:vartype action_after_reboot: str
:ivar certificate_id: Gets or sets the CertificateId value of the meta configuration.
:vartype certificate_id: str
:ivar refresh_frequency_mins: Gets or sets the RefreshFrequencyMins value of the meta
configuration.
:vartype refresh_frequency_mins: int
:ivar allow_module_overwrite: Gets or sets the AllowModuleOverwrite value of the meta
configuration.
:vartype allow_module_overwrite: bool
"""
_attribute_map = {
'configuration_mode_frequency_mins': {'key': 'configurationModeFrequencyMins', 'type': 'int'},
'reboot_node_if_needed': {'key': 'rebootNodeIfNeeded', 'type': 'bool'},
'configuration_mode': {'key': 'configurationMode', 'type': 'str'},
'action_after_reboot': {'key': 'actionAfterReboot', 'type': 'str'},
'certificate_id': {'key': 'certificateId', 'type': 'str'},
'refresh_frequency_mins': {'key': 'refreshFrequencyMins', 'type': 'int'},
'allow_module_overwrite': {'key': 'allowModuleOverwrite', 'type': 'bool'},
}
def __init__(
self,
*,
configuration_mode_frequency_mins: Optional[int] = None,
reboot_node_if_needed: Optional[bool] = None,
configuration_mode: Optional[str] = None,
action_after_reboot: Optional[str] = None,
certificate_id: Optional[str] = None,
refresh_frequency_mins: Optional[int] = None,
allow_module_overwrite: Optional[bool] = None,
**kwargs
):
"""
:keyword configuration_mode_frequency_mins: Gets or sets the ConfigurationModeFrequencyMins
value of the meta configuration.
:paramtype configuration_mode_frequency_mins: int
:keyword reboot_node_if_needed: Gets or sets the RebootNodeIfNeeded value of the meta
configuration.
:paramtype reboot_node_if_needed: bool
:keyword configuration_mode: Gets or sets the ConfigurationMode value of the meta
configuration.
:paramtype configuration_mode: str
:keyword action_after_reboot: Gets or sets the ActionAfterReboot value of the meta
configuration.
:paramtype action_after_reboot: str
:keyword certificate_id: Gets or sets the CertificateId value of the meta configuration.
:paramtype certificate_id: str
:keyword refresh_frequency_mins: Gets or sets the RefreshFrequencyMins value of the meta
configuration.
:paramtype refresh_frequency_mins: int
:keyword allow_module_overwrite: Gets or sets the AllowModuleOverwrite value of the meta
configuration.
:paramtype allow_module_overwrite: bool
"""
super(DscMetaConfiguration, self).__init__(**kwargs)
self.configuration_mode_frequency_mins = configuration_mode_frequency_mins
self.reboot_node_if_needed = reboot_node_if_needed
self.configuration_mode = configuration_mode
self.action_after_reboot = action_after_reboot
self.certificate_id = certificate_id
self.refresh_frequency_mins = refresh_frequency_mins
self.allow_module_overwrite = allow_module_overwrite
class DscNode(ProxyResource):
"""Definition of a DscNode.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar last_seen: Gets or sets the last seen time of the node.
:vartype last_seen: ~datetime.datetime
:ivar registration_time: Gets or sets the registration time of the node.
:vartype registration_time: ~datetime.datetime
:ivar ip: Gets or sets the ip of the node.
:vartype ip: str
:ivar account_id: Gets or sets the account id of the node.
:vartype account_id: str
:ivar status: Gets or sets the status of the node.
:vartype status: str
:ivar node_id: Gets or sets the node id.
:vartype node_id: str
:ivar etag: Gets or sets the etag of the resource.
:vartype etag: str
:ivar total_count: Gets the total number of records matching filter criteria.
:vartype total_count: int
:ivar extension_handler: Gets or sets the list of extensionHandler properties for a Node.
:vartype extension_handler:
list[~azure.mgmt.automation.models.DscNodeExtensionHandlerAssociationProperty]
:ivar name_properties_node_configuration_name: Gets or sets the name of the dsc node
configuration.
:vartype name_properties_node_configuration_name: 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'},
'last_seen': {'key': 'properties.lastSeen', 'type': 'iso-8601'},
'registration_time': {'key': 'properties.registrationTime', 'type': 'iso-8601'},
'ip': {'key': 'properties.ip', 'type': 'str'},
'account_id': {'key': 'properties.accountId', 'type': 'str'},
'status': {'key': 'properties.status', 'type': 'str'},
'node_id': {'key': 'properties.nodeId', 'type': 'str'},
'etag': {'key': 'properties.etag', 'type': 'str'},
'total_count': {'key': 'properties.totalCount', 'type': 'int'},
'extension_handler': {'key': 'properties.extensionHandler', 'type': '[DscNodeExtensionHandlerAssociationProperty]'},
'name_properties_node_configuration_name': {'key': 'properties.nodeConfiguration.name', 'type': 'str'},
}
def __init__(
self,
*,
last_seen: Optional[datetime.datetime] = None,
registration_time: Optional[datetime.datetime] = None,
ip: Optional[str] = None,
account_id: Optional[str] = None,
status: Optional[str] = None,
node_id: Optional[str] = None,
etag: Optional[str] = None,
total_count: Optional[int] = None,
extension_handler: Optional[List["_models.DscNodeExtensionHandlerAssociationProperty"]] = None,
name_properties_node_configuration_name: Optional[str] = None,
**kwargs
):
"""
:keyword last_seen: Gets or sets the last seen time of the node.
:paramtype last_seen: ~datetime.datetime
:keyword registration_time: Gets or sets the registration time of the node.
:paramtype registration_time: ~datetime.datetime
:keyword ip: Gets or sets the ip of the node.
:paramtype ip: str
:keyword account_id: Gets or sets the account id of the node.
:paramtype account_id: str
:keyword status: Gets or sets the status of the node.
:paramtype status: str
:keyword node_id: Gets or sets the node id.
:paramtype node_id: str
:keyword etag: Gets or sets the etag of the resource.
:paramtype etag: str
:keyword total_count: Gets the total number of records matching filter criteria.
:paramtype total_count: int
:keyword extension_handler: Gets or sets the list of extensionHandler properties for a Node.
:paramtype extension_handler:
list[~azure.mgmt.automation.models.DscNodeExtensionHandlerAssociationProperty]
:keyword name_properties_node_configuration_name: Gets or sets the name of the dsc node
configuration.
:paramtype name_properties_node_configuration_name: str
"""
super(DscNode, self).__init__(**kwargs)
self.last_seen = last_seen
self.registration_time = registration_time
self.ip = ip
self.account_id = account_id
self.status = status
self.node_id = node_id
self.etag = etag
self.total_count = total_count
self.extension_handler = extension_handler
self.name_properties_node_configuration_name = name_properties_node_configuration_name
class DscNodeConfiguration(ProxyResource):
"""Definition of the dsc node configuration.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar creation_time: Gets or sets creation time.
:vartype creation_time: ~datetime.datetime
:ivar configuration: Gets or sets the configuration of the node.
:vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:ivar source: Source of node configuration.
:vartype source: str
:ivar node_count: Number of nodes with this node configuration assigned.
:vartype node_count: long
:ivar increment_node_configuration_build: If a new build version of NodeConfiguration is
required.
:vartype increment_node_configuration_build: bool
"""
_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'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'configuration': {'key': 'properties.configuration', 'type': 'DscConfigurationAssociationProperty'},
'source': {'key': 'properties.source', 'type': 'str'},
'node_count': {'key': 'properties.nodeCount', 'type': 'long'},
'increment_node_configuration_build': {'key': 'properties.incrementNodeConfigurationBuild', 'type': 'bool'},
}
def __init__(
self,
*,
last_modified_time: Optional[datetime.datetime] = None,
creation_time: Optional[datetime.datetime] = None,
configuration: Optional["_models.DscConfigurationAssociationProperty"] = None,
source: Optional[str] = None,
node_count: Optional[int] = None,
increment_node_configuration_build: Optional[bool] = None,
**kwargs
):
"""
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword creation_time: Gets or sets creation time.
:paramtype creation_time: ~datetime.datetime
:keyword configuration: Gets or sets the configuration of the node.
:paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:keyword source: Source of node configuration.
:paramtype source: str
:keyword node_count: Number of nodes with this node configuration assigned.
:paramtype node_count: long
:keyword increment_node_configuration_build: If a new build version of NodeConfiguration is
required.
:paramtype increment_node_configuration_build: bool
"""
super(DscNodeConfiguration, self).__init__(**kwargs)
self.last_modified_time = last_modified_time
self.creation_time = creation_time
self.configuration = configuration
self.source = source
self.node_count = node_count
self.increment_node_configuration_build = increment_node_configuration_build
class DscNodeConfigurationCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update node configuration operation.
:ivar name: Name of the node configuration.
:vartype name: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar source: Gets or sets the source.
:vartype source: ~azure.mgmt.automation.models.ContentSource
:ivar configuration: Gets or sets the configuration of the node.
:vartype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:ivar increment_node_configuration_build: If a new build version of NodeConfiguration is
required.
:vartype increment_node_configuration_build: bool
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'source': {'key': 'properties.source', 'type': 'ContentSource'},
'configuration': {'key': 'properties.configuration', 'type': 'DscConfigurationAssociationProperty'},
'increment_node_configuration_build': {'key': 'properties.incrementNodeConfigurationBuild', 'type': 'bool'},
}
def __init__(
self,
*,
name: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
source: Optional["_models.ContentSource"] = None,
configuration: Optional["_models.DscConfigurationAssociationProperty"] = None,
increment_node_configuration_build: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Name of the node configuration.
:paramtype name: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword source: Gets or sets the source.
:paramtype source: ~azure.mgmt.automation.models.ContentSource
:keyword configuration: Gets or sets the configuration of the node.
:paramtype configuration: ~azure.mgmt.automation.models.DscConfigurationAssociationProperty
:keyword increment_node_configuration_build: If a new build version of NodeConfiguration is
required.
:paramtype increment_node_configuration_build: bool
"""
super(DscNodeConfigurationCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.tags = tags
self.source = source
self.configuration = configuration
self.increment_node_configuration_build = increment_node_configuration_build
class DscNodeConfigurationListResult(msrest.serialization.Model):
"""The response model for the list job operation.
:ivar value: Gets or sets a list of Dsc node configurations.
:vartype value: list[~azure.mgmt.automation.models.DscNodeConfiguration]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
:ivar total_count: Gets or sets the total rows in query.
:vartype total_count: int
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[DscNodeConfiguration]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
'total_count': {'key': 'totalCount', 'type': 'int'},
}
def __init__(
self,
*,
value: Optional[List["_models.DscNodeConfiguration"]] = None,
next_link: Optional[str] = None,
total_count: Optional[int] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of Dsc node configurations.
:paramtype value: list[~azure.mgmt.automation.models.DscNodeConfiguration]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
:keyword total_count: Gets or sets the total rows in query.
:paramtype total_count: int
"""
super(DscNodeConfigurationListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
self.total_count = total_count
class DscNodeExtensionHandlerAssociationProperty(msrest.serialization.Model):
"""The dsc extensionHandler property associated with the node.
:ivar name: Gets or sets the name of the extension handler.
:vartype name: str
:ivar version: Gets or sets the version of the extension handler.
:vartype version: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'version': {'key': 'version', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
version: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the extension handler.
:paramtype name: str
:keyword version: Gets or sets the version of the extension handler.
:paramtype version: str
"""
super(DscNodeExtensionHandlerAssociationProperty, self).__init__(**kwargs)
self.name = name
self.version = version
class DscNodeListResult(msrest.serialization.Model):
"""The response model for the list dsc nodes operation.
:ivar value: Gets or sets a list of dsc nodes.
:vartype value: list[~azure.mgmt.automation.models.DscNode]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
:ivar total_count: Gets the total number of nodes matching filter criteria.
:vartype total_count: int
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[DscNode]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
'total_count': {'key': 'totalCount', 'type': 'int'},
}
def __init__(
self,
*,
value: Optional[List["_models.DscNode"]] = None,
next_link: Optional[str] = None,
total_count: Optional[int] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of dsc nodes.
:paramtype value: list[~azure.mgmt.automation.models.DscNode]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
:keyword total_count: Gets the total number of nodes matching filter criteria.
:paramtype total_count: int
"""
super(DscNodeListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
self.total_count = total_count
class DscNodeReport(msrest.serialization.Model):
"""Definition of the dsc node report type.
:ivar end_time: Gets or sets the end time of the node report.
:vartype end_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the lastModifiedTime of the node report.
:vartype last_modified_time: ~datetime.datetime
:ivar start_time: Gets or sets the start time of the node report.
:vartype start_time: ~datetime.datetime
:ivar type: Gets or sets the type of the node report.
:vartype type: str
:ivar report_id: Gets or sets the id of the node report.
:vartype report_id: str
:ivar status: Gets or sets the status of the node report.
:vartype status: str
:ivar refresh_mode: Gets or sets the refreshMode of the node report.
:vartype refresh_mode: str
:ivar reboot_requested: Gets or sets the rebootRequested of the node report.
:vartype reboot_requested: str
:ivar report_format_version: Gets or sets the reportFormatVersion of the node report.
:vartype report_format_version: str
:ivar configuration_version: Gets or sets the configurationVersion of the node report.
:vartype configuration_version: str
:ivar id: Gets or sets the id.
:vartype id: str
:ivar errors: Gets or sets the errors for the node report.
:vartype errors: list[~azure.mgmt.automation.models.DscReportError]
:ivar resources: Gets or sets the resource for the node report.
:vartype resources: list[~azure.mgmt.automation.models.DscReportResource]
:ivar meta_configuration: Gets or sets the metaConfiguration of the node at the time of the
report.
:vartype meta_configuration: ~azure.mgmt.automation.models.DscMetaConfiguration
:ivar host_name: Gets or sets the hostname of the node that sent the report.
:vartype host_name: str
:ivar i_pv4_addresses: Gets or sets the IPv4 address of the node that sent the report.
:vartype i_pv4_addresses: list[str]
:ivar i_pv6_addresses: Gets or sets the IPv6 address of the node that sent the report.
:vartype i_pv6_addresses: list[str]
:ivar number_of_resources: Gets or sets the number of resource in the node report.
:vartype number_of_resources: int
:ivar raw_errors: Gets or sets the unparsed errors for the node report.
:vartype raw_errors: str
"""
_attribute_map = {
'end_time': {'key': 'endTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'},
'start_time': {'key': 'startTime', 'type': 'iso-8601'},
'type': {'key': 'type', 'type': 'str'},
'report_id': {'key': 'reportId', 'type': 'str'},
'status': {'key': 'status', 'type': 'str'},
'refresh_mode': {'key': 'refreshMode', 'type': 'str'},
'reboot_requested': {'key': 'rebootRequested', 'type': 'str'},
'report_format_version': {'key': 'reportFormatVersion', 'type': 'str'},
'configuration_version': {'key': 'configurationVersion', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'errors': {'key': 'errors', 'type': '[DscReportError]'},
'resources': {'key': 'resources', 'type': '[DscReportResource]'},
'meta_configuration': {'key': 'metaConfiguration', 'type': 'DscMetaConfiguration'},
'host_name': {'key': 'hostName', 'type': 'str'},
'i_pv4_addresses': {'key': 'iPV4Addresses', 'type': '[str]'},
'i_pv6_addresses': {'key': 'iPV6Addresses', 'type': '[str]'},
'number_of_resources': {'key': 'numberOfResources', 'type': 'int'},
'raw_errors': {'key': 'rawErrors', 'type': 'str'},
}
def __init__(
self,
*,
end_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
start_time: Optional[datetime.datetime] = None,
type: Optional[str] = None,
report_id: Optional[str] = None,
status: Optional[str] = None,
refresh_mode: Optional[str] = None,
reboot_requested: Optional[str] = None,
report_format_version: Optional[str] = None,
configuration_version: Optional[str] = None,
id: Optional[str] = None,
errors: Optional[List["_models.DscReportError"]] = None,
resources: Optional[List["_models.DscReportResource"]] = None,
meta_configuration: Optional["_models.DscMetaConfiguration"] = None,
host_name: Optional[str] = None,
i_pv4_addresses: Optional[List[str]] = None,
i_pv6_addresses: Optional[List[str]] = None,
number_of_resources: Optional[int] = None,
raw_errors: Optional[str] = None,
**kwargs
):
"""
:keyword end_time: Gets or sets the end time of the node report.
:paramtype end_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the lastModifiedTime of the node report.
:paramtype last_modified_time: ~datetime.datetime
:keyword start_time: Gets or sets the start time of the node report.
:paramtype start_time: ~datetime.datetime
:keyword type: Gets or sets the type of the node report.
:paramtype type: str
:keyword report_id: Gets or sets the id of the node report.
:paramtype report_id: str
:keyword status: Gets or sets the status of the node report.
:paramtype status: str
:keyword refresh_mode: Gets or sets the refreshMode of the node report.
:paramtype refresh_mode: str
:keyword reboot_requested: Gets or sets the rebootRequested of the node report.
:paramtype reboot_requested: str
:keyword report_format_version: Gets or sets the reportFormatVersion of the node report.
:paramtype report_format_version: str
:keyword configuration_version: Gets or sets the configurationVersion of the node report.
:paramtype configuration_version: str
:keyword id: Gets or sets the id.
:paramtype id: str
:keyword errors: Gets or sets the errors for the node report.
:paramtype errors: list[~azure.mgmt.automation.models.DscReportError]
:keyword resources: Gets or sets the resource for the node report.
:paramtype resources: list[~azure.mgmt.automation.models.DscReportResource]
:keyword meta_configuration: Gets or sets the metaConfiguration of the node at the time of the
report.
:paramtype meta_configuration: ~azure.mgmt.automation.models.DscMetaConfiguration
:keyword host_name: Gets or sets the hostname of the node that sent the report.
:paramtype host_name: str
:keyword i_pv4_addresses: Gets or sets the IPv4 address of the node that sent the report.
:paramtype i_pv4_addresses: list[str]
:keyword i_pv6_addresses: Gets or sets the IPv6 address of the node that sent the report.
:paramtype i_pv6_addresses: list[str]
:keyword number_of_resources: Gets or sets the number of resource in the node report.
:paramtype number_of_resources: int
:keyword raw_errors: Gets or sets the unparsed errors for the node report.
:paramtype raw_errors: str
"""
super(DscNodeReport, self).__init__(**kwargs)
self.end_time = end_time
self.last_modified_time = last_modified_time
self.start_time = start_time
self.type = type
self.report_id = report_id
self.status = status
self.refresh_mode = refresh_mode
self.reboot_requested = reboot_requested
self.report_format_version = report_format_version
self.configuration_version = configuration_version
self.id = id
self.errors = errors
self.resources = resources
self.meta_configuration = meta_configuration
self.host_name = host_name
self.i_pv4_addresses = i_pv4_addresses
self.i_pv6_addresses = i_pv6_addresses
self.number_of_resources = number_of_resources
self.raw_errors = raw_errors
class DscNodeReportListResult(msrest.serialization.Model):
"""The response model for the list dsc nodes operation.
:ivar value: Gets or sets a list of dsc node reports.
:vartype value: list[~azure.mgmt.automation.models.DscNodeReport]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[DscNodeReport]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.DscNodeReport"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of dsc node reports.
:paramtype value: list[~azure.mgmt.automation.models.DscNodeReport]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(DscNodeReportListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class DscNodeUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update dsc node operation.
:ivar node_id: Gets or sets the id of the dsc node.
:vartype node_id: str
:ivar properties:
:vartype properties: ~azure.mgmt.automation.models.DscNodeUpdateParametersProperties
"""
_attribute_map = {
'node_id': {'key': 'nodeId', 'type': 'str'},
'properties': {'key': 'properties', 'type': 'DscNodeUpdateParametersProperties'},
}
def __init__(
self,
*,
node_id: Optional[str] = None,
properties: Optional["_models.DscNodeUpdateParametersProperties"] = None,
**kwargs
):
"""
:keyword node_id: Gets or sets the id of the dsc node.
:paramtype node_id: str
:keyword properties:
:paramtype properties: ~azure.mgmt.automation.models.DscNodeUpdateParametersProperties
"""
super(DscNodeUpdateParameters, self).__init__(**kwargs)
self.node_id = node_id
self.properties = properties
class DscNodeUpdateParametersProperties(msrest.serialization.Model):
"""DscNodeUpdateParametersProperties.
:ivar name: Gets or sets the name of the dsc node configuration.
:vartype name: str
"""
_attribute_map = {
'name': {'key': 'nodeConfiguration.name', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the dsc node configuration.
:paramtype name: str
"""
super(DscNodeUpdateParametersProperties, self).__init__(**kwargs)
self.name = name
class DscReportError(msrest.serialization.Model):
"""Definition of the dsc node report error type.
:ivar error_source: Gets or sets the source of the error.
:vartype error_source: str
:ivar resource_id: Gets or sets the resource ID which generated the error.
:vartype resource_id: str
:ivar error_code: Gets or sets the error code.
:vartype error_code: str
:ivar error_message: Gets or sets the error message.
:vartype error_message: str
:ivar locale: Gets or sets the locale of the error.
:vartype locale: str
:ivar error_details: Gets or sets the error details.
:vartype error_details: str
"""
_attribute_map = {
'error_source': {'key': 'errorSource', 'type': 'str'},
'resource_id': {'key': 'resourceId', 'type': 'str'},
'error_code': {'key': 'errorCode', 'type': 'str'},
'error_message': {'key': 'errorMessage', 'type': 'str'},
'locale': {'key': 'locale', 'type': 'str'},
'error_details': {'key': 'errorDetails', 'type': 'str'},
}
def __init__(
self,
*,
error_source: Optional[str] = None,
resource_id: Optional[str] = None,
error_code: Optional[str] = None,
error_message: Optional[str] = None,
locale: Optional[str] = None,
error_details: Optional[str] = None,
**kwargs
):
"""
:keyword error_source: Gets or sets the source of the error.
:paramtype error_source: str
:keyword resource_id: Gets or sets the resource ID which generated the error.
:paramtype resource_id: str
:keyword error_code: Gets or sets the error code.
:paramtype error_code: str
:keyword error_message: Gets or sets the error message.
:paramtype error_message: str
:keyword locale: Gets or sets the locale of the error.
:paramtype locale: str
:keyword error_details: Gets or sets the error details.
:paramtype error_details: str
"""
super(DscReportError, self).__init__(**kwargs)
self.error_source = error_source
self.resource_id = resource_id
self.error_code = error_code
self.error_message = error_message
self.locale = locale
self.error_details = error_details
class DscReportResource(msrest.serialization.Model):
"""Definition of the DSC Report Resource.
:ivar resource_id: Gets or sets the ID of the resource.
:vartype resource_id: str
:ivar source_info: Gets or sets the source info of the resource.
:vartype source_info: str
:ivar depends_on: Gets or sets the Resource Navigation values for resources the resource
depends on.
:vartype depends_on: list[~azure.mgmt.automation.models.DscReportResourceNavigation]
:ivar module_name: Gets or sets the module name of the resource.
:vartype module_name: str
:ivar module_version: Gets or sets the module version of the resource.
:vartype module_version: str
:ivar resource_name: Gets or sets the name of the resource.
:vartype resource_name: str
:ivar error: Gets or sets the error of the resource.
:vartype error: str
:ivar status: Gets or sets the status of the resource.
:vartype status: str
:ivar duration_in_seconds: Gets or sets the duration in seconds for the resource.
:vartype duration_in_seconds: float
:ivar start_date: Gets or sets the start date of the resource.
:vartype start_date: ~datetime.datetime
"""
_attribute_map = {
'resource_id': {'key': 'resourceId', 'type': 'str'},
'source_info': {'key': 'sourceInfo', 'type': 'str'},
'depends_on': {'key': 'dependsOn', 'type': '[DscReportResourceNavigation]'},
'module_name': {'key': 'moduleName', 'type': 'str'},
'module_version': {'key': 'moduleVersion', 'type': 'str'},
'resource_name': {'key': 'resourceName', 'type': 'str'},
'error': {'key': 'error', 'type': 'str'},
'status': {'key': 'status', 'type': 'str'},
'duration_in_seconds': {'key': 'durationInSeconds', 'type': 'float'},
'start_date': {'key': 'startDate', 'type': 'iso-8601'},
}
def __init__(
self,
*,
resource_id: Optional[str] = None,
source_info: Optional[str] = None,
depends_on: Optional[List["_models.DscReportResourceNavigation"]] = None,
module_name: Optional[str] = None,
module_version: Optional[str] = None,
resource_name: Optional[str] = None,
error: Optional[str] = None,
status: Optional[str] = None,
duration_in_seconds: Optional[float] = None,
start_date: Optional[datetime.datetime] = None,
**kwargs
):
"""
:keyword resource_id: Gets or sets the ID of the resource.
:paramtype resource_id: str
:keyword source_info: Gets or sets the source info of the resource.
:paramtype source_info: str
:keyword depends_on: Gets or sets the Resource Navigation values for resources the resource
depends on.
:paramtype depends_on: list[~azure.mgmt.automation.models.DscReportResourceNavigation]
:keyword module_name: Gets or sets the module name of the resource.
:paramtype module_name: str
:keyword module_version: Gets or sets the module version of the resource.
:paramtype module_version: str
:keyword resource_name: Gets or sets the name of the resource.
:paramtype resource_name: str
:keyword error: Gets or sets the error of the resource.
:paramtype error: str
:keyword status: Gets or sets the status of the resource.
:paramtype status: str
:keyword duration_in_seconds: Gets or sets the duration in seconds for the resource.
:paramtype duration_in_seconds: float
:keyword start_date: Gets or sets the start date of the resource.
:paramtype start_date: ~datetime.datetime
"""
super(DscReportResource, self).__init__(**kwargs)
self.resource_id = resource_id
self.source_info = source_info
self.depends_on = depends_on
self.module_name = module_name
self.module_version = module_version
self.resource_name = resource_name
self.error = error
self.status = status
self.duration_in_seconds = duration_in_seconds
self.start_date = start_date
class DscReportResourceNavigation(msrest.serialization.Model):
"""Navigation for DSC Report Resource.
:ivar resource_id: Gets or sets the ID of the resource to navigate to.
:vartype resource_id: str
"""
_attribute_map = {
'resource_id': {'key': 'resourceId', 'type': 'str'},
}
def __init__(
self,
*,
resource_id: Optional[str] = None,
**kwargs
):
"""
:keyword resource_id: Gets or sets the ID of the resource to navigate to.
:paramtype resource_id: str
"""
super(DscReportResourceNavigation, self).__init__(**kwargs)
self.resource_id = resource_id
class EncryptionProperties(msrest.serialization.Model):
"""The encryption settings for automation account.
:ivar key_vault_properties: Key vault properties.
:vartype key_vault_properties: ~azure.mgmt.automation.models.KeyVaultProperties
:ivar key_source: Encryption Key Source. Known values are: "Microsoft.Automation",
"Microsoft.Keyvault".
:vartype key_source: str or ~azure.mgmt.automation.models.EncryptionKeySourceType
:ivar identity: User identity used for CMK.
:vartype identity: ~azure.mgmt.automation.models.EncryptionPropertiesIdentity
"""
_attribute_map = {
'key_vault_properties': {'key': 'keyVaultProperties', 'type': 'KeyVaultProperties'},
'key_source': {'key': 'keySource', 'type': 'str'},
'identity': {'key': 'identity', 'type': 'EncryptionPropertiesIdentity'},
}
def __init__(
self,
*,
key_vault_properties: Optional["_models.KeyVaultProperties"] = None,
key_source: Optional[Union[str, "_models.EncryptionKeySourceType"]] = None,
identity: Optional["_models.EncryptionPropertiesIdentity"] = None,
**kwargs
):
"""
:keyword key_vault_properties: Key vault properties.
:paramtype key_vault_properties: ~azure.mgmt.automation.models.KeyVaultProperties
:keyword key_source: Encryption Key Source. Known values are: "Microsoft.Automation",
"Microsoft.Keyvault".
:paramtype key_source: str or ~azure.mgmt.automation.models.EncryptionKeySourceType
:keyword identity: User identity used for CMK.
:paramtype identity: ~azure.mgmt.automation.models.EncryptionPropertiesIdentity
"""
super(EncryptionProperties, self).__init__(**kwargs)
self.key_vault_properties = key_vault_properties
self.key_source = key_source
self.identity = identity
class EncryptionPropertiesIdentity(msrest.serialization.Model):
"""User identity used for CMK.
:ivar user_assigned_identity: The user identity used for CMK. It will be an ARM resource id in
the form:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
:vartype user_assigned_identity: any
"""
_attribute_map = {
'user_assigned_identity': {'key': 'userAssignedIdentity', 'type': 'object'},
}
def __init__(
self,
*,
user_assigned_identity: Optional[Any] = None,
**kwargs
):
"""
:keyword user_assigned_identity: The user identity used for CMK. It will be an ARM resource id
in the form:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
:paramtype user_assigned_identity: any
"""
super(EncryptionPropertiesIdentity, self).__init__(**kwargs)
self.user_assigned_identity = user_assigned_identity
class ErrorResponse(msrest.serialization.Model):
"""Error response of an operation failure.
:ivar code: Error code.
:vartype code: str
:ivar message: Error message indicating why the operation failed.
:vartype message: str
"""
_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}
def __init__(
self,
*,
code: Optional[str] = None,
message: Optional[str] = None,
**kwargs
):
"""
:keyword code: Error code.
:paramtype code: str
:keyword message: Error message indicating why the operation failed.
:paramtype message: str
"""
super(ErrorResponse, self).__init__(**kwargs)
self.code = code
self.message = message
class FieldDefinition(msrest.serialization.Model):
"""Definition of the connection fields.
All required parameters must be populated in order to send to Azure.
:ivar is_encrypted: Gets or sets the isEncrypted flag of the connection field definition.
:vartype is_encrypted: bool
:ivar is_optional: Gets or sets the isOptional flag of the connection field definition.
:vartype is_optional: bool
:ivar type: Required. Gets or sets the type of the connection field definition.
:vartype type: str
"""
_validation = {
'type': {'required': True},
}
_attribute_map = {
'is_encrypted': {'key': 'isEncrypted', 'type': 'bool'},
'is_optional': {'key': 'isOptional', 'type': 'bool'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(
self,
*,
type: str,
is_encrypted: Optional[bool] = None,
is_optional: Optional[bool] = None,
**kwargs
):
"""
:keyword is_encrypted: Gets or sets the isEncrypted flag of the connection field definition.
:paramtype is_encrypted: bool
:keyword is_optional: Gets or sets the isOptional flag of the connection field definition.
:paramtype is_optional: bool
:keyword type: Required. Gets or sets the type of the connection field definition.
:paramtype type: str
"""
super(FieldDefinition, self).__init__(**kwargs)
self.is_encrypted = is_encrypted
self.is_optional = is_optional
self.type = type
class GraphicalRunbookContent(msrest.serialization.Model):
"""Graphical Runbook Content.
:ivar raw_content: Raw graphical Runbook content.
:vartype raw_content: ~azure.mgmt.automation.models.RawGraphicalRunbookContent
:ivar graph_runbook_json: Graphical Runbook content as JSON.
:vartype graph_runbook_json: str
"""
_attribute_map = {
'raw_content': {'key': 'rawContent', 'type': 'RawGraphicalRunbookContent'},
'graph_runbook_json': {'key': 'graphRunbookJson', 'type': 'str'},
}
def __init__(
self,
*,
raw_content: Optional["_models.RawGraphicalRunbookContent"] = None,
graph_runbook_json: Optional[str] = None,
**kwargs
):
"""
:keyword raw_content: Raw graphical Runbook content.
:paramtype raw_content: ~azure.mgmt.automation.models.RawGraphicalRunbookContent
:keyword graph_runbook_json: Graphical Runbook content as JSON.
:paramtype graph_runbook_json: str
"""
super(GraphicalRunbookContent, self).__init__(**kwargs)
self.raw_content = raw_content
self.graph_runbook_json = graph_runbook_json
class HybridRunbookWorker(Resource):
"""Definition of hybrid runbook worker.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar system_data: Resource system metadata.
:vartype system_data: ~azure.mgmt.automation.models.SystemData
:ivar ip: Gets or sets the assigned machine IP address.
:vartype ip: str
:ivar registered_date_time: Gets or sets the registration time of the worker machine.
:vartype registered_date_time: ~datetime.datetime
:ivar last_seen_date_time: Last Heartbeat from the Worker.
:vartype last_seen_date_time: ~datetime.datetime
:ivar vm_resource_id: Azure Resource Manager Id for a virtual machine.
:vartype vm_resource_id: str
:ivar worker_type: Type of the HybridWorker. Known values are: "HybridV1", "HybridV2".
:vartype worker_type: str or ~azure.mgmt.automation.models.WorkerType
:ivar worker_name: Name of the HybridWorker.
:vartype worker_name: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'system_data': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'system_data': {'key': 'systemData', 'type': 'SystemData'},
'ip': {'key': 'properties.ip', 'type': 'str'},
'registered_date_time': {'key': 'properties.registeredDateTime', 'type': 'iso-8601'},
'last_seen_date_time': {'key': 'properties.lastSeenDateTime', 'type': 'iso-8601'},
'vm_resource_id': {'key': 'properties.vmResourceId', 'type': 'str'},
'worker_type': {'key': 'properties.workerType', 'type': 'str'},
'worker_name': {'key': 'properties.workerName', 'type': 'str'},
}
def __init__(
self,
*,
ip: Optional[str] = None,
registered_date_time: Optional[datetime.datetime] = None,
last_seen_date_time: Optional[datetime.datetime] = None,
vm_resource_id: Optional[str] = None,
worker_type: Optional[Union[str, "_models.WorkerType"]] = None,
worker_name: Optional[str] = None,
**kwargs
):
"""
:keyword ip: Gets or sets the assigned machine IP address.
:paramtype ip: str
:keyword registered_date_time: Gets or sets the registration time of the worker machine.
:paramtype registered_date_time: ~datetime.datetime
:keyword last_seen_date_time: Last Heartbeat from the Worker.
:paramtype last_seen_date_time: ~datetime.datetime
:keyword vm_resource_id: Azure Resource Manager Id for a virtual machine.
:paramtype vm_resource_id: str
:keyword worker_type: Type of the HybridWorker. Known values are: "HybridV1", "HybridV2".
:paramtype worker_type: str or ~azure.mgmt.automation.models.WorkerType
:keyword worker_name: Name of the HybridWorker.
:paramtype worker_name: str
"""
super(HybridRunbookWorker, self).__init__(**kwargs)
self.system_data = None
self.ip = ip
self.registered_date_time = registered_date_time
self.last_seen_date_time = last_seen_date_time
self.vm_resource_id = vm_resource_id
self.worker_type = worker_type
self.worker_name = worker_name
class HybridRunbookWorkerCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create hybrid runbook worker operation.
:ivar name: Gets or sets the name of the resource.
:vartype name: str
:ivar vm_resource_id: Azure Resource Manager Id for a virtual machine.
:vartype vm_resource_id: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'vm_resource_id': {'key': 'properties.vmResourceId', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
vm_resource_id: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the resource.
:paramtype name: str
:keyword vm_resource_id: Azure Resource Manager Id for a virtual machine.
:paramtype vm_resource_id: str
"""
super(HybridRunbookWorkerCreateParameters, self).__init__(**kwargs)
self.name = name
self.vm_resource_id = vm_resource_id
class HybridRunbookWorkerGroup(msrest.serialization.Model):
"""Definition of hybrid runbook worker group.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Gets or sets the id of the resource.
:vartype id: str
:ivar name: Gets or sets the name of the group.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar hybrid_runbook_workers: Gets or sets the list of hybrid runbook workers.
:vartype hybrid_runbook_workers: list[~azure.mgmt.automation.models.HybridRunbookWorkerLegacy]
:ivar credential: Sets the credential of a worker group.
:vartype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty
:ivar group_type: Type of the HybridWorkerGroup. Known values are: "User", "System".
:vartype group_type: str or ~azure.mgmt.automation.models.GroupTypeEnum
:ivar system_data: Resource system metadata.
:vartype system_data: ~azure.mgmt.automation.models.SystemData
"""
_validation = {
'type': {'readonly': True},
'system_data': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'hybrid_runbook_workers': {'key': 'hybridRunbookWorkers', 'type': '[HybridRunbookWorkerLegacy]'},
'credential': {'key': 'credential', 'type': 'RunAsCredentialAssociationProperty'},
'group_type': {'key': 'groupType', 'type': 'str'},
'system_data': {'key': 'systemData', 'type': 'SystemData'},
}
def __init__(
self,
*,
id: Optional[str] = None,
name: Optional[str] = None,
hybrid_runbook_workers: Optional[List["_models.HybridRunbookWorkerLegacy"]] = None,
credential: Optional["_models.RunAsCredentialAssociationProperty"] = None,
group_type: Optional[Union[str, "_models.GroupTypeEnum"]] = None,
**kwargs
):
"""
:keyword id: Gets or sets the id of the resource.
:paramtype id: str
:keyword name: Gets or sets the name of the group.
:paramtype name: str
:keyword hybrid_runbook_workers: Gets or sets the list of hybrid runbook workers.
:paramtype hybrid_runbook_workers:
list[~azure.mgmt.automation.models.HybridRunbookWorkerLegacy]
:keyword credential: Sets the credential of a worker group.
:paramtype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty
:keyword group_type: Type of the HybridWorkerGroup. Known values are: "User", "System".
:paramtype group_type: str or ~azure.mgmt.automation.models.GroupTypeEnum
"""
super(HybridRunbookWorkerGroup, self).__init__(**kwargs)
self.id = id
self.name = name
self.type = None
self.hybrid_runbook_workers = hybrid_runbook_workers
self.credential = credential
self.group_type = group_type
self.system_data = None
class HybridRunbookWorkerGroupCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update hybrid runbook worker group operation.
:ivar credential: Sets the credential of a worker group.
:vartype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty
"""
_attribute_map = {
'credential': {'key': 'credential', 'type': 'RunAsCredentialAssociationProperty'},
}
def __init__(
self,
*,
credential: Optional["_models.RunAsCredentialAssociationProperty"] = None,
**kwargs
):
"""
:keyword credential: Sets the credential of a worker group.
:paramtype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty
"""
super(HybridRunbookWorkerGroupCreateOrUpdateParameters, self).__init__(**kwargs)
self.credential = credential
class HybridRunbookWorkerGroupsListResult(msrest.serialization.Model):
"""The response model for the list hybrid runbook worker groups.
:ivar value: Gets or sets a list of hybrid runbook worker groups.
:vartype value: list[~azure.mgmt.automation.models.HybridRunbookWorkerGroup]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[HybridRunbookWorkerGroup]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.HybridRunbookWorkerGroup"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of hybrid runbook worker groups.
:paramtype value: list[~azure.mgmt.automation.models.HybridRunbookWorkerGroup]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(HybridRunbookWorkerGroupsListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class HybridRunbookWorkerGroupUpdateParameters(msrest.serialization.Model):
"""Parameters supplied to the update operation.
:ivar credential: Sets the credential of a worker group.
:vartype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty
"""
_attribute_map = {
'credential': {'key': 'credential', 'type': 'RunAsCredentialAssociationProperty'},
}
def __init__(
self,
*,
credential: Optional["_models.RunAsCredentialAssociationProperty"] = None,
**kwargs
):
"""
:keyword credential: Sets the credential of a worker group.
:paramtype credential: ~azure.mgmt.automation.models.RunAsCredentialAssociationProperty
"""
super(HybridRunbookWorkerGroupUpdateParameters, self).__init__(**kwargs)
self.credential = credential
class HybridRunbookWorkerLegacy(msrest.serialization.Model):
"""Definition of hybrid runbook worker Legacy.
:ivar name: Gets or sets the worker machine name.
:vartype name: str
:ivar ip: Gets or sets the assigned machine IP address.
:vartype ip: str
:ivar registration_time: Gets or sets the registration time of the worker machine.
:vartype registration_time: ~datetime.datetime
:ivar last_seen_date_time: Last Heartbeat from the Worker.
:vartype last_seen_date_time: ~datetime.datetime
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'ip': {'key': 'ip', 'type': 'str'},
'registration_time': {'key': 'registrationTime', 'type': 'iso-8601'},
'last_seen_date_time': {'key': 'lastSeenDateTime', 'type': 'iso-8601'},
}
def __init__(
self,
*,
name: Optional[str] = None,
ip: Optional[str] = None,
registration_time: Optional[datetime.datetime] = None,
last_seen_date_time: Optional[datetime.datetime] = None,
**kwargs
):
"""
:keyword name: Gets or sets the worker machine name.
:paramtype name: str
:keyword ip: Gets or sets the assigned machine IP address.
:paramtype ip: str
:keyword registration_time: Gets or sets the registration time of the worker machine.
:paramtype registration_time: ~datetime.datetime
:keyword last_seen_date_time: Last Heartbeat from the Worker.
:paramtype last_seen_date_time: ~datetime.datetime
"""
super(HybridRunbookWorkerLegacy, self).__init__(**kwargs)
self.name = name
self.ip = ip
self.registration_time = registration_time
self.last_seen_date_time = last_seen_date_time
class HybridRunbookWorkerMoveParameters(msrest.serialization.Model):
"""Parameters supplied to move hybrid worker operation.
:ivar hybrid_runbook_worker_group_name: Gets or sets the target hybrid runbook worker group.
:vartype hybrid_runbook_worker_group_name: str
"""
_attribute_map = {
'hybrid_runbook_worker_group_name': {'key': 'hybridRunbookWorkerGroupName', 'type': 'str'},
}
def __init__(
self,
*,
hybrid_runbook_worker_group_name: Optional[str] = None,
**kwargs
):
"""
:keyword hybrid_runbook_worker_group_name: Gets or sets the target hybrid runbook worker group.
:paramtype hybrid_runbook_worker_group_name: str
"""
super(HybridRunbookWorkerMoveParameters, self).__init__(**kwargs)
self.hybrid_runbook_worker_group_name = hybrid_runbook_worker_group_name
class HybridRunbookWorkersListResult(msrest.serialization.Model):
"""The response model for the list hybrid runbook workers.
:ivar value: Gets or sets a list of hybrid runbook workers.
:vartype value: list[~azure.mgmt.automation.models.HybridRunbookWorker]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[HybridRunbookWorker]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.HybridRunbookWorker"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of hybrid runbook workers.
:paramtype value: list[~azure.mgmt.automation.models.HybridRunbookWorker]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(HybridRunbookWorkersListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class Identity(msrest.serialization.Model):
"""Identity for the resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar principal_id: The principal ID of resource identity.
:vartype principal_id: str
:ivar tenant_id: The tenant ID of resource.
:vartype tenant_id: str
:ivar type: The identity type. Known values are: "SystemAssigned", "UserAssigned",
"SystemAssigned, UserAssigned", "None".
:vartype type: str or ~azure.mgmt.automation.models.ResourceIdentityType
:ivar user_assigned_identities: The list of user identities associated with the resource. The
user identity dictionary key references will be ARM resource ids in the form:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
:vartype user_assigned_identities: dict[str,
~azure.mgmt.automation.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties]
"""
_validation = {
'principal_id': {'readonly': True},
'tenant_id': {'readonly': True},
}
_attribute_map = {
'principal_id': {'key': 'principalId', 'type': 'str'},
'tenant_id': {'key': 'tenantId', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties}'},
}
def __init__(
self,
*,
type: Optional[Union[str, "_models.ResourceIdentityType"]] = None,
user_assigned_identities: Optional[Dict[str, "_models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties"]] = None,
**kwargs
):
"""
:keyword type: The identity type. Known values are: "SystemAssigned", "UserAssigned",
"SystemAssigned, UserAssigned", "None".
:paramtype type: str or ~azure.mgmt.automation.models.ResourceIdentityType
:keyword user_assigned_identities: The list of user identities associated with the resource.
The user identity dictionary key references will be ARM resource ids in the form:
'/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'.
:paramtype user_assigned_identities: dict[str,
~azure.mgmt.automation.models.ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties]
"""
super(Identity, self).__init__(**kwargs)
self.principal_id = None
self.tenant_id = None
self.type = type
self.user_assigned_identities = user_assigned_identities
class Job(ProxyResource):
"""Definition of the job.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar runbook: Gets or sets the runbook.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar started_by: Gets or sets the job started by.
:vartype started_by: str
:ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:vartype run_on: str
:ivar job_id: Gets or sets the id of the job.
:vartype job_id: str
:ivar creation_time: Gets or sets the creation time of the job.
:vartype creation_time: ~datetime.datetime
:ivar status: Gets or sets the status of the job. Known values are: "New", "Activating",
"Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected",
"Suspending", "Stopping", "Resuming", "Removing".
:vartype status: str or ~azure.mgmt.automation.models.JobStatus
:ivar status_details: Gets or sets the status details of the job.
:vartype status_details: str
:ivar start_time: Gets or sets the start time of the job.
:vartype start_time: ~datetime.datetime
:ivar end_time: Gets or sets the end time of the job.
:vartype end_time: ~datetime.datetime
:ivar exception: Gets or sets the exception of the job.
:vartype exception: str
:ivar last_modified_time: Gets or sets the last modified time of the job.
:vartype last_modified_time: ~datetime.datetime
:ivar last_status_modified_time: Gets or sets the last status modified time of the job.
:vartype last_status_modified_time: ~datetime.datetime
:ivar parameters: Gets or sets the parameters of the job.
:vartype parameters: dict[str, str]
:ivar provisioning_state: The current provisioning state of the job. Known values are:
"Failed", "Succeeded", "Suspended", "Processing".
:vartype provisioning_state: str or ~azure.mgmt.automation.models.JobProvisioningState
"""
_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'},
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'started_by': {'key': 'properties.startedBy', 'type': 'str'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
'job_id': {'key': 'properties.jobId', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'status': {'key': 'properties.status', 'type': 'str'},
'status_details': {'key': 'properties.statusDetails', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'exception': {'key': 'properties.exception', 'type': 'str'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_status_modified_time': {'key': 'properties.lastStatusModifiedTime', 'type': 'iso-8601'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
}
def __init__(
self,
*,
runbook: Optional["_models.RunbookAssociationProperty"] = None,
started_by: Optional[str] = None,
run_on: Optional[str] = None,
job_id: Optional[str] = None,
creation_time: Optional[datetime.datetime] = None,
status: Optional[Union[str, "_models.JobStatus"]] = None,
status_details: Optional[str] = None,
start_time: Optional[datetime.datetime] = None,
end_time: Optional[datetime.datetime] = None,
exception: Optional[str] = None,
last_modified_time: Optional[datetime.datetime] = None,
last_status_modified_time: Optional[datetime.datetime] = None,
parameters: Optional[Dict[str, str]] = None,
provisioning_state: Optional[Union[str, "_models.JobProvisioningState"]] = None,
**kwargs
):
"""
:keyword runbook: Gets or sets the runbook.
:paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:keyword started_by: Gets or sets the job started by.
:paramtype started_by: str
:keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:paramtype run_on: str
:keyword job_id: Gets or sets the id of the job.
:paramtype job_id: str
:keyword creation_time: Gets or sets the creation time of the job.
:paramtype creation_time: ~datetime.datetime
:keyword status: Gets or sets the status of the job. Known values are: "New", "Activating",
"Running", "Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected",
"Suspending", "Stopping", "Resuming", "Removing".
:paramtype status: str or ~azure.mgmt.automation.models.JobStatus
:keyword status_details: Gets or sets the status details of the job.
:paramtype status_details: str
:keyword start_time: Gets or sets the start time of the job.
:paramtype start_time: ~datetime.datetime
:keyword end_time: Gets or sets the end time of the job.
:paramtype end_time: ~datetime.datetime
:keyword exception: Gets or sets the exception of the job.
:paramtype exception: str
:keyword last_modified_time: Gets or sets the last modified time of the job.
:paramtype last_modified_time: ~datetime.datetime
:keyword last_status_modified_time: Gets or sets the last status modified time of the job.
:paramtype last_status_modified_time: ~datetime.datetime
:keyword parameters: Gets or sets the parameters of the job.
:paramtype parameters: dict[str, str]
:keyword provisioning_state: The current provisioning state of the job. Known values are:
"Failed", "Succeeded", "Suspended", "Processing".
:paramtype provisioning_state: str or ~azure.mgmt.automation.models.JobProvisioningState
"""
super(Job, self).__init__(**kwargs)
self.runbook = runbook
self.started_by = started_by
self.run_on = run_on
self.job_id = job_id
self.creation_time = creation_time
self.status = status
self.status_details = status_details
self.start_time = start_time
self.end_time = end_time
self.exception = exception
self.last_modified_time = last_modified_time
self.last_status_modified_time = last_status_modified_time
self.parameters = parameters
self.provisioning_state = provisioning_state
class JobCollectionItem(ProxyResource):
"""Job collection item properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar runbook: The runbook association.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar job_id: The id of the job.
:vartype job_id: str
:ivar creation_time: The creation time of the job.
:vartype creation_time: ~datetime.datetime
:ivar status: The status of the job. Known values are: "New", "Activating", "Running",
"Completed", "Failed", "Stopped", "Blocked", "Suspended", "Disconnected", "Suspending",
"Stopping", "Resuming", "Removing".
:vartype status: str or ~azure.mgmt.automation.models.JobStatus
:ivar start_time: The start time of the job.
:vartype start_time: ~datetime.datetime
:ivar end_time: The end time of the job.
:vartype end_time: ~datetime.datetime
:ivar last_modified_time: The last modified time of the job.
:vartype last_modified_time: ~datetime.datetime
:ivar provisioning_state: The provisioning state of a resource.
:vartype provisioning_state: str
:ivar run_on: Specifies the runOn group name where the job was executed.
:vartype run_on: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'runbook': {'readonly': True},
'job_id': {'readonly': True},
'creation_time': {'readonly': True},
'status': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
'last_modified_time': {'readonly': True},
'provisioning_state': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'job_id': {'key': 'properties.jobId', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'status': {'key': 'properties.status', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
}
def __init__(
self,
*,
run_on: Optional[str] = None,
**kwargs
):
"""
:keyword run_on: Specifies the runOn group name where the job was executed.
:paramtype run_on: str
"""
super(JobCollectionItem, self).__init__(**kwargs)
self.runbook = None
self.job_id = None
self.creation_time = None
self.status = None
self.start_time = None
self.end_time = None
self.last_modified_time = None
self.provisioning_state = None
self.run_on = run_on
class JobCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create job operation.
:ivar runbook: Gets or sets the runbook.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar parameters: Gets or sets the parameters of the job.
:vartype parameters: dict[str, str]
:ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:vartype run_on: str
"""
_attribute_map = {
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
}
def __init__(
self,
*,
runbook: Optional["_models.RunbookAssociationProperty"] = None,
parameters: Optional[Dict[str, str]] = None,
run_on: Optional[str] = None,
**kwargs
):
"""
:keyword runbook: Gets or sets the runbook.
:paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:keyword parameters: Gets or sets the parameters of the job.
:paramtype parameters: dict[str, str]
:keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:paramtype run_on: str
"""
super(JobCreateParameters, self).__init__(**kwargs)
self.runbook = runbook
self.parameters = parameters
self.run_on = run_on
class JobListResultV2(msrest.serialization.Model):
"""The response model for the list job operation.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of jobs.
:vartype value: list[~azure.mgmt.automation.models.JobCollectionItem]
:ivar next_link: The link to the next page.
:vartype next_link: str
"""
_validation = {
'next_link': {'readonly': True},
}
_attribute_map = {
'value': {'key': 'value', 'type': '[JobCollectionItem]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.JobCollectionItem"]] = None,
**kwargs
):
"""
:keyword value: List of jobs.
:paramtype value: list[~azure.mgmt.automation.models.JobCollectionItem]
"""
super(JobListResultV2, self).__init__(**kwargs)
self.value = value
self.next_link = None
class JobNavigation(msrest.serialization.Model):
"""Software update configuration machine run job navigation properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Id of the job associated with the software update configuration run.
:vartype id: str
"""
_validation = {
'id': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(JobNavigation, self).__init__(**kwargs)
self.id = None
class JobSchedule(msrest.serialization.Model):
"""Definition of the job schedule.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Gets the id of the resource.
:vartype id: str
:ivar name: Gets the name of the variable.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar job_schedule_id: Gets or sets the id of job schedule.
:vartype job_schedule_id: str
:ivar schedule: Gets or sets the schedule.
:vartype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty
:ivar runbook: Gets or sets the runbook.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar run_on: Gets or sets the hybrid worker group that the scheduled job should run on.
:vartype run_on: str
:ivar parameters: Gets or sets the parameters of the job schedule.
:vartype parameters: dict[str, 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'},
'job_schedule_id': {'key': 'properties.jobScheduleId', 'type': 'str'},
'schedule': {'key': 'properties.schedule', 'type': 'ScheduleAssociationProperty'},
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
}
def __init__(
self,
*,
job_schedule_id: Optional[str] = None,
schedule: Optional["_models.ScheduleAssociationProperty"] = None,
runbook: Optional["_models.RunbookAssociationProperty"] = None,
run_on: Optional[str] = None,
parameters: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword job_schedule_id: Gets or sets the id of job schedule.
:paramtype job_schedule_id: str
:keyword schedule: Gets or sets the schedule.
:paramtype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty
:keyword runbook: Gets or sets the runbook.
:paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:keyword run_on: Gets or sets the hybrid worker group that the scheduled job should run on.
:paramtype run_on: str
:keyword parameters: Gets or sets the parameters of the job schedule.
:paramtype parameters: dict[str, str]
"""
super(JobSchedule, self).__init__(**kwargs)
self.id = None
self.name = None
self.type = None
self.job_schedule_id = job_schedule_id
self.schedule = schedule
self.runbook = runbook
self.run_on = run_on
self.parameters = parameters
class JobScheduleCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create job schedule operation.
All required parameters must be populated in order to send to Azure.
:ivar schedule: Required. Gets or sets the schedule.
:vartype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty
:ivar runbook: Required. Gets or sets the runbook.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar run_on: Gets or sets the hybrid worker group that the scheduled job should run on.
:vartype run_on: str
:ivar parameters: Gets or sets a list of job properties.
:vartype parameters: dict[str, str]
"""
_validation = {
'schedule': {'required': True},
'runbook': {'required': True},
}
_attribute_map = {
'schedule': {'key': 'properties.schedule', 'type': 'ScheduleAssociationProperty'},
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
}
def __init__(
self,
*,
schedule: "_models.ScheduleAssociationProperty",
runbook: "_models.RunbookAssociationProperty",
run_on: Optional[str] = None,
parameters: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword schedule: Required. Gets or sets the schedule.
:paramtype schedule: ~azure.mgmt.automation.models.ScheduleAssociationProperty
:keyword runbook: Required. Gets or sets the runbook.
:paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:keyword run_on: Gets or sets the hybrid worker group that the scheduled job should run on.
:paramtype run_on: str
:keyword parameters: Gets or sets a list of job properties.
:paramtype parameters: dict[str, str]
"""
super(JobScheduleCreateParameters, self).__init__(**kwargs)
self.schedule = schedule
self.runbook = runbook
self.run_on = run_on
self.parameters = parameters
class JobScheduleListResult(msrest.serialization.Model):
"""The response model for the list job schedule operation.
:ivar value: Gets or sets a list of job schedules.
:vartype value: list[~azure.mgmt.automation.models.JobSchedule]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[JobSchedule]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.JobSchedule"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of job schedules.
:paramtype value: list[~azure.mgmt.automation.models.JobSchedule]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(JobScheduleListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class JobStream(msrest.serialization.Model):
"""Definition of the job stream.
:ivar id: Gets or sets the id of the resource.
:vartype id: str
:ivar job_stream_id: Gets or sets the id of the job stream.
:vartype job_stream_id: str
:ivar time: Gets or sets the creation time of the job.
:vartype time: ~datetime.datetime
:ivar stream_type: Gets or sets the stream type. Known values are: "Progress", "Output",
"Warning", "Error", "Debug", "Verbose", "Any".
:vartype stream_type: str or ~azure.mgmt.automation.models.JobStreamType
:ivar stream_text: Gets or sets the stream text.
:vartype stream_text: str
:ivar summary: Gets or sets the summary.
:vartype summary: str
:ivar value: Gets or sets the values of the job stream.
:vartype value: dict[str, any]
"""
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'job_stream_id': {'key': 'properties.jobStreamId', 'type': 'str'},
'time': {'key': 'properties.time', 'type': 'iso-8601'},
'stream_type': {'key': 'properties.streamType', 'type': 'str'},
'stream_text': {'key': 'properties.streamText', 'type': 'str'},
'summary': {'key': 'properties.summary', 'type': 'str'},
'value': {'key': 'properties.value', 'type': '{object}'},
}
def __init__(
self,
*,
id: Optional[str] = None,
job_stream_id: Optional[str] = None,
time: Optional[datetime.datetime] = None,
stream_type: Optional[Union[str, "_models.JobStreamType"]] = None,
stream_text: Optional[str] = None,
summary: Optional[str] = None,
value: Optional[Dict[str, Any]] = None,
**kwargs
):
"""
:keyword id: Gets or sets the id of the resource.
:paramtype id: str
:keyword job_stream_id: Gets or sets the id of the job stream.
:paramtype job_stream_id: str
:keyword time: Gets or sets the creation time of the job.
:paramtype time: ~datetime.datetime
:keyword stream_type: Gets or sets the stream type. Known values are: "Progress", "Output",
"Warning", "Error", "Debug", "Verbose", "Any".
:paramtype stream_type: str or ~azure.mgmt.automation.models.JobStreamType
:keyword stream_text: Gets or sets the stream text.
:paramtype stream_text: str
:keyword summary: Gets or sets the summary.
:paramtype summary: str
:keyword value: Gets or sets the values of the job stream.
:paramtype value: dict[str, any]
"""
super(JobStream, self).__init__(**kwargs)
self.id = id
self.job_stream_id = job_stream_id
self.time = time
self.stream_type = stream_type
self.stream_text = stream_text
self.summary = summary
self.value = value
class JobStreamListResult(msrest.serialization.Model):
"""The response model for the list job stream operation.
:ivar value: A list of job streams.
:vartype value: list[~azure.mgmt.automation.models.JobStream]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[JobStream]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.JobStream"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: A list of job streams.
:paramtype value: list[~azure.mgmt.automation.models.JobStream]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(JobStreamListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class Key(msrest.serialization.Model):
"""Automation key which is used to register a DSC Node.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar key_name: Automation key name. Known values are: "Primary", "Secondary".
:vartype key_name: str or ~azure.mgmt.automation.models.AutomationKeyName
:ivar permissions: Automation key permissions. Known values are: "Read", "Full".
:vartype permissions: str or ~azure.mgmt.automation.models.AutomationKeyPermissions
:ivar value: Value of the Automation Key used for registration.
:vartype value: str
"""
_validation = {
'key_name': {'readonly': True},
'permissions': {'readonly': True},
'value': {'readonly': True},
}
_attribute_map = {
'key_name': {'key': 'KeyName', 'type': 'str'},
'permissions': {'key': 'Permissions', 'type': 'str'},
'value': {'key': 'Value', 'type': 'str'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(Key, self).__init__(**kwargs)
self.key_name = None
self.permissions = None
self.value = None
class KeyListResult(msrest.serialization.Model):
"""KeyListResult.
:ivar keys: Lists the automation keys.
:vartype keys: list[~azure.mgmt.automation.models.Key]
"""
_attribute_map = {
'keys': {'key': 'keys', 'type': '[Key]'},
}
def __init__(
self,
*,
keys: Optional[List["_models.Key"]] = None,
**kwargs
):
"""
:keyword keys: Lists the automation keys.
:paramtype keys: list[~azure.mgmt.automation.models.Key]
"""
super(KeyListResult, self).__init__(**kwargs)
self.keys = keys
class KeyVaultProperties(msrest.serialization.Model):
"""Settings concerning key vault encryption for a configuration store.
:ivar keyvault_uri: The URI of the key vault key used to encrypt data.
:vartype keyvault_uri: str
:ivar key_name: The name of key used to encrypt data.
:vartype key_name: str
:ivar key_version: The key version of the key used to encrypt data.
:vartype key_version: str
"""
_attribute_map = {
'keyvault_uri': {'key': 'keyvaultUri', 'type': 'str'},
'key_name': {'key': 'keyName', 'type': 'str'},
'key_version': {'key': 'keyVersion', 'type': 'str'},
}
def __init__(
self,
*,
keyvault_uri: Optional[str] = None,
key_name: Optional[str] = None,
key_version: Optional[str] = None,
**kwargs
):
"""
:keyword keyvault_uri: The URI of the key vault key used to encrypt data.
:paramtype keyvault_uri: str
:keyword key_name: The name of key used to encrypt data.
:paramtype key_name: str
:keyword key_version: The key version of the key used to encrypt data.
:paramtype key_version: str
"""
super(KeyVaultProperties, self).__init__(**kwargs)
self.keyvault_uri = keyvault_uri
self.key_name = key_name
self.key_version = key_version
class LinkedWorkspace(msrest.serialization.Model):
"""Definition of the linked workspace.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Gets the id of the linked workspace.
:vartype id: str
"""
_validation = {
'id': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(LinkedWorkspace, self).__init__(**kwargs)
self.id = None
class LinuxProperties(msrest.serialization.Model):
"""Linux specific update configuration.
:ivar included_package_classifications: Update classifications included in the software update
configuration. Known values are: "Unclassified", "Critical", "Security", "Other".
:vartype included_package_classifications: str or
~azure.mgmt.automation.models.LinuxUpdateClasses
:ivar excluded_package_name_masks: packages excluded from the software update configuration.
:vartype excluded_package_name_masks: list[str]
:ivar included_package_name_masks: packages included from the software update configuration.
:vartype included_package_name_masks: list[str]
:ivar reboot_setting: Reboot setting for the software update configuration.
:vartype reboot_setting: str
"""
_attribute_map = {
'included_package_classifications': {'key': 'includedPackageClassifications', 'type': 'str'},
'excluded_package_name_masks': {'key': 'excludedPackageNameMasks', 'type': '[str]'},
'included_package_name_masks': {'key': 'includedPackageNameMasks', 'type': '[str]'},
'reboot_setting': {'key': 'rebootSetting', 'type': 'str'},
}
def __init__(
self,
*,
included_package_classifications: Optional[Union[str, "_models.LinuxUpdateClasses"]] = None,
excluded_package_name_masks: Optional[List[str]] = None,
included_package_name_masks: Optional[List[str]] = None,
reboot_setting: Optional[str] = None,
**kwargs
):
"""
:keyword included_package_classifications: Update classifications included in the software
update configuration. Known values are: "Unclassified", "Critical", "Security", "Other".
:paramtype included_package_classifications: str or
~azure.mgmt.automation.models.LinuxUpdateClasses
:keyword excluded_package_name_masks: packages excluded from the software update configuration.
:paramtype excluded_package_name_masks: list[str]
:keyword included_package_name_masks: packages included from the software update configuration.
:paramtype included_package_name_masks: list[str]
:keyword reboot_setting: Reboot setting for the software update configuration.
:paramtype reboot_setting: str
"""
super(LinuxProperties, self).__init__(**kwargs)
self.included_package_classifications = included_package_classifications
self.excluded_package_name_masks = excluded_package_name_masks
self.included_package_name_masks = included_package_name_masks
self.reboot_setting = reboot_setting
class Module(TrackedResource):
"""Definition of the module type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar tags: A set of tags. Resource tags.
:vartype tags: dict[str, str]
:ivar location: The Azure Region where the resource lives.
:vartype location: str
:ivar etag: Gets or sets the etag of the resource.
:vartype etag: str
:ivar is_global: Gets or sets the isGlobal flag of the module.
:vartype is_global: bool
:ivar version: Gets or sets the version of the module.
:vartype version: str
:ivar size_in_bytes: Gets or sets the size in bytes of the module.
:vartype size_in_bytes: long
:ivar activity_count: Gets or sets the activity count of the module.
:vartype activity_count: int
:ivar provisioning_state: Gets or sets the provisioning state of the module. Known values are:
"Created", "Creating", "StartingImportModuleRunbook", "RunningImportModuleRunbook",
"ContentRetrieved", "ContentDownloaded", "ContentValidated", "ConnectionTypeImported",
"ContentStored", "ModuleDataStored", "ActivitiesStored", "ModuleImportRunbookComplete",
"Succeeded", "Failed", "Cancelled", "Updating".
:vartype provisioning_state: str or ~azure.mgmt.automation.models.ModuleProvisioningState
:ivar content_link: Gets or sets the contentLink of the module.
:vartype content_link: ~azure.mgmt.automation.models.ContentLink
:ivar error: Gets or sets the error info of the module.
:vartype error: ~azure.mgmt.automation.models.ModuleErrorInfo
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
:ivar is_composite: Gets or sets type of module, if its composite or not.
:vartype is_composite: bool
"""
_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'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
'is_global': {'key': 'properties.isGlobal', 'type': 'bool'},
'version': {'key': 'properties.version', 'type': 'str'},
'size_in_bytes': {'key': 'properties.sizeInBytes', 'type': 'long'},
'activity_count': {'key': 'properties.activityCount', 'type': 'int'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'content_link': {'key': 'properties.contentLink', 'type': 'ContentLink'},
'error': {'key': 'properties.error', 'type': 'ModuleErrorInfo'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
'is_composite': {'key': 'properties.isComposite', 'type': 'bool'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
etag: Optional[str] = None,
is_global: Optional[bool] = None,
version: Optional[str] = None,
size_in_bytes: Optional[int] = None,
activity_count: Optional[int] = None,
provisioning_state: Optional[Union[str, "_models.ModuleProvisioningState"]] = None,
content_link: Optional["_models.ContentLink"] = None,
error: Optional["_models.ModuleErrorInfo"] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
is_composite: Optional[bool] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The Azure Region where the resource lives.
:paramtype location: str
:keyword etag: Gets or sets the etag of the resource.
:paramtype etag: str
:keyword is_global: Gets or sets the isGlobal flag of the module.
:paramtype is_global: bool
:keyword version: Gets or sets the version of the module.
:paramtype version: str
:keyword size_in_bytes: Gets or sets the size in bytes of the module.
:paramtype size_in_bytes: long
:keyword activity_count: Gets or sets the activity count of the module.
:paramtype activity_count: int
:keyword provisioning_state: Gets or sets the provisioning state of the module. Known values
are: "Created", "Creating", "StartingImportModuleRunbook", "RunningImportModuleRunbook",
"ContentRetrieved", "ContentDownloaded", "ContentValidated", "ConnectionTypeImported",
"ContentStored", "ModuleDataStored", "ActivitiesStored", "ModuleImportRunbookComplete",
"Succeeded", "Failed", "Cancelled", "Updating".
:paramtype provisioning_state: str or ~azure.mgmt.automation.models.ModuleProvisioningState
:keyword content_link: Gets or sets the contentLink of the module.
:paramtype content_link: ~azure.mgmt.automation.models.ContentLink
:keyword error: Gets or sets the error info of the module.
:paramtype error: ~azure.mgmt.automation.models.ModuleErrorInfo
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
:keyword is_composite: Gets or sets type of module, if its composite or not.
:paramtype is_composite: bool
"""
super(Module, self).__init__(tags=tags, location=location, **kwargs)
self.etag = etag
self.is_global = is_global
self.version = version
self.size_in_bytes = size_in_bytes
self.activity_count = activity_count
self.provisioning_state = provisioning_state
self.content_link = content_link
self.error = error
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.description = description
self.is_composite = is_composite
class ModuleCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update module operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Gets or sets name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar content_link: Required. Gets or sets the module content link.
:vartype content_link: ~azure.mgmt.automation.models.ContentLink
"""
_validation = {
'content_link': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'content_link': {'key': 'properties.contentLink', 'type': 'ContentLink'},
}
def __init__(
self,
*,
content_link: "_models.ContentLink",
name: Optional[str] = None,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword name: Gets or sets name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword content_link: Required. Gets or sets the module content link.
:paramtype content_link: ~azure.mgmt.automation.models.ContentLink
"""
super(ModuleCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.tags = tags
self.content_link = content_link
class ModuleErrorInfo(msrest.serialization.Model):
"""Definition of the module error info type.
:ivar code: Gets or sets the error code.
:vartype code: str
:ivar message: Gets or sets the error message.
:vartype message: str
"""
_attribute_map = {
'code': {'key': 'code', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}
def __init__(
self,
*,
code: Optional[str] = None,
message: Optional[str] = None,
**kwargs
):
"""
:keyword code: Gets or sets the error code.
:paramtype code: str
:keyword message: Gets or sets the error message.
:paramtype message: str
"""
super(ModuleErrorInfo, self).__init__(**kwargs)
self.code = code
self.message = message
class ModuleListResult(msrest.serialization.Model):
"""The response model for the list module operation.
:ivar value: Gets or sets a list of modules.
:vartype value: list[~azure.mgmt.automation.models.Module]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Module]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Module"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of modules.
:paramtype value: list[~azure.mgmt.automation.models.Module]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(ModuleListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class ModuleUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update module operation.
:ivar name: Gets or sets name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar content_link: Gets or sets the module content link.
:vartype content_link: ~azure.mgmt.automation.models.ContentLink
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'content_link': {'key': 'properties.contentLink', 'type': 'ContentLink'},
}
def __init__(
self,
*,
name: Optional[str] = None,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
content_link: Optional["_models.ContentLink"] = None,
**kwargs
):
"""
:keyword name: Gets or sets name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword content_link: Gets or sets the module content link.
:paramtype content_link: ~azure.mgmt.automation.models.ContentLink
"""
super(ModuleUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.tags = tags
self.content_link = content_link
class NodeCount(msrest.serialization.Model):
"""Number of nodes based on the Filter.
:ivar name: Gets the name of a count type.
:vartype name: str
:ivar properties:
:vartype properties: ~azure.mgmt.automation.models.NodeCountProperties
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'properties': {'key': 'properties', 'type': 'NodeCountProperties'},
}
def __init__(
self,
*,
name: Optional[str] = None,
properties: Optional["_models.NodeCountProperties"] = None,
**kwargs
):
"""
:keyword name: Gets the name of a count type.
:paramtype name: str
:keyword properties:
:paramtype properties: ~azure.mgmt.automation.models.NodeCountProperties
"""
super(NodeCount, self).__init__(**kwargs)
self.name = name
self.properties = properties
class NodeCountProperties(msrest.serialization.Model):
"""NodeCountProperties.
:ivar count: Gets the count for the name.
:vartype count: int
"""
_attribute_map = {
'count': {'key': 'count', 'type': 'int'},
}
def __init__(
self,
*,
count: Optional[int] = None,
**kwargs
):
"""
:keyword count: Gets the count for the name.
:paramtype count: int
"""
super(NodeCountProperties, self).__init__(**kwargs)
self.count = count
class NodeCounts(msrest.serialization.Model):
"""Gets the count of nodes by count type.
:ivar value: Gets an array of counts.
:vartype value: list[~azure.mgmt.automation.models.NodeCount]
:ivar total_count: Gets the total number of records matching countType criteria.
:vartype total_count: int
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[NodeCount]'},
'total_count': {'key': 'totalCount', 'type': 'int'},
}
def __init__(
self,
*,
value: Optional[List["_models.NodeCount"]] = None,
total_count: Optional[int] = None,
**kwargs
):
"""
:keyword value: Gets an array of counts.
:paramtype value: list[~azure.mgmt.automation.models.NodeCount]
:keyword total_count: Gets the total number of records matching countType criteria.
:paramtype total_count: int
"""
super(NodeCounts, self).__init__(**kwargs)
self.value = value
self.total_count = total_count
class NonAzureQueryProperties(msrest.serialization.Model):
"""Non Azure query for the update configuration.
:ivar function_alias: Log Analytics Saved Search name.
:vartype function_alias: str
:ivar workspace_id: Workspace Id for Log Analytics in which the saved Search is resided.
:vartype workspace_id: str
"""
_attribute_map = {
'function_alias': {'key': 'functionAlias', 'type': 'str'},
'workspace_id': {'key': 'workspaceId', 'type': 'str'},
}
def __init__(
self,
*,
function_alias: Optional[str] = None,
workspace_id: Optional[str] = None,
**kwargs
):
"""
:keyword function_alias: Log Analytics Saved Search name.
:paramtype function_alias: str
:keyword workspace_id: Workspace Id for Log Analytics in which the saved Search is resided.
:paramtype workspace_id: str
"""
super(NonAzureQueryProperties, self).__init__(**kwargs)
self.function_alias = function_alias
self.workspace_id = workspace_id
class Operation(msrest.serialization.Model):
"""Automation REST API operation.
:ivar name: Operation name: {provider}/{resource}/{operation}.
:vartype name: str
:ivar display: Provider, Resource and Operation values.
:vartype display: ~azure.mgmt.automation.models.OperationDisplay
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'display': {'key': 'display', 'type': 'OperationDisplay'},
}
def __init__(
self,
*,
name: Optional[str] = None,
display: Optional["_models.OperationDisplay"] = None,
**kwargs
):
"""
:keyword name: Operation name: {provider}/{resource}/{operation}.
:paramtype name: str
:keyword display: Provider, Resource and Operation values.
:paramtype display: ~azure.mgmt.automation.models.OperationDisplay
"""
super(Operation, self).__init__(**kwargs)
self.name = name
self.display = display
class OperationDisplay(msrest.serialization.Model):
"""Provider, Resource and Operation values.
:ivar provider: Service provider: Microsoft.Automation.
:vartype provider: str
:ivar resource: Resource on which the operation is performed: Runbooks, Jobs etc.
:vartype resource: str
:ivar operation: Operation type: Read, write, delete, etc.
:vartype operation: str
"""
_attribute_map = {
'provider': {'key': 'provider', 'type': 'str'},
'resource': {'key': 'resource', 'type': 'str'},
'operation': {'key': 'operation', 'type': 'str'},
}
def __init__(
self,
*,
provider: Optional[str] = None,
resource: Optional[str] = None,
operation: Optional[str] = None,
**kwargs
):
"""
:keyword provider: Service provider: Microsoft.Automation.
:paramtype provider: str
:keyword resource: Resource on which the operation is performed: Runbooks, Jobs etc.
:paramtype resource: str
:keyword operation: Operation type: Read, write, delete, etc.
:paramtype operation: str
"""
super(OperationDisplay, self).__init__(**kwargs)
self.provider = provider
self.resource = resource
self.operation = operation
class OperationListResult(msrest.serialization.Model):
"""The response model for the list of Automation operations.
:ivar value: List of Automation operations supported by the Automation resource provider.
:vartype value: list[~azure.mgmt.automation.models.Operation]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Operation]'},
}
def __init__(
self,
*,
value: Optional[List["_models.Operation"]] = None,
**kwargs
):
"""
:keyword value: List of Automation operations supported by the Automation resource provider.
:paramtype value: list[~azure.mgmt.automation.models.Operation]
"""
super(OperationListResult, self).__init__(**kwargs)
self.value = value
class PrivateEndpointConnection(ProxyResource):
"""A private endpoint connection.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar private_endpoint: Private endpoint which the connection belongs to.
:vartype private_endpoint: ~azure.mgmt.automation.models.PrivateEndpointProperty
:ivar group_ids: Gets the groupIds.
:vartype group_ids: list[str]
:ivar private_link_service_connection_state: Connection State of the Private Endpoint
Connection.
:vartype private_link_service_connection_state:
~azure.mgmt.automation.models.PrivateLinkServiceConnectionStateProperty
"""
_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'},
'private_endpoint': {'key': 'properties.privateEndpoint', 'type': 'PrivateEndpointProperty'},
'group_ids': {'key': 'properties.groupIds', 'type': '[str]'},
'private_link_service_connection_state': {'key': 'properties.privateLinkServiceConnectionState', 'type': 'PrivateLinkServiceConnectionStateProperty'},
}
def __init__(
self,
*,
private_endpoint: Optional["_models.PrivateEndpointProperty"] = None,
group_ids: Optional[List[str]] = None,
private_link_service_connection_state: Optional["_models.PrivateLinkServiceConnectionStateProperty"] = None,
**kwargs
):
"""
:keyword private_endpoint: Private endpoint which the connection belongs to.
:paramtype private_endpoint: ~azure.mgmt.automation.models.PrivateEndpointProperty
:keyword group_ids: Gets the groupIds.
:paramtype group_ids: list[str]
:keyword private_link_service_connection_state: Connection State of the Private Endpoint
Connection.
:paramtype private_link_service_connection_state:
~azure.mgmt.automation.models.PrivateLinkServiceConnectionStateProperty
"""
super(PrivateEndpointConnection, self).__init__(**kwargs)
self.private_endpoint = private_endpoint
self.group_ids = group_ids
self.private_link_service_connection_state = private_link_service_connection_state
class PrivateEndpointConnectionListResult(msrest.serialization.Model):
"""A list of private endpoint connections.
:ivar value: Array of private endpoint connections.
:vartype value: list[~azure.mgmt.automation.models.PrivateEndpointConnection]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[PrivateEndpointConnection]'},
}
def __init__(
self,
*,
value: Optional[List["_models.PrivateEndpointConnection"]] = None,
**kwargs
):
"""
:keyword value: Array of private endpoint connections.
:paramtype value: list[~azure.mgmt.automation.models.PrivateEndpointConnection]
"""
super(PrivateEndpointConnectionListResult, self).__init__(**kwargs)
self.value = value
class PrivateEndpointProperty(msrest.serialization.Model):
"""Private endpoint which the connection belongs to.
:ivar id: Resource id of the private endpoint.
:vartype id: str
"""
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
}
def __init__(
self,
*,
id: Optional[str] = None,
**kwargs
):
"""
:keyword id: Resource id of the private endpoint.
:paramtype id: str
"""
super(PrivateEndpointProperty, self).__init__(**kwargs)
self.id = id
class PrivateLinkResource(ProxyResource):
"""A private link resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar group_id: The private link resource group id.
:vartype group_id: str
:ivar required_members: The private link resource required member names.
:vartype required_members: list[str]
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'group_id': {'readonly': True},
'required_members': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'group_id': {'key': 'properties.groupId', 'type': 'str'},
'required_members': {'key': 'properties.requiredMembers', 'type': '[str]'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(PrivateLinkResource, self).__init__(**kwargs)
self.group_id = None
self.required_members = None
class PrivateLinkResourceListResult(msrest.serialization.Model):
"""A list of private link resources.
:ivar value: Array of private link resources.
:vartype value: list[~azure.mgmt.automation.models.PrivateLinkResource]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[PrivateLinkResource]'},
}
def __init__(
self,
*,
value: Optional[List["_models.PrivateLinkResource"]] = None,
**kwargs
):
"""
:keyword value: Array of private link resources.
:paramtype value: list[~azure.mgmt.automation.models.PrivateLinkResource]
"""
super(PrivateLinkResourceListResult, self).__init__(**kwargs)
self.value = value
class PrivateLinkServiceConnectionStateProperty(msrest.serialization.Model):
"""Connection State of the Private Endpoint Connection.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar status: The private link service connection status.
:vartype status: str
:ivar description: The private link service connection description.
:vartype description: str
:ivar actions_required: Any action that is required beyond basic workflow (approve/ reject/
disconnect).
:vartype actions_required: str
"""
_validation = {
'actions_required': {'readonly': True},
}
_attribute_map = {
'status': {'key': 'status', 'type': 'str'},
'description': {'key': 'description', 'type': 'str'},
'actions_required': {'key': 'actionsRequired', 'type': 'str'},
}
def __init__(
self,
*,
status: Optional[str] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword status: The private link service connection status.
:paramtype status: str
:keyword description: The private link service connection description.
:paramtype description: str
"""
super(PrivateLinkServiceConnectionStateProperty, self).__init__(**kwargs)
self.status = status
self.description = description
self.actions_required = None
class PythonPackageCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update module operation.
All required parameters must be populated in order to send to Azure.
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar content_link: Required. Gets or sets the module content link.
:vartype content_link: ~azure.mgmt.automation.models.ContentLink
"""
_validation = {
'content_link': {'required': True},
}
_attribute_map = {
'tags': {'key': 'tags', 'type': '{str}'},
'content_link': {'key': 'properties.contentLink', 'type': 'ContentLink'},
}
def __init__(
self,
*,
content_link: "_models.ContentLink",
tags: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword content_link: Required. Gets or sets the module content link.
:paramtype content_link: ~azure.mgmt.automation.models.ContentLink
"""
super(PythonPackageCreateParameters, self).__init__(**kwargs)
self.tags = tags
self.content_link = content_link
class PythonPackageUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update module operation.
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
"""
_attribute_map = {
'tags': {'key': 'tags', 'type': '{str}'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
"""
super(PythonPackageUpdateParameters, self).__init__(**kwargs)
self.tags = tags
class RawGraphicalRunbookContent(msrest.serialization.Model):
"""Raw Graphical Runbook content.
:ivar schema_version: Schema version of the serializer.
:vartype schema_version: str
:ivar runbook_definition: Serialized Graphical runbook.
:vartype runbook_definition: str
:ivar runbook_type: Runbook Type. Known values are: "GraphPowerShell",
"GraphPowerShellWorkflow".
:vartype runbook_type: str or ~azure.mgmt.automation.models.GraphRunbookType
"""
_attribute_map = {
'schema_version': {'key': 'schemaVersion', 'type': 'str'},
'runbook_definition': {'key': 'runbookDefinition', 'type': 'str'},
'runbook_type': {'key': 'runbookType', 'type': 'str'},
}
def __init__(
self,
*,
schema_version: Optional[str] = None,
runbook_definition: Optional[str] = None,
runbook_type: Optional[Union[str, "_models.GraphRunbookType"]] = None,
**kwargs
):
"""
:keyword schema_version: Schema version of the serializer.
:paramtype schema_version: str
:keyword runbook_definition: Serialized Graphical runbook.
:paramtype runbook_definition: str
:keyword runbook_type: Runbook Type. Known values are: "GraphPowerShell",
"GraphPowerShellWorkflow".
:paramtype runbook_type: str or ~azure.mgmt.automation.models.GraphRunbookType
"""
super(RawGraphicalRunbookContent, self).__init__(**kwargs)
self.schema_version = schema_version
self.runbook_definition = runbook_definition
self.runbook_type = runbook_type
class RunAsCredentialAssociationProperty(msrest.serialization.Model):
"""Definition of RunAs credential to use for hybrid worker.
:ivar name: Gets or sets the name of the credential.
:vartype name: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the credential.
:paramtype name: str
"""
super(RunAsCredentialAssociationProperty, self).__init__(**kwargs)
self.name = name
class Runbook(TrackedResource):
"""Definition of the runbook type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar tags: A set of tags. Resource tags.
:vartype tags: dict[str, str]
:ivar location: The Azure Region where the resource lives.
:vartype location: str
:ivar etag: Gets or sets the etag of the resource.
:vartype etag: str
:ivar runbook_type: Gets or sets the type of the runbook. Known values are: "Script", "Graph",
"PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell", "Python2",
"Python3".
:vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum
:ivar publish_content_link: Gets or sets the published runbook content link.
:vartype publish_content_link: ~azure.mgmt.automation.models.ContentLink
:ivar state: Gets or sets the state of the runbook. Known values are: "New", "Edit",
"Published".
:vartype state: str or ~azure.mgmt.automation.models.RunbookState
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar log_progress: Gets or sets progress log option.
:vartype log_progress: bool
:ivar log_activity_trace: Gets or sets the option to log activity trace of the runbook.
:vartype log_activity_trace: int
:ivar job_count: Gets or sets the job count of the runbook.
:vartype job_count: int
:ivar parameters: Gets or sets the runbook parameters.
:vartype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter]
:ivar output_types: Gets or sets the runbook output types.
:vartype output_types: list[str]
:ivar draft: Gets or sets the draft runbook properties.
:vartype draft: ~azure.mgmt.automation.models.RunbookDraft
:ivar provisioning_state: Gets or sets the provisioning state of the runbook. The only
acceptable values to pass in are None and "Succeeded". The default value is None.
:vartype provisioning_state: str
:ivar last_modified_by: Gets or sets the last modified by.
:vartype last_modified_by: str
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: 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'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
'runbook_type': {'key': 'properties.runbookType', 'type': 'str'},
'publish_content_link': {'key': 'properties.publishContentLink', 'type': 'ContentLink'},
'state': {'key': 'properties.state', 'type': 'str'},
'log_verbose': {'key': 'properties.logVerbose', 'type': 'bool'},
'log_progress': {'key': 'properties.logProgress', 'type': 'bool'},
'log_activity_trace': {'key': 'properties.logActivityTrace', 'type': 'int'},
'job_count': {'key': 'properties.jobCount', 'type': 'int'},
'parameters': {'key': 'properties.parameters', 'type': '{RunbookParameter}'},
'output_types': {'key': 'properties.outputTypes', 'type': '[str]'},
'draft': {'key': 'properties.draft', 'type': 'RunbookDraft'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
etag: Optional[str] = None,
runbook_type: Optional[Union[str, "_models.RunbookTypeEnum"]] = None,
publish_content_link: Optional["_models.ContentLink"] = None,
state: Optional[Union[str, "_models.RunbookState"]] = None,
log_verbose: Optional[bool] = None,
log_progress: Optional[bool] = None,
log_activity_trace: Optional[int] = None,
job_count: Optional[int] = None,
parameters: Optional[Dict[str, "_models.RunbookParameter"]] = None,
output_types: Optional[List[str]] = None,
draft: Optional["_models.RunbookDraft"] = None,
provisioning_state: Optional[str] = None,
last_modified_by: Optional[str] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The Azure Region where the resource lives.
:paramtype location: str
:keyword etag: Gets or sets the etag of the resource.
:paramtype etag: str
:keyword runbook_type: Gets or sets the type of the runbook. Known values are: "Script",
"Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell",
"Python2", "Python3".
:paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum
:keyword publish_content_link: Gets or sets the published runbook content link.
:paramtype publish_content_link: ~azure.mgmt.automation.models.ContentLink
:keyword state: Gets or sets the state of the runbook. Known values are: "New", "Edit",
"Published".
:paramtype state: str or ~azure.mgmt.automation.models.RunbookState
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword log_progress: Gets or sets progress log option.
:paramtype log_progress: bool
:keyword log_activity_trace: Gets or sets the option to log activity trace of the runbook.
:paramtype log_activity_trace: int
:keyword job_count: Gets or sets the job count of the runbook.
:paramtype job_count: int
:keyword parameters: Gets or sets the runbook parameters.
:paramtype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter]
:keyword output_types: Gets or sets the runbook output types.
:paramtype output_types: list[str]
:keyword draft: Gets or sets the draft runbook properties.
:paramtype draft: ~azure.mgmt.automation.models.RunbookDraft
:keyword provisioning_state: Gets or sets the provisioning state of the runbook. The only
acceptable values to pass in are None and "Succeeded". The default value is None.
:paramtype provisioning_state: str
:keyword last_modified_by: Gets or sets the last modified by.
:paramtype last_modified_by: str
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Runbook, self).__init__(tags=tags, location=location, **kwargs)
self.etag = etag
self.runbook_type = runbook_type
self.publish_content_link = publish_content_link
self.state = state
self.log_verbose = log_verbose
self.log_progress = log_progress
self.log_activity_trace = log_activity_trace
self.job_count = job_count
self.parameters = parameters
self.output_types = output_types
self.draft = draft
self.provisioning_state = provisioning_state
self.last_modified_by = last_modified_by
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.description = description
class RunbookAssociationProperty(msrest.serialization.Model):
"""The runbook property associated with the entity.
:ivar name: Gets or sets the name of the runbook.
:vartype name: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the runbook.
:paramtype name: str
"""
super(RunbookAssociationProperty, self).__init__(**kwargs)
self.name = name
class RunbookCreateOrUpdateDraftParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update runbook operation.
All required parameters must be populated in order to send to Azure.
:ivar runbook_content: Required. Content of the Runbook.
:vartype runbook_content: str
"""
_validation = {
'runbook_content': {'required': True},
}
_attribute_map = {
'runbook_content': {'key': 'runbookContent', 'type': 'str'},
}
def __init__(
self,
*,
runbook_content: str,
**kwargs
):
"""
:keyword runbook_content: Required. Content of the Runbook.
:paramtype runbook_content: str
"""
super(RunbookCreateOrUpdateDraftParameters, self).__init__(**kwargs)
self.runbook_content = runbook_content
class RunbookCreateOrUpdateDraftProperties(msrest.serialization.Model):
"""The parameters supplied to the create or update draft runbook properties.
All required parameters must be populated in order to send to Azure.
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar log_progress: Gets or sets progress log option.
:vartype log_progress: bool
:ivar runbook_type: Required. Gets or sets the type of the runbook. Known values are: "Script",
"Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell",
"Python2", "Python3".
:vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum
:ivar draft: Required. Gets or sets the draft runbook properties.
:vartype draft: ~azure.mgmt.automation.models.RunbookDraft
:ivar description: Gets or sets the description of the runbook.
:vartype description: str
:ivar log_activity_trace: Gets or sets the activity-level tracing options of the runbook.
:vartype log_activity_trace: int
"""
_validation = {
'runbook_type': {'required': True},
'draft': {'required': True},
}
_attribute_map = {
'log_verbose': {'key': 'logVerbose', 'type': 'bool'},
'log_progress': {'key': 'logProgress', 'type': 'bool'},
'runbook_type': {'key': 'runbookType', 'type': 'str'},
'draft': {'key': 'draft', 'type': 'RunbookDraft'},
'description': {'key': 'description', 'type': 'str'},
'log_activity_trace': {'key': 'logActivityTrace', 'type': 'int'},
}
def __init__(
self,
*,
runbook_type: Union[str, "_models.RunbookTypeEnum"],
draft: "_models.RunbookDraft",
log_verbose: Optional[bool] = None,
log_progress: Optional[bool] = None,
description: Optional[str] = None,
log_activity_trace: Optional[int] = None,
**kwargs
):
"""
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword log_progress: Gets or sets progress log option.
:paramtype log_progress: bool
:keyword runbook_type: Required. Gets or sets the type of the runbook. Known values are:
"Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow",
"GraphPowerShell", "Python2", "Python3".
:paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum
:keyword draft: Required. Gets or sets the draft runbook properties.
:paramtype draft: ~azure.mgmt.automation.models.RunbookDraft
:keyword description: Gets or sets the description of the runbook.
:paramtype description: str
:keyword log_activity_trace: Gets or sets the activity-level tracing options of the runbook.
:paramtype log_activity_trace: int
"""
super(RunbookCreateOrUpdateDraftProperties, self).__init__(**kwargs)
self.log_verbose = log_verbose
self.log_progress = log_progress
self.runbook_type = runbook_type
self.draft = draft
self.description = description
self.log_activity_trace = log_activity_trace
class RunbookCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update runbook operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Gets or sets the name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar log_progress: Gets or sets progress log option.
:vartype log_progress: bool
:ivar runbook_type: Required. Gets or sets the type of the runbook. Known values are: "Script",
"Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow", "GraphPowerShell",
"Python2", "Python3".
:vartype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum
:ivar draft: Gets or sets the draft runbook properties.
:vartype draft: ~azure.mgmt.automation.models.RunbookDraft
:ivar publish_content_link: Gets or sets the published runbook content link.
:vartype publish_content_link: ~azure.mgmt.automation.models.ContentLink
:ivar description: Gets or sets the description of the runbook.
:vartype description: str
:ivar log_activity_trace: Gets or sets the activity-level tracing options of the runbook.
:vartype log_activity_trace: int
"""
_validation = {
'runbook_type': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'log_verbose': {'key': 'properties.logVerbose', 'type': 'bool'},
'log_progress': {'key': 'properties.logProgress', 'type': 'bool'},
'runbook_type': {'key': 'properties.runbookType', 'type': 'str'},
'draft': {'key': 'properties.draft', 'type': 'RunbookDraft'},
'publish_content_link': {'key': 'properties.publishContentLink', 'type': 'ContentLink'},
'description': {'key': 'properties.description', 'type': 'str'},
'log_activity_trace': {'key': 'properties.logActivityTrace', 'type': 'int'},
}
def __init__(
self,
*,
runbook_type: Union[str, "_models.RunbookTypeEnum"],
name: Optional[str] = None,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
log_verbose: Optional[bool] = None,
log_progress: Optional[bool] = None,
draft: Optional["_models.RunbookDraft"] = None,
publish_content_link: Optional["_models.ContentLink"] = None,
description: Optional[str] = None,
log_activity_trace: Optional[int] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword log_progress: Gets or sets progress log option.
:paramtype log_progress: bool
:keyword runbook_type: Required. Gets or sets the type of the runbook. Known values are:
"Script", "Graph", "PowerShellWorkflow", "PowerShell", "GraphPowerShellWorkflow",
"GraphPowerShell", "Python2", "Python3".
:paramtype runbook_type: str or ~azure.mgmt.automation.models.RunbookTypeEnum
:keyword draft: Gets or sets the draft runbook properties.
:paramtype draft: ~azure.mgmt.automation.models.RunbookDraft
:keyword publish_content_link: Gets or sets the published runbook content link.
:paramtype publish_content_link: ~azure.mgmt.automation.models.ContentLink
:keyword description: Gets or sets the description of the runbook.
:paramtype description: str
:keyword log_activity_trace: Gets or sets the activity-level tracing options of the runbook.
:paramtype log_activity_trace: int
"""
super(RunbookCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.tags = tags
self.log_verbose = log_verbose
self.log_progress = log_progress
self.runbook_type = runbook_type
self.draft = draft
self.publish_content_link = publish_content_link
self.description = description
self.log_activity_trace = log_activity_trace
class RunbookDraft(msrest.serialization.Model):
"""RunbookDraft.
:ivar in_edit: Gets or sets whether runbook is in edit mode.
:vartype in_edit: bool
:ivar draft_content_link: Gets or sets the draft runbook content link.
:vartype draft_content_link: ~azure.mgmt.automation.models.ContentLink
:ivar creation_time: Gets or sets the creation time of the runbook draft.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time of the runbook draft.
:vartype last_modified_time: ~datetime.datetime
:ivar parameters: Gets or sets the runbook draft parameters.
:vartype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter]
:ivar output_types: Gets or sets the runbook output types.
:vartype output_types: list[str]
"""
_attribute_map = {
'in_edit': {'key': 'inEdit', 'type': 'bool'},
'draft_content_link': {'key': 'draftContentLink', 'type': 'ContentLink'},
'creation_time': {'key': 'creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'},
'parameters': {'key': 'parameters', 'type': '{RunbookParameter}'},
'output_types': {'key': 'outputTypes', 'type': '[str]'},
}
def __init__(
self,
*,
in_edit: Optional[bool] = None,
draft_content_link: Optional["_models.ContentLink"] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
parameters: Optional[Dict[str, "_models.RunbookParameter"]] = None,
output_types: Optional[List[str]] = None,
**kwargs
):
"""
:keyword in_edit: Gets or sets whether runbook is in edit mode.
:paramtype in_edit: bool
:keyword draft_content_link: Gets or sets the draft runbook content link.
:paramtype draft_content_link: ~azure.mgmt.automation.models.ContentLink
:keyword creation_time: Gets or sets the creation time of the runbook draft.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time of the runbook draft.
:paramtype last_modified_time: ~datetime.datetime
:keyword parameters: Gets or sets the runbook draft parameters.
:paramtype parameters: dict[str, ~azure.mgmt.automation.models.RunbookParameter]
:keyword output_types: Gets or sets the runbook output types.
:paramtype output_types: list[str]
"""
super(RunbookDraft, self).__init__(**kwargs)
self.in_edit = in_edit
self.draft_content_link = draft_content_link
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.parameters = parameters
self.output_types = output_types
class RunbookDraftUndoEditResult(msrest.serialization.Model):
"""The response model for the undo edit runbook operation.
:ivar status_code: Known values are: "Continue", "SwitchingProtocols", "OK", "Created",
"Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent",
"MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther",
"RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb",
"BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed",
"NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone",
"LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong",
"UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired",
"InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout",
"HttpVersionNotSupported".
:vartype status_code: str or ~azure.mgmt.automation.models.HttpStatusCode
:ivar request_id:
:vartype request_id: str
"""
_attribute_map = {
'status_code': {'key': 'statusCode', 'type': 'str'},
'request_id': {'key': 'requestId', 'type': 'str'},
}
def __init__(
self,
*,
status_code: Optional[Union[str, "_models.HttpStatusCode"]] = None,
request_id: Optional[str] = None,
**kwargs
):
"""
:keyword status_code: Known values are: "Continue", "SwitchingProtocols", "OK", "Created",
"Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent",
"MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther",
"RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb",
"BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed",
"NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone",
"LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong",
"UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired",
"InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout",
"HttpVersionNotSupported".
:paramtype status_code: str or ~azure.mgmt.automation.models.HttpStatusCode
:keyword request_id:
:paramtype request_id: str
"""
super(RunbookDraftUndoEditResult, self).__init__(**kwargs)
self.status_code = status_code
self.request_id = request_id
class RunbookListResult(msrest.serialization.Model):
"""The response model for the list runbook operation.
:ivar value: Gets or sets a list of runbooks.
:vartype value: list[~azure.mgmt.automation.models.Runbook]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Runbook]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Runbook"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of runbooks.
:paramtype value: list[~azure.mgmt.automation.models.Runbook]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(RunbookListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class RunbookParameter(msrest.serialization.Model):
"""Definition of the runbook parameter type.
:ivar type: Gets or sets the type of the parameter.
:vartype type: str
:ivar is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is mandatory
or not.
:vartype is_mandatory: bool
:ivar position: Get or sets the position of the parameter.
:vartype position: int
:ivar default_value: Gets or sets the default value of parameter.
:vartype default_value: str
"""
_attribute_map = {
'type': {'key': 'type', 'type': 'str'},
'is_mandatory': {'key': 'isMandatory', 'type': 'bool'},
'position': {'key': 'position', 'type': 'int'},
'default_value': {'key': 'defaultValue', 'type': 'str'},
}
def __init__(
self,
*,
type: Optional[str] = None,
is_mandatory: Optional[bool] = None,
position: Optional[int] = None,
default_value: Optional[str] = None,
**kwargs
):
"""
:keyword type: Gets or sets the type of the parameter.
:paramtype type: str
:keyword is_mandatory: Gets or sets a Boolean value to indicate whether the parameter is
mandatory or not.
:paramtype is_mandatory: bool
:keyword position: Get or sets the position of the parameter.
:paramtype position: int
:keyword default_value: Gets or sets the default value of parameter.
:paramtype default_value: str
"""
super(RunbookParameter, self).__init__(**kwargs)
self.type = type
self.is_mandatory = is_mandatory
self.position = position
self.default_value = default_value
class RunbookUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update runbook operation.
:ivar name: Gets or sets the name of the resource.
:vartype name: str
:ivar location: Gets or sets the location of the resource.
:vartype location: str
:ivar tags: A set of tags. Gets or sets the tags attached to the resource.
:vartype tags: dict[str, str]
:ivar description: Gets or sets the description of the runbook.
:vartype description: str
:ivar log_verbose: Gets or sets verbose log option.
:vartype log_verbose: bool
:ivar log_progress: Gets or sets progress log option.
:vartype log_progress: bool
:ivar log_activity_trace: Gets or sets the activity-level tracing options of the runbook.
:vartype log_activity_trace: int
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'location': {'key': 'location', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'description': {'key': 'properties.description', 'type': 'str'},
'log_verbose': {'key': 'properties.logVerbose', 'type': 'bool'},
'log_progress': {'key': 'properties.logProgress', 'type': 'bool'},
'log_activity_trace': {'key': 'properties.logActivityTrace', 'type': 'int'},
}
def __init__(
self,
*,
name: Optional[str] = None,
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
description: Optional[str] = None,
log_verbose: Optional[bool] = None,
log_progress: Optional[bool] = None,
log_activity_trace: Optional[int] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the resource.
:paramtype name: str
:keyword location: Gets or sets the location of the resource.
:paramtype location: str
:keyword tags: A set of tags. Gets or sets the tags attached to the resource.
:paramtype tags: dict[str, str]
:keyword description: Gets or sets the description of the runbook.
:paramtype description: str
:keyword log_verbose: Gets or sets verbose log option.
:paramtype log_verbose: bool
:keyword log_progress: Gets or sets progress log option.
:paramtype log_progress: bool
:keyword log_activity_trace: Gets or sets the activity-level tracing options of the runbook.
:paramtype log_activity_trace: int
"""
super(RunbookUpdateParameters, self).__init__(**kwargs)
self.name = name
self.location = location
self.tags = tags
self.description = description
self.log_verbose = log_verbose
self.log_progress = log_progress
self.log_activity_trace = log_activity_trace
class Schedule(ProxyResource):
"""Definition of the schedule.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar start_time: Gets or sets the start time of the schedule.
:vartype start_time: ~datetime.datetime
:ivar start_time_offset_minutes: Gets the start time's offset in minutes.
:vartype start_time_offset_minutes: float
:ivar expiry_time: Gets or sets the end time of the schedule.
:vartype expiry_time: ~datetime.datetime
:ivar expiry_time_offset_minutes: Gets or sets the expiry time's offset in minutes.
:vartype expiry_time_offset_minutes: float
:ivar is_enabled: Gets or sets a value indicating whether this schedule is enabled.
:vartype is_enabled: bool
:ivar next_run: Gets or sets the next run time of the schedule.
:vartype next_run: ~datetime.datetime
:ivar next_run_offset_minutes: Gets or sets the next run time's offset in minutes.
:vartype next_run_offset_minutes: float
:ivar interval: Gets or sets the interval of the schedule.
:vartype interval: any
:ivar frequency: Gets or sets the frequency of the schedule. Known values are: "OneTime",
"Day", "Hour", "Week", "Month", "Minute".
:vartype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:ivar time_zone: Gets or sets the time zone of the schedule.
:vartype time_zone: str
:ivar advanced_schedule: Gets or sets the advanced schedule.
:vartype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'start_time_offset_minutes': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'start_time_offset_minutes': {'key': 'properties.startTimeOffsetMinutes', 'type': 'float'},
'expiry_time': {'key': 'properties.expiryTime', 'type': 'iso-8601'},
'expiry_time_offset_minutes': {'key': 'properties.expiryTimeOffsetMinutes', 'type': 'float'},
'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'},
'next_run': {'key': 'properties.nextRun', 'type': 'iso-8601'},
'next_run_offset_minutes': {'key': 'properties.nextRunOffsetMinutes', 'type': 'float'},
'interval': {'key': 'properties.interval', 'type': 'object'},
'frequency': {'key': 'properties.frequency', 'type': 'str'},
'time_zone': {'key': 'properties.timeZone', 'type': 'str'},
'advanced_schedule': {'key': 'properties.advancedSchedule', 'type': 'AdvancedSchedule'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
start_time: Optional[datetime.datetime] = None,
expiry_time: Optional[datetime.datetime] = None,
expiry_time_offset_minutes: Optional[float] = None,
is_enabled: Optional[bool] = False,
next_run: Optional[datetime.datetime] = None,
next_run_offset_minutes: Optional[float] = None,
interval: Optional[Any] = None,
frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = None,
time_zone: Optional[str] = None,
advanced_schedule: Optional["_models.AdvancedSchedule"] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword start_time: Gets or sets the start time of the schedule.
:paramtype start_time: ~datetime.datetime
:keyword expiry_time: Gets or sets the end time of the schedule.
:paramtype expiry_time: ~datetime.datetime
:keyword expiry_time_offset_minutes: Gets or sets the expiry time's offset in minutes.
:paramtype expiry_time_offset_minutes: float
:keyword is_enabled: Gets or sets a value indicating whether this schedule is enabled.
:paramtype is_enabled: bool
:keyword next_run: Gets or sets the next run time of the schedule.
:paramtype next_run: ~datetime.datetime
:keyword next_run_offset_minutes: Gets or sets the next run time's offset in minutes.
:paramtype next_run_offset_minutes: float
:keyword interval: Gets or sets the interval of the schedule.
:paramtype interval: any
:keyword frequency: Gets or sets the frequency of the schedule. Known values are: "OneTime",
"Day", "Hour", "Week", "Month", "Minute".
:paramtype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:keyword time_zone: Gets or sets the time zone of the schedule.
:paramtype time_zone: str
:keyword advanced_schedule: Gets or sets the advanced schedule.
:paramtype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Schedule, self).__init__(**kwargs)
self.start_time = start_time
self.start_time_offset_minutes = None
self.expiry_time = expiry_time
self.expiry_time_offset_minutes = expiry_time_offset_minutes
self.is_enabled = is_enabled
self.next_run = next_run
self.next_run_offset_minutes = next_run_offset_minutes
self.interval = interval
self.frequency = frequency
self.time_zone = time_zone
self.advanced_schedule = advanced_schedule
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.description = description
class ScheduleAssociationProperty(msrest.serialization.Model):
"""The schedule property associated with the entity.
:ivar name: Gets or sets the name of the Schedule.
:vartype name: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the Schedule.
:paramtype name: str
"""
super(ScheduleAssociationProperty, self).__init__(**kwargs)
self.name = name
class ScheduleCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update schedule operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the Schedule.
:vartype name: str
:ivar description: Gets or sets the description of the schedule.
:vartype description: str
:ivar start_time: Required. Gets or sets the start time of the schedule.
:vartype start_time: ~datetime.datetime
:ivar expiry_time: Gets or sets the end time of the schedule.
:vartype expiry_time: ~datetime.datetime
:ivar interval: Gets or sets the interval of the schedule.
:vartype interval: any
:ivar frequency: Required. Gets or sets the frequency of the schedule. Known values are:
"OneTime", "Day", "Hour", "Week", "Month", "Minute".
:vartype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:ivar time_zone: Gets or sets the time zone of the schedule.
:vartype time_zone: str
:ivar advanced_schedule: Gets or sets the AdvancedSchedule.
:vartype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule
"""
_validation = {
'name': {'required': True},
'start_time': {'required': True},
'frequency': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'expiry_time': {'key': 'properties.expiryTime', 'type': 'iso-8601'},
'interval': {'key': 'properties.interval', 'type': 'object'},
'frequency': {'key': 'properties.frequency', 'type': 'str'},
'time_zone': {'key': 'properties.timeZone', 'type': 'str'},
'advanced_schedule': {'key': 'properties.advancedSchedule', 'type': 'AdvancedSchedule'},
}
def __init__(
self,
*,
name: str,
start_time: datetime.datetime,
frequency: Union[str, "_models.ScheduleFrequency"],
description: Optional[str] = None,
expiry_time: Optional[datetime.datetime] = None,
interval: Optional[Any] = None,
time_zone: Optional[str] = None,
advanced_schedule: Optional["_models.AdvancedSchedule"] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the Schedule.
:paramtype name: str
:keyword description: Gets or sets the description of the schedule.
:paramtype description: str
:keyword start_time: Required. Gets or sets the start time of the schedule.
:paramtype start_time: ~datetime.datetime
:keyword expiry_time: Gets or sets the end time of the schedule.
:paramtype expiry_time: ~datetime.datetime
:keyword interval: Gets or sets the interval of the schedule.
:paramtype interval: any
:keyword frequency: Required. Gets or sets the frequency of the schedule. Known values are:
"OneTime", "Day", "Hour", "Week", "Month", "Minute".
:paramtype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:keyword time_zone: Gets or sets the time zone of the schedule.
:paramtype time_zone: str
:keyword advanced_schedule: Gets or sets the AdvancedSchedule.
:paramtype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule
"""
super(ScheduleCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.description = description
self.start_time = start_time
self.expiry_time = expiry_time
self.interval = interval
self.frequency = frequency
self.time_zone = time_zone
self.advanced_schedule = advanced_schedule
class ScheduleListResult(msrest.serialization.Model):
"""The response model for the list schedule operation.
:ivar value: Gets or sets a list of schedules.
:vartype value: list[~azure.mgmt.automation.models.Schedule]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Schedule]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Schedule"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of schedules.
:paramtype value: list[~azure.mgmt.automation.models.Schedule]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(ScheduleListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class ScheduleUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update schedule operation.
:ivar name: Gets or sets the name of the Schedule.
:vartype name: str
:ivar description: Gets or sets the description of the schedule.
:vartype description: str
:ivar is_enabled: Gets or sets a value indicating whether this schedule is enabled.
:vartype is_enabled: bool
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'},
}
def __init__(
self,
*,
name: Optional[str] = None,
description: Optional[str] = None,
is_enabled: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the Schedule.
:paramtype name: str
:keyword description: Gets or sets the description of the schedule.
:paramtype description: str
:keyword is_enabled: Gets or sets a value indicating whether this schedule is enabled.
:paramtype is_enabled: bool
"""
super(ScheduleUpdateParameters, self).__init__(**kwargs)
self.name = name
self.description = description
self.is_enabled = is_enabled
class Sku(msrest.serialization.Model):
"""The account SKU.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the SKU name of the account. Known values are: "Free",
"Basic".
:vartype name: str or ~azure.mgmt.automation.models.SkuNameEnum
:ivar family: Gets or sets the SKU family.
:vartype family: str
:ivar capacity: Gets or sets the SKU capacity.
:vartype capacity: int
"""
_validation = {
'name': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'family': {'key': 'family', 'type': 'str'},
'capacity': {'key': 'capacity', 'type': 'int'},
}
def __init__(
self,
*,
name: Union[str, "_models.SkuNameEnum"],
family: Optional[str] = None,
capacity: Optional[int] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the SKU name of the account. Known values are: "Free",
"Basic".
:paramtype name: str or ~azure.mgmt.automation.models.SkuNameEnum
:keyword family: Gets or sets the SKU family.
:paramtype family: str
:keyword capacity: Gets or sets the SKU capacity.
:paramtype capacity: int
"""
super(Sku, self).__init__(**kwargs)
self.name = name
self.family = family
self.capacity = capacity
class SoftwareUpdateConfiguration(msrest.serialization.Model):
"""Software update configuration properties.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar name: Resource name.
:vartype name: str
:ivar id: Resource Id.
:vartype id: str
:ivar type: Resource type.
:vartype type: str
:ivar update_configuration: Required. update specific properties for the Software update
configuration.
:vartype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration
:ivar schedule_info: Required. Schedule information for the Software update configuration.
:vartype schedule_info: ~azure.mgmt.automation.models.SUCScheduleProperties
:ivar provisioning_state: Provisioning state for the software update configuration, which only
appears in the response.
:vartype provisioning_state: str
:ivar error: Details of provisioning error.
:vartype error: ~azure.mgmt.automation.models.ErrorResponse
:ivar creation_time: Creation time of the resource, which only appears in the response.
:vartype creation_time: ~datetime.datetime
:ivar created_by: CreatedBy property, which only appears in the response.
:vartype created_by: str
:ivar last_modified_time: Last time resource was modified, which only appears in the response.
:vartype last_modified_time: ~datetime.datetime
:ivar last_modified_by: LastModifiedBy property, which only appears in the response.
:vartype last_modified_by: str
:ivar tasks: Tasks information for the Software update configuration.
:vartype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks
"""
_validation = {
'name': {'readonly': True},
'id': {'readonly': True},
'type': {'readonly': True},
'update_configuration': {'required': True},
'schedule_info': {'required': True},
'provisioning_state': {'readonly': True},
'creation_time': {'readonly': True},
'created_by': {'readonly': True},
'last_modified_time': {'readonly': True},
'last_modified_by': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'update_configuration': {'key': 'properties.updateConfiguration', 'type': 'UpdateConfiguration'},
'schedule_info': {'key': 'properties.scheduleInfo', 'type': 'SUCScheduleProperties'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'error': {'key': 'properties.error', 'type': 'ErrorResponse'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'created_by': {'key': 'properties.createdBy', 'type': 'str'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'tasks': {'key': 'properties.tasks', 'type': 'SoftwareUpdateConfigurationTasks'},
}
def __init__(
self,
*,
update_configuration: "_models.UpdateConfiguration",
schedule_info: "_models.SUCScheduleProperties",
error: Optional["_models.ErrorResponse"] = None,
tasks: Optional["_models.SoftwareUpdateConfigurationTasks"] = None,
**kwargs
):
"""
:keyword update_configuration: Required. update specific properties for the Software update
configuration.
:paramtype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration
:keyword schedule_info: Required. Schedule information for the Software update configuration.
:paramtype schedule_info: ~azure.mgmt.automation.models.SUCScheduleProperties
:keyword error: Details of provisioning error.
:paramtype error: ~azure.mgmt.automation.models.ErrorResponse
:keyword tasks: Tasks information for the Software update configuration.
:paramtype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks
"""
super(SoftwareUpdateConfiguration, self).__init__(**kwargs)
self.name = None
self.id = None
self.type = None
self.update_configuration = update_configuration
self.schedule_info = schedule_info
self.provisioning_state = None
self.error = error
self.creation_time = None
self.created_by = None
self.last_modified_time = None
self.last_modified_by = None
self.tasks = tasks
class SoftwareUpdateConfigurationCollectionItem(msrest.serialization.Model):
"""Software update configuration collection item properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: Name of the software update configuration.
:vartype name: str
:ivar id: Resource Id of the software update configuration.
:vartype id: str
:ivar update_configuration: Update specific properties of the software update configuration.
:vartype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration
:ivar tasks: Pre and Post Tasks defined.
:vartype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks
:ivar frequency: execution frequency of the schedule associated with the software update
configuration. Known values are: "OneTime", "Day", "Hour", "Week", "Month", "Minute".
:vartype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:ivar start_time: the start time of the update.
:vartype start_time: ~datetime.datetime
:ivar creation_time: Creation time of the software update configuration, which only appears in
the response.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Last time software update configuration was modified, which only
appears in the response.
:vartype last_modified_time: ~datetime.datetime
:ivar provisioning_state: Provisioning state for the software update configuration, which only
appears in the response.
:vartype provisioning_state: str
:ivar next_run: ext run time of the update.
:vartype next_run: ~datetime.datetime
"""
_validation = {
'name': {'readonly': True},
'id': {'readonly': True},
'creation_time': {'readonly': True},
'last_modified_time': {'readonly': True},
'provisioning_state': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'update_configuration': {'key': 'properties.updateConfiguration', 'type': 'UpdateConfiguration'},
'tasks': {'key': 'properties.tasks', 'type': 'SoftwareUpdateConfigurationTasks'},
'frequency': {'key': 'properties.frequency', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'next_run': {'key': 'properties.nextRun', 'type': 'iso-8601'},
}
def __init__(
self,
*,
update_configuration: Optional["_models.UpdateConfiguration"] = None,
tasks: Optional["_models.SoftwareUpdateConfigurationTasks"] = None,
frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = None,
start_time: Optional[datetime.datetime] = None,
next_run: Optional[datetime.datetime] = None,
**kwargs
):
"""
:keyword update_configuration: Update specific properties of the software update configuration.
:paramtype update_configuration: ~azure.mgmt.automation.models.UpdateConfiguration
:keyword tasks: Pre and Post Tasks defined.
:paramtype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationTasks
:keyword frequency: execution frequency of the schedule associated with the software update
configuration. Known values are: "OneTime", "Day", "Hour", "Week", "Month", "Minute".
:paramtype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:keyword start_time: the start time of the update.
:paramtype start_time: ~datetime.datetime
:keyword next_run: ext run time of the update.
:paramtype next_run: ~datetime.datetime
"""
super(SoftwareUpdateConfigurationCollectionItem, self).__init__(**kwargs)
self.name = None
self.id = None
self.update_configuration = update_configuration
self.tasks = tasks
self.frequency = frequency
self.start_time = start_time
self.creation_time = None
self.last_modified_time = None
self.provisioning_state = None
self.next_run = next_run
class SoftwareUpdateConfigurationListResult(msrest.serialization.Model):
"""result of listing all software update configuration.
:ivar value: outer object returned when listing all software update configurations.
:vartype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationCollectionItem]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[SoftwareUpdateConfigurationCollectionItem]'},
}
def __init__(
self,
*,
value: Optional[List["_models.SoftwareUpdateConfigurationCollectionItem"]] = None,
**kwargs
):
"""
:keyword value: outer object returned when listing all software update configurations.
:paramtype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationCollectionItem]
"""
super(SoftwareUpdateConfigurationListResult, self).__init__(**kwargs)
self.value = value
class SoftwareUpdateConfigurationMachineRun(msrest.serialization.Model):
"""Software update configuration machine run model.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: Name of the software update configuration machine run.
:vartype name: str
:ivar id: Resource Id of the software update configuration machine run.
:vartype id: str
:ivar target_computer: name of the updated computer.
:vartype target_computer: str
:ivar target_computer_type: type of the updated computer.
:vartype target_computer_type: str
:ivar software_update_configuration: software update configuration triggered this run.
:vartype software_update_configuration:
~azure.mgmt.automation.models.UpdateConfigurationNavigation
:ivar status: Status of the software update configuration machine run.
:vartype status: str
:ivar os_type: Operating system target of the software update configuration triggered this run.
:vartype os_type: str
:ivar correlation_id: correlation id of the software update configuration machine run.
:vartype correlation_id: str
:ivar source_computer_id: source computer id of the software update configuration machine run.
:vartype source_computer_id: str
:ivar start_time: Start time of the software update configuration machine run.
:vartype start_time: ~datetime.datetime
:ivar end_time: End time of the software update configuration machine run.
:vartype end_time: ~datetime.datetime
:ivar configured_duration: configured duration for the software update configuration run.
:vartype configured_duration: str
:ivar job: Job associated with the software update configuration machine run.
:vartype job: ~azure.mgmt.automation.models.JobNavigation
:ivar creation_time: Creation time of the resource, which only appears in the response.
:vartype creation_time: ~datetime.datetime
:ivar created_by: createdBy property, which only appears in the response.
:vartype created_by: str
:ivar last_modified_time: Last time resource was modified, which only appears in the response.
:vartype last_modified_time: ~datetime.datetime
:ivar last_modified_by: lastModifiedBy property, which only appears in the response.
:vartype last_modified_by: str
:ivar error: Details of provisioning error.
:vartype error: ~azure.mgmt.automation.models.ErrorResponse
"""
_validation = {
'name': {'readonly': True},
'id': {'readonly': True},
'target_computer': {'readonly': True},
'target_computer_type': {'readonly': True},
'status': {'readonly': True},
'os_type': {'readonly': True},
'correlation_id': {'readonly': True},
'source_computer_id': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
'configured_duration': {'readonly': True},
'creation_time': {'readonly': True},
'created_by': {'readonly': True},
'last_modified_time': {'readonly': True},
'last_modified_by': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'target_computer': {'key': 'properties.targetComputer', 'type': 'str'},
'target_computer_type': {'key': 'properties.targetComputerType', 'type': 'str'},
'software_update_configuration': {'key': 'properties.softwareUpdateConfiguration', 'type': 'UpdateConfigurationNavigation'},
'status': {'key': 'properties.status', 'type': 'str'},
'os_type': {'key': 'properties.osType', 'type': 'str'},
'correlation_id': {'key': 'properties.correlationId', 'type': 'str'},
'source_computer_id': {'key': 'properties.sourceComputerId', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'configured_duration': {'key': 'properties.configuredDuration', 'type': 'str'},
'job': {'key': 'properties.job', 'type': 'JobNavigation'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'created_by': {'key': 'properties.createdBy', 'type': 'str'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'error': {'key': 'properties.error', 'type': 'ErrorResponse'},
}
def __init__(
self,
*,
software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = None,
job: Optional["_models.JobNavigation"] = None,
error: Optional["_models.ErrorResponse"] = None,
**kwargs
):
"""
:keyword software_update_configuration: software update configuration triggered this run.
:paramtype software_update_configuration:
~azure.mgmt.automation.models.UpdateConfigurationNavigation
:keyword job: Job associated with the software update configuration machine run.
:paramtype job: ~azure.mgmt.automation.models.JobNavigation
:keyword error: Details of provisioning error.
:paramtype error: ~azure.mgmt.automation.models.ErrorResponse
"""
super(SoftwareUpdateConfigurationMachineRun, self).__init__(**kwargs)
self.name = None
self.id = None
self.target_computer = None
self.target_computer_type = None
self.software_update_configuration = software_update_configuration
self.status = None
self.os_type = None
self.correlation_id = None
self.source_computer_id = None
self.start_time = None
self.end_time = None
self.configured_duration = None
self.job = job
self.creation_time = None
self.created_by = None
self.last_modified_time = None
self.last_modified_by = None
self.error = error
class SoftwareUpdateConfigurationMachineRunListResult(msrest.serialization.Model):
"""result of listing all software update configuration machine runs.
:ivar value: outer object returned when listing all software update configuration machine runs.
:vartype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun]
:ivar next_link: link to next page of results.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[SoftwareUpdateConfigurationMachineRun]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.SoftwareUpdateConfigurationMachineRun"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: outer object returned when listing all software update configuration machine
runs.
:paramtype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationMachineRun]
:keyword next_link: link to next page of results.
:paramtype next_link: str
"""
super(SoftwareUpdateConfigurationMachineRunListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class SoftwareUpdateConfigurationRun(msrest.serialization.Model):
"""Software update configuration Run properties.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: Name of the software update configuration run.
:vartype name: str
:ivar id: Resource Id of the software update configuration run.
:vartype id: str
:ivar software_update_configuration: software update configuration triggered this run.
:vartype software_update_configuration:
~azure.mgmt.automation.models.UpdateConfigurationNavigation
:ivar status: Status of the software update configuration run.
:vartype status: str
:ivar configured_duration: Configured duration for the software update configuration run.
:vartype configured_duration: str
:ivar os_type: Operating system target of the software update configuration triggered this run.
:vartype os_type: str
:ivar start_time: Start time of the software update configuration run.
:vartype start_time: ~datetime.datetime
:ivar end_time: End time of the software update configuration run.
:vartype end_time: ~datetime.datetime
:ivar computer_count: Number of computers in the software update configuration run.
:vartype computer_count: int
:ivar failed_count: Number of computers with failed status.
:vartype failed_count: int
:ivar creation_time: Creation time of the resource, which only appears in the response.
:vartype creation_time: ~datetime.datetime
:ivar created_by: CreatedBy property, which only appears in the response.
:vartype created_by: str
:ivar last_modified_time: Last time resource was modified, which only appears in the response.
:vartype last_modified_time: ~datetime.datetime
:ivar last_modified_by: LastModifiedBy property, which only appears in the response.
:vartype last_modified_by: str
:ivar tasks: Software update configuration tasks triggered in this run.
:vartype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTasks
"""
_validation = {
'name': {'readonly': True},
'id': {'readonly': True},
'status': {'readonly': True},
'configured_duration': {'readonly': True},
'os_type': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
'computer_count': {'readonly': True},
'failed_count': {'readonly': True},
'creation_time': {'readonly': True},
'created_by': {'readonly': True},
'last_modified_time': {'readonly': True},
'last_modified_by': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'software_update_configuration': {'key': 'properties.softwareUpdateConfiguration', 'type': 'UpdateConfigurationNavigation'},
'status': {'key': 'properties.status', 'type': 'str'},
'configured_duration': {'key': 'properties.configuredDuration', 'type': 'str'},
'os_type': {'key': 'properties.osType', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'computer_count': {'key': 'properties.computerCount', 'type': 'int'},
'failed_count': {'key': 'properties.failedCount', 'type': 'int'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'created_by': {'key': 'properties.createdBy', 'type': 'str'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'tasks': {'key': 'properties.tasks', 'type': 'SoftwareUpdateConfigurationRunTasks'},
}
def __init__(
self,
*,
software_update_configuration: Optional["_models.UpdateConfigurationNavigation"] = None,
tasks: Optional["_models.SoftwareUpdateConfigurationRunTasks"] = None,
**kwargs
):
"""
:keyword software_update_configuration: software update configuration triggered this run.
:paramtype software_update_configuration:
~azure.mgmt.automation.models.UpdateConfigurationNavigation
:keyword tasks: Software update configuration tasks triggered in this run.
:paramtype tasks: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTasks
"""
super(SoftwareUpdateConfigurationRun, self).__init__(**kwargs)
self.name = None
self.id = None
self.software_update_configuration = software_update_configuration
self.status = None
self.configured_duration = None
self.os_type = None
self.start_time = None
self.end_time = None
self.computer_count = None
self.failed_count = None
self.creation_time = None
self.created_by = None
self.last_modified_time = None
self.last_modified_by = None
self.tasks = tasks
class SoftwareUpdateConfigurationRunListResult(msrest.serialization.Model):
"""result of listing all software update configuration runs.
:ivar value: outer object returned when listing all software update configuration runs.
:vartype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun]
:ivar next_link: link to next page of results.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[SoftwareUpdateConfigurationRun]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.SoftwareUpdateConfigurationRun"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: outer object returned when listing all software update configuration runs.
:paramtype value: list[~azure.mgmt.automation.models.SoftwareUpdateConfigurationRun]
:keyword next_link: link to next page of results.
:paramtype next_link: str
"""
super(SoftwareUpdateConfigurationRunListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class SoftwareUpdateConfigurationRunTaskProperties(msrest.serialization.Model):
"""Task properties of the software update configuration.
:ivar status: The status of the task.
:vartype status: str
:ivar source: The name of the source of the task.
:vartype source: str
:ivar job_id: The job id of the task.
:vartype job_id: str
"""
_attribute_map = {
'status': {'key': 'status', 'type': 'str'},
'source': {'key': 'source', 'type': 'str'},
'job_id': {'key': 'jobId', 'type': 'str'},
}
def __init__(
self,
*,
status: Optional[str] = None,
source: Optional[str] = None,
job_id: Optional[str] = None,
**kwargs
):
"""
:keyword status: The status of the task.
:paramtype status: str
:keyword source: The name of the source of the task.
:paramtype source: str
:keyword job_id: The job id of the task.
:paramtype job_id: str
"""
super(SoftwareUpdateConfigurationRunTaskProperties, self).__init__(**kwargs)
self.status = status
self.source = source
self.job_id = job_id
class SoftwareUpdateConfigurationRunTasks(msrest.serialization.Model):
"""Software update configuration run tasks model.
:ivar pre_task: Pre task properties.
:vartype pre_task: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties
:ivar post_task: Post task properties.
:vartype post_task: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties
"""
_attribute_map = {
'pre_task': {'key': 'preTask', 'type': 'SoftwareUpdateConfigurationRunTaskProperties'},
'post_task': {'key': 'postTask', 'type': 'SoftwareUpdateConfigurationRunTaskProperties'},
}
def __init__(
self,
*,
pre_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = None,
post_task: Optional["_models.SoftwareUpdateConfigurationRunTaskProperties"] = None,
**kwargs
):
"""
:keyword pre_task: Pre task properties.
:paramtype pre_task: ~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties
:keyword post_task: Post task properties.
:paramtype post_task:
~azure.mgmt.automation.models.SoftwareUpdateConfigurationRunTaskProperties
"""
super(SoftwareUpdateConfigurationRunTasks, self).__init__(**kwargs)
self.pre_task = pre_task
self.post_task = post_task
class SoftwareUpdateConfigurationTasks(msrest.serialization.Model):
"""Task properties of the software update configuration.
:ivar pre_task: Pre task properties.
:vartype pre_task: ~azure.mgmt.automation.models.TaskProperties
:ivar post_task: Post task properties.
:vartype post_task: ~azure.mgmt.automation.models.TaskProperties
"""
_attribute_map = {
'pre_task': {'key': 'preTask', 'type': 'TaskProperties'},
'post_task': {'key': 'postTask', 'type': 'TaskProperties'},
}
def __init__(
self,
*,
pre_task: Optional["_models.TaskProperties"] = None,
post_task: Optional["_models.TaskProperties"] = None,
**kwargs
):
"""
:keyword pre_task: Pre task properties.
:paramtype pre_task: ~azure.mgmt.automation.models.TaskProperties
:keyword post_task: Post task properties.
:paramtype post_task: ~azure.mgmt.automation.models.TaskProperties
"""
super(SoftwareUpdateConfigurationTasks, self).__init__(**kwargs)
self.pre_task = pre_task
self.post_task = post_task
class SourceControl(ProxyResource):
"""Definition of the source control.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar repo_url: The repo url of the source control.
:vartype repo_url: str
:ivar branch: The repo branch of the source control. Include branch as empty string for
VsoTfvc.
:vartype branch: str
:ivar folder_path: The folder path of the source control.
:vartype folder_path: str
:ivar auto_sync: The auto sync of the source control. Default is false.
:vartype auto_sync: bool
:ivar publish_runbook: The auto publish of the source control. Default is true.
:vartype publish_runbook: bool
:ivar source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub. Known values are:
"VsoGit", "VsoTfvc", "GitHub".
:vartype source_type: str or ~azure.mgmt.automation.models.SourceType
:ivar description: The description.
:vartype description: str
:ivar creation_time: The creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: The last modified time.
:vartype last_modified_time: ~datetime.datetime
"""
_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'},
'repo_url': {'key': 'properties.repoUrl', 'type': 'str'},
'branch': {'key': 'properties.branch', 'type': 'str'},
'folder_path': {'key': 'properties.folderPath', 'type': 'str'},
'auto_sync': {'key': 'properties.autoSync', 'type': 'bool'},
'publish_runbook': {'key': 'properties.publishRunbook', 'type': 'bool'},
'source_type': {'key': 'properties.sourceType', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
}
def __init__(
self,
*,
repo_url: Optional[str] = None,
branch: Optional[str] = None,
folder_path: Optional[str] = None,
auto_sync: Optional[bool] = None,
publish_runbook: Optional[bool] = None,
source_type: Optional[Union[str, "_models.SourceType"]] = None,
description: Optional[str] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
**kwargs
):
"""
:keyword repo_url: The repo url of the source control.
:paramtype repo_url: str
:keyword branch: The repo branch of the source control. Include branch as empty string for
VsoTfvc.
:paramtype branch: str
:keyword folder_path: The folder path of the source control.
:paramtype folder_path: str
:keyword auto_sync: The auto sync of the source control. Default is false.
:paramtype auto_sync: bool
:keyword publish_runbook: The auto publish of the source control. Default is true.
:paramtype publish_runbook: bool
:keyword source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub. Known values
are: "VsoGit", "VsoTfvc", "GitHub".
:paramtype source_type: str or ~azure.mgmt.automation.models.SourceType
:keyword description: The description.
:paramtype description: str
:keyword creation_time: The creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: The last modified time.
:paramtype last_modified_time: ~datetime.datetime
"""
super(SourceControl, self).__init__(**kwargs)
self.repo_url = repo_url
self.branch = branch
self.folder_path = folder_path
self.auto_sync = auto_sync
self.publish_runbook = publish_runbook
self.source_type = source_type
self.description = description
self.creation_time = creation_time
self.last_modified_time = last_modified_time
class SourceControlCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update source control operation.
:ivar repo_url: The repo url of the source control.
:vartype repo_url: str
:ivar branch: The repo branch of the source control. Include branch as empty string for
VsoTfvc.
:vartype branch: str
:ivar folder_path: The folder path of the source control. Path must be relative.
:vartype folder_path: str
:ivar auto_sync: The auto async of the source control. Default is false.
:vartype auto_sync: bool
:ivar publish_runbook: The auto publish of the source control. Default is true.
:vartype publish_runbook: bool
:ivar source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub, case sensitive.
Known values are: "VsoGit", "VsoTfvc", "GitHub".
:vartype source_type: str or ~azure.mgmt.automation.models.SourceType
:ivar security_token: The authorization token for the repo of the source control.
:vartype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties
:ivar description: The user description of the source control.
:vartype description: str
"""
_validation = {
'repo_url': {'max_length': 2000, 'min_length': 0},
'branch': {'max_length': 255, 'min_length': 0},
'folder_path': {'max_length': 255, 'min_length': 0},
'description': {'max_length': 512, 'min_length': 0},
}
_attribute_map = {
'repo_url': {'key': 'properties.repoUrl', 'type': 'str'},
'branch': {'key': 'properties.branch', 'type': 'str'},
'folder_path': {'key': 'properties.folderPath', 'type': 'str'},
'auto_sync': {'key': 'properties.autoSync', 'type': 'bool'},
'publish_runbook': {'key': 'properties.publishRunbook', 'type': 'bool'},
'source_type': {'key': 'properties.sourceType', 'type': 'str'},
'security_token': {'key': 'properties.securityToken', 'type': 'SourceControlSecurityTokenProperties'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
repo_url: Optional[str] = None,
branch: Optional[str] = None,
folder_path: Optional[str] = None,
auto_sync: Optional[bool] = None,
publish_runbook: Optional[bool] = None,
source_type: Optional[Union[str, "_models.SourceType"]] = None,
security_token: Optional["_models.SourceControlSecurityTokenProperties"] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword repo_url: The repo url of the source control.
:paramtype repo_url: str
:keyword branch: The repo branch of the source control. Include branch as empty string for
VsoTfvc.
:paramtype branch: str
:keyword folder_path: The folder path of the source control. Path must be relative.
:paramtype folder_path: str
:keyword auto_sync: The auto async of the source control. Default is false.
:paramtype auto_sync: bool
:keyword publish_runbook: The auto publish of the source control. Default is true.
:paramtype publish_runbook: bool
:keyword source_type: The source type. Must be one of VsoGit, VsoTfvc, GitHub, case sensitive.
Known values are: "VsoGit", "VsoTfvc", "GitHub".
:paramtype source_type: str or ~azure.mgmt.automation.models.SourceType
:keyword security_token: The authorization token for the repo of the source control.
:paramtype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties
:keyword description: The user description of the source control.
:paramtype description: str
"""
super(SourceControlCreateOrUpdateParameters, self).__init__(**kwargs)
self.repo_url = repo_url
self.branch = branch
self.folder_path = folder_path
self.auto_sync = auto_sync
self.publish_runbook = publish_runbook
self.source_type = source_type
self.security_token = security_token
self.description = description
class SourceControlListResult(msrest.serialization.Model):
"""The response model for the list source controls operation.
:ivar value: The list of source controls.
:vartype value: list[~azure.mgmt.automation.models.SourceControl]
:ivar next_link: The next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[SourceControl]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.SourceControl"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: The list of source controls.
:paramtype value: list[~azure.mgmt.automation.models.SourceControl]
:keyword next_link: The next link.
:paramtype next_link: str
"""
super(SourceControlListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class SourceControlSecurityTokenProperties(msrest.serialization.Model):
"""SourceControlSecurityTokenProperties.
:ivar access_token: The access token.
:vartype access_token: str
:ivar refresh_token: The refresh token.
:vartype refresh_token: str
:ivar token_type: The token type. Must be either PersonalAccessToken or Oauth. Known values
are: "PersonalAccessToken", "Oauth".
:vartype token_type: str or ~azure.mgmt.automation.models.TokenType
"""
_validation = {
'access_token': {'max_length': 1024, 'min_length': 0},
'refresh_token': {'max_length': 1024, 'min_length': 0},
}
_attribute_map = {
'access_token': {'key': 'accessToken', 'type': 'str'},
'refresh_token': {'key': 'refreshToken', 'type': 'str'},
'token_type': {'key': 'tokenType', 'type': 'str'},
}
def __init__(
self,
*,
access_token: Optional[str] = None,
refresh_token: Optional[str] = None,
token_type: Optional[Union[str, "_models.TokenType"]] = None,
**kwargs
):
"""
:keyword access_token: The access token.
:paramtype access_token: str
:keyword refresh_token: The refresh token.
:paramtype refresh_token: str
:keyword token_type: The token type. Must be either PersonalAccessToken or Oauth. Known values
are: "PersonalAccessToken", "Oauth".
:paramtype token_type: str or ~azure.mgmt.automation.models.TokenType
"""
super(SourceControlSecurityTokenProperties, self).__init__(**kwargs)
self.access_token = access_token
self.refresh_token = refresh_token
self.token_type = token_type
class SourceControlSyncJob(msrest.serialization.Model):
"""Definition of the source control sync job.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar id: Resource id.
:vartype id: str
:ivar source_control_sync_job_id: The source control sync job id.
:vartype source_control_sync_job_id: str
:ivar creation_time: The creation time of the job.
:vartype creation_time: ~datetime.datetime
:ivar provisioning_state: The provisioning state of the job. Known values are: "Completed",
"Failed", "Running".
:vartype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState
:ivar start_time: The start time of the job.
:vartype start_time: ~datetime.datetime
:ivar end_time: The end time of the job.
:vartype end_time: ~datetime.datetime
:ivar sync_type: The sync type. Known values are: "PartialSync", "FullSync".
:vartype sync_type: str or ~azure.mgmt.automation.models.SyncType
"""
_validation = {
'name': {'readonly': True},
'type': {'readonly': True},
'id': {'readonly': True},
'creation_time': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'id': {'key': 'id', 'type': 'str'},
'source_control_sync_job_id': {'key': 'properties.sourceControlSyncJobId', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'sync_type': {'key': 'properties.syncType', 'type': 'str'},
}
def __init__(
self,
*,
source_control_sync_job_id: Optional[str] = None,
provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None,
sync_type: Optional[Union[str, "_models.SyncType"]] = None,
**kwargs
):
"""
:keyword source_control_sync_job_id: The source control sync job id.
:paramtype source_control_sync_job_id: str
:keyword provisioning_state: The provisioning state of the job. Known values are: "Completed",
"Failed", "Running".
:paramtype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState
:keyword sync_type: The sync type. Known values are: "PartialSync", "FullSync".
:paramtype sync_type: str or ~azure.mgmt.automation.models.SyncType
"""
super(SourceControlSyncJob, self).__init__(**kwargs)
self.name = None
self.type = None
self.id = None
self.source_control_sync_job_id = source_control_sync_job_id
self.creation_time = None
self.provisioning_state = provisioning_state
self.start_time = None
self.end_time = None
self.sync_type = sync_type
class SourceControlSyncJobById(msrest.serialization.Model):
"""Definition of the source control sync job.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The id of the job.
:vartype id: str
:ivar source_control_sync_job_id: The source control sync job id.
:vartype source_control_sync_job_id: str
:ivar creation_time: The creation time of the job.
:vartype creation_time: ~datetime.datetime
:ivar provisioning_state: The provisioning state of the job. Known values are: "Completed",
"Failed", "Running".
:vartype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState
:ivar start_time: The start time of the job.
:vartype start_time: ~datetime.datetime
:ivar end_time: The end time of the job.
:vartype end_time: ~datetime.datetime
:ivar sync_type: The sync type. Known values are: "PartialSync", "FullSync".
:vartype sync_type: str or ~azure.mgmt.automation.models.SyncType
:ivar exception: The exceptions that occurred while running the sync job.
:vartype exception: str
"""
_validation = {
'creation_time': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'source_control_sync_job_id': {'key': 'properties.sourceControlSyncJobId', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'},
'start_time': {'key': 'properties.startTime', 'type': 'iso-8601'},
'end_time': {'key': 'properties.endTime', 'type': 'iso-8601'},
'sync_type': {'key': 'properties.syncType', 'type': 'str'},
'exception': {'key': 'properties.exception', 'type': 'str'},
}
def __init__(
self,
*,
id: Optional[str] = None,
source_control_sync_job_id: Optional[str] = None,
provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = None,
sync_type: Optional[Union[str, "_models.SyncType"]] = None,
exception: Optional[str] = None,
**kwargs
):
"""
:keyword id: The id of the job.
:paramtype id: str
:keyword source_control_sync_job_id: The source control sync job id.
:paramtype source_control_sync_job_id: str
:keyword provisioning_state: The provisioning state of the job. Known values are: "Completed",
"Failed", "Running".
:paramtype provisioning_state: str or ~azure.mgmt.automation.models.ProvisioningState
:keyword sync_type: The sync type. Known values are: "PartialSync", "FullSync".
:paramtype sync_type: str or ~azure.mgmt.automation.models.SyncType
:keyword exception: The exceptions that occurred while running the sync job.
:paramtype exception: str
"""
super(SourceControlSyncJobById, self).__init__(**kwargs)
self.id = id
self.source_control_sync_job_id = source_control_sync_job_id
self.creation_time = None
self.provisioning_state = provisioning_state
self.start_time = None
self.end_time = None
self.sync_type = sync_type
self.exception = exception
class SourceControlSyncJobCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create source control sync job operation.
All required parameters must be populated in order to send to Azure.
:ivar commit_id: Required. The commit id of the source control sync job. If not syncing to a
commitId, enter an empty string.
:vartype commit_id: str
"""
_validation = {
'commit_id': {'required': True},
}
_attribute_map = {
'commit_id': {'key': 'properties.commitId', 'type': 'str'},
}
def __init__(
self,
*,
commit_id: str,
**kwargs
):
"""
:keyword commit_id: Required. The commit id of the source control sync job. If not syncing to a
commitId, enter an empty string.
:paramtype commit_id: str
"""
super(SourceControlSyncJobCreateParameters, self).__init__(**kwargs)
self.commit_id = commit_id
class SourceControlSyncJobListResult(msrest.serialization.Model):
"""The response model for the list source control sync jobs operation.
:ivar value: The list of source control sync jobs.
:vartype value: list[~azure.mgmt.automation.models.SourceControlSyncJob]
:ivar next_link: The next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[SourceControlSyncJob]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.SourceControlSyncJob"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: The list of source control sync jobs.
:paramtype value: list[~azure.mgmt.automation.models.SourceControlSyncJob]
:keyword next_link: The next link.
:paramtype next_link: str
"""
super(SourceControlSyncJobListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class SourceControlSyncJobStream(msrest.serialization.Model):
"""Definition of the source control sync job stream.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource id.
:vartype id: str
:ivar source_control_sync_job_stream_id: The sync job stream id.
:vartype source_control_sync_job_stream_id: str
:ivar summary: The summary of the sync job stream.
:vartype summary: str
:ivar time: The time of the sync job stream.
:vartype time: ~datetime.datetime
:ivar stream_type: The type of the sync job stream. Known values are: "Error", "Output".
:vartype stream_type: str or ~azure.mgmt.automation.models.StreamType
"""
_validation = {
'id': {'readonly': True},
'time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'source_control_sync_job_stream_id': {'key': 'properties.sourceControlSyncJobStreamId', 'type': 'str'},
'summary': {'key': 'properties.summary', 'type': 'str'},
'time': {'key': 'properties.time', 'type': 'iso-8601'},
'stream_type': {'key': 'properties.streamType', 'type': 'str'},
}
def __init__(
self,
*,
source_control_sync_job_stream_id: Optional[str] = None,
summary: Optional[str] = None,
stream_type: Optional[Union[str, "_models.StreamType"]] = None,
**kwargs
):
"""
:keyword source_control_sync_job_stream_id: The sync job stream id.
:paramtype source_control_sync_job_stream_id: str
:keyword summary: The summary of the sync job stream.
:paramtype summary: str
:keyword stream_type: The type of the sync job stream. Known values are: "Error", "Output".
:paramtype stream_type: str or ~azure.mgmt.automation.models.StreamType
"""
super(SourceControlSyncJobStream, self).__init__(**kwargs)
self.id = None
self.source_control_sync_job_stream_id = source_control_sync_job_stream_id
self.summary = summary
self.time = None
self.stream_type = stream_type
class SourceControlSyncJobStreamById(msrest.serialization.Model):
"""Definition of the source control sync job stream by id.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource id.
:vartype id: str
:ivar source_control_sync_job_stream_id: The sync job stream id.
:vartype source_control_sync_job_stream_id: str
:ivar summary: The summary of the sync job stream.
:vartype summary: str
:ivar time: The time of the sync job stream.
:vartype time: ~datetime.datetime
:ivar stream_type: The type of the sync job stream. Known values are: "Error", "Output".
:vartype stream_type: str or ~azure.mgmt.automation.models.StreamType
:ivar stream_text: The text of the sync job stream.
:vartype stream_text: str
:ivar value: The values of the job stream.
:vartype value: dict[str, any]
"""
_validation = {
'id': {'readonly': True},
'time': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'source_control_sync_job_stream_id': {'key': 'properties.sourceControlSyncJobStreamId', 'type': 'str'},
'summary': {'key': 'properties.summary', 'type': 'str'},
'time': {'key': 'properties.time', 'type': 'iso-8601'},
'stream_type': {'key': 'properties.streamType', 'type': 'str'},
'stream_text': {'key': 'properties.streamText', 'type': 'str'},
'value': {'key': 'properties.value', 'type': '{object}'},
}
def __init__(
self,
*,
source_control_sync_job_stream_id: Optional[str] = None,
summary: Optional[str] = None,
stream_type: Optional[Union[str, "_models.StreamType"]] = None,
stream_text: Optional[str] = None,
value: Optional[Dict[str, Any]] = None,
**kwargs
):
"""
:keyword source_control_sync_job_stream_id: The sync job stream id.
:paramtype source_control_sync_job_stream_id: str
:keyword summary: The summary of the sync job stream.
:paramtype summary: str
:keyword stream_type: The type of the sync job stream. Known values are: "Error", "Output".
:paramtype stream_type: str or ~azure.mgmt.automation.models.StreamType
:keyword stream_text: The text of the sync job stream.
:paramtype stream_text: str
:keyword value: The values of the job stream.
:paramtype value: dict[str, any]
"""
super(SourceControlSyncJobStreamById, self).__init__(**kwargs)
self.id = None
self.source_control_sync_job_stream_id = source_control_sync_job_stream_id
self.summary = summary
self.time = None
self.stream_type = stream_type
self.stream_text = stream_text
self.value = value
class SourceControlSyncJobStreamsListBySyncJob(msrest.serialization.Model):
"""The response model for the list source control sync job streams operation.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The list of source control sync job streams.
:vartype value: list[~azure.mgmt.automation.models.SourceControlSyncJobStream]
:ivar next_link: The next link.
:vartype next_link: str
"""
_validation = {
'next_link': {'readonly': True},
}
_attribute_map = {
'value': {'key': 'value', 'type': '[SourceControlSyncJobStream]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.SourceControlSyncJobStream"]] = None,
**kwargs
):
"""
:keyword value: The list of source control sync job streams.
:paramtype value: list[~azure.mgmt.automation.models.SourceControlSyncJobStream]
"""
super(SourceControlSyncJobStreamsListBySyncJob, self).__init__(**kwargs)
self.value = value
self.next_link = None
class SourceControlUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update source control operation.
:ivar branch: The repo branch of the source control.
:vartype branch: str
:ivar folder_path: The folder path of the source control. Path must be relative.
:vartype folder_path: str
:ivar auto_sync: The auto sync of the source control. Default is false.
:vartype auto_sync: bool
:ivar publish_runbook: The auto publish of the source control. Default is true.
:vartype publish_runbook: bool
:ivar security_token: The authorization token for the repo of the source control.
:vartype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties
:ivar description: The user description of the source control.
:vartype description: str
"""
_attribute_map = {
'branch': {'key': 'properties.branch', 'type': 'str'},
'folder_path': {'key': 'properties.folderPath', 'type': 'str'},
'auto_sync': {'key': 'properties.autoSync', 'type': 'bool'},
'publish_runbook': {'key': 'properties.publishRunbook', 'type': 'bool'},
'security_token': {'key': 'properties.securityToken', 'type': 'SourceControlSecurityTokenProperties'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
branch: Optional[str] = None,
folder_path: Optional[str] = None,
auto_sync: Optional[bool] = None,
publish_runbook: Optional[bool] = None,
security_token: Optional["_models.SourceControlSecurityTokenProperties"] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword branch: The repo branch of the source control.
:paramtype branch: str
:keyword folder_path: The folder path of the source control. Path must be relative.
:paramtype folder_path: str
:keyword auto_sync: The auto sync of the source control. Default is false.
:paramtype auto_sync: bool
:keyword publish_runbook: The auto publish of the source control. Default is true.
:paramtype publish_runbook: bool
:keyword security_token: The authorization token for the repo of the source control.
:paramtype security_token: ~azure.mgmt.automation.models.SourceControlSecurityTokenProperties
:keyword description: The user description of the source control.
:paramtype description: str
"""
super(SourceControlUpdateParameters, self).__init__(**kwargs)
self.branch = branch
self.folder_path = folder_path
self.auto_sync = auto_sync
self.publish_runbook = publish_runbook
self.security_token = security_token
self.description = description
class Statistics(msrest.serialization.Model):
"""Definition of the statistic.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar counter_property: Gets the property value of the statistic.
:vartype counter_property: str
:ivar counter_value: Gets the value of the statistic.
:vartype counter_value: long
:ivar start_time: Gets the startTime of the statistic.
:vartype start_time: ~datetime.datetime
:ivar end_time: Gets the endTime of the statistic.
:vartype end_time: ~datetime.datetime
:ivar id: Gets the id.
:vartype id: str
"""
_validation = {
'counter_property': {'readonly': True},
'counter_value': {'readonly': True},
'start_time': {'readonly': True},
'end_time': {'readonly': True},
'id': {'readonly': True},
}
_attribute_map = {
'counter_property': {'key': 'counterProperty', 'type': 'str'},
'counter_value': {'key': 'counterValue', 'type': 'long'},
'start_time': {'key': 'startTime', 'type': 'iso-8601'},
'end_time': {'key': 'endTime', 'type': 'iso-8601'},
'id': {'key': 'id', 'type': 'str'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(Statistics, self).__init__(**kwargs)
self.counter_property = None
self.counter_value = None
self.start_time = None
self.end_time = None
self.id = None
class StatisticsListResult(msrest.serialization.Model):
"""The response model for the list statistics operation.
:ivar value: Gets or sets a list of statistics.
:vartype value: list[~azure.mgmt.automation.models.Statistics]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Statistics]'},
}
def __init__(
self,
*,
value: Optional[List["_models.Statistics"]] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of statistics.
:paramtype value: list[~azure.mgmt.automation.models.Statistics]
"""
super(StatisticsListResult, self).__init__(**kwargs)
self.value = value
class SUCScheduleProperties(msrest.serialization.Model):
"""Definition of schedule parameters.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar start_time: Gets or sets the start time of the schedule.
:vartype start_time: ~datetime.datetime
:ivar start_time_offset_minutes: Gets the start time's offset in minutes.
:vartype start_time_offset_minutes: float
:ivar expiry_time: Gets or sets the end time of the schedule.
:vartype expiry_time: ~datetime.datetime
:ivar expiry_time_offset_minutes: Gets or sets the expiry time's offset in minutes.
:vartype expiry_time_offset_minutes: float
:ivar is_enabled: Gets or sets a value indicating whether this schedule is enabled.
:vartype is_enabled: bool
:ivar next_run: Gets or sets the next run time of the schedule.
:vartype next_run: ~datetime.datetime
:ivar next_run_offset_minutes: Gets or sets the next run time's offset in minutes.
:vartype next_run_offset_minutes: float
:ivar interval: Gets or sets the interval of the schedule.
:vartype interval: long
:ivar frequency: Gets or sets the frequency of the schedule. Known values are: "OneTime",
"Day", "Hour", "Week", "Month", "Minute".
:vartype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:ivar time_zone: Gets or sets the time zone of the schedule.
:vartype time_zone: str
:ivar advanced_schedule: Gets or sets the advanced schedule.
:vartype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'start_time_offset_minutes': {'readonly': True},
}
_attribute_map = {
'start_time': {'key': 'startTime', 'type': 'iso-8601'},
'start_time_offset_minutes': {'key': 'startTimeOffsetMinutes', 'type': 'float'},
'expiry_time': {'key': 'expiryTime', 'type': 'iso-8601'},
'expiry_time_offset_minutes': {'key': 'expiryTimeOffsetMinutes', 'type': 'float'},
'is_enabled': {'key': 'isEnabled', 'type': 'bool'},
'next_run': {'key': 'nextRun', 'type': 'iso-8601'},
'next_run_offset_minutes': {'key': 'nextRunOffsetMinutes', 'type': 'float'},
'interval': {'key': 'interval', 'type': 'long'},
'frequency': {'key': 'frequency', 'type': 'str'},
'time_zone': {'key': 'timeZone', 'type': 'str'},
'advanced_schedule': {'key': 'advancedSchedule', 'type': 'AdvancedSchedule'},
'creation_time': {'key': 'creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'description', 'type': 'str'},
}
def __init__(
self,
*,
start_time: Optional[datetime.datetime] = None,
expiry_time: Optional[datetime.datetime] = None,
expiry_time_offset_minutes: Optional[float] = None,
is_enabled: Optional[bool] = False,
next_run: Optional[datetime.datetime] = None,
next_run_offset_minutes: Optional[float] = None,
interval: Optional[int] = None,
frequency: Optional[Union[str, "_models.ScheduleFrequency"]] = None,
time_zone: Optional[str] = None,
advanced_schedule: Optional["_models.AdvancedSchedule"] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword start_time: Gets or sets the start time of the schedule.
:paramtype start_time: ~datetime.datetime
:keyword expiry_time: Gets or sets the end time of the schedule.
:paramtype expiry_time: ~datetime.datetime
:keyword expiry_time_offset_minutes: Gets or sets the expiry time's offset in minutes.
:paramtype expiry_time_offset_minutes: float
:keyword is_enabled: Gets or sets a value indicating whether this schedule is enabled.
:paramtype is_enabled: bool
:keyword next_run: Gets or sets the next run time of the schedule.
:paramtype next_run: ~datetime.datetime
:keyword next_run_offset_minutes: Gets or sets the next run time's offset in minutes.
:paramtype next_run_offset_minutes: float
:keyword interval: Gets or sets the interval of the schedule.
:paramtype interval: long
:keyword frequency: Gets or sets the frequency of the schedule. Known values are: "OneTime",
"Day", "Hour", "Week", "Month", "Minute".
:paramtype frequency: str or ~azure.mgmt.automation.models.ScheduleFrequency
:keyword time_zone: Gets or sets the time zone of the schedule.
:paramtype time_zone: str
:keyword advanced_schedule: Gets or sets the advanced schedule.
:paramtype advanced_schedule: ~azure.mgmt.automation.models.AdvancedSchedule
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(SUCScheduleProperties, self).__init__(**kwargs)
self.start_time = start_time
self.start_time_offset_minutes = None
self.expiry_time = expiry_time
self.expiry_time_offset_minutes = expiry_time_offset_minutes
self.is_enabled = is_enabled
self.next_run = next_run
self.next_run_offset_minutes = next_run_offset_minutes
self.interval = interval
self.frequency = frequency
self.time_zone = time_zone
self.advanced_schedule = advanced_schedule
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.description = description
class SystemData(msrest.serialization.Model):
"""Metadata pertaining to creation and last modification of the resource.
:ivar created_by: The identity that created the resource.
:vartype created_by: str
:ivar created_by_type: The type of identity that created the resource. Known values are:
"User", "Application", "ManagedIdentity", "Key".
:vartype created_by_type: str or ~azure.mgmt.automation.models.CreatedByType
:ivar created_at: The timestamp of resource creation (UTC).
:vartype created_at: ~datetime.datetime
:ivar last_modified_by: The identity that last modified the resource.
:vartype last_modified_by: str
:ivar last_modified_by_type: The type of identity that last modified the resource. Known values
are: "User", "Application", "ManagedIdentity", "Key".
:vartype last_modified_by_type: str or ~azure.mgmt.automation.models.CreatedByType
:ivar last_modified_at: The timestamp of resource last modification (UTC).
:vartype last_modified_at: ~datetime.datetime
"""
_attribute_map = {
'created_by': {'key': 'createdBy', 'type': 'str'},
'created_by_type': {'key': 'createdByType', 'type': 'str'},
'created_at': {'key': 'createdAt', 'type': 'iso-8601'},
'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'},
'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'},
'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'},
}
def __init__(
self,
*,
created_by: Optional[str] = None,
created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
created_at: Optional[datetime.datetime] = None,
last_modified_by: Optional[str] = None,
last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None,
last_modified_at: Optional[datetime.datetime] = None,
**kwargs
):
"""
:keyword created_by: The identity that created the resource.
:paramtype created_by: str
:keyword created_by_type: The type of identity that created the resource. Known values are:
"User", "Application", "ManagedIdentity", "Key".
:paramtype created_by_type: str or ~azure.mgmt.automation.models.CreatedByType
:keyword created_at: The timestamp of resource creation (UTC).
:paramtype created_at: ~datetime.datetime
:keyword last_modified_by: The identity that last modified the resource.
:paramtype last_modified_by: str
:keyword last_modified_by_type: The type of identity that last modified the resource. Known
values are: "User", "Application", "ManagedIdentity", "Key".
:paramtype last_modified_by_type: str or ~azure.mgmt.automation.models.CreatedByType
:keyword last_modified_at: The timestamp of resource last modification (UTC).
:paramtype last_modified_at: ~datetime.datetime
"""
super(SystemData, self).__init__(**kwargs)
self.created_by = created_by
self.created_by_type = created_by_type
self.created_at = created_at
self.last_modified_by = last_modified_by
self.last_modified_by_type = last_modified_by_type
self.last_modified_at = last_modified_at
class TagSettingsProperties(msrest.serialization.Model):
"""Tag filter information for the VM.
:ivar tags: A set of tags. Dictionary of tags with its list of values.
:vartype tags: dict[str, list[str]]
:ivar filter_operator: Filter VMs by Any or All specified tags. Known values are: "All", "Any".
:vartype filter_operator: str or ~azure.mgmt.automation.models.TagOperators
"""
_attribute_map = {
'tags': {'key': 'tags', 'type': '{[str]}'},
'filter_operator': {'key': 'filterOperator', 'type': 'str'},
}
def __init__(
self,
*,
tags: Optional[Dict[str, List[str]]] = None,
filter_operator: Optional[Union[str, "_models.TagOperators"]] = None,
**kwargs
):
"""
:keyword tags: A set of tags. Dictionary of tags with its list of values.
:paramtype tags: dict[str, list[str]]
:keyword filter_operator: Filter VMs by Any or All specified tags. Known values are: "All",
"Any".
:paramtype filter_operator: str or ~azure.mgmt.automation.models.TagOperators
"""
super(TagSettingsProperties, self).__init__(**kwargs)
self.tags = tags
self.filter_operator = filter_operator
class TargetProperties(msrest.serialization.Model):
"""Group specific to the update configuration.
:ivar azure_queries: List of Azure queries in the software update configuration.
:vartype azure_queries: list[~azure.mgmt.automation.models.AzureQueryProperties]
:ivar non_azure_queries: List of non Azure queries in the software update configuration.
:vartype non_azure_queries: list[~azure.mgmt.automation.models.NonAzureQueryProperties]
"""
_attribute_map = {
'azure_queries': {'key': 'azureQueries', 'type': '[AzureQueryProperties]'},
'non_azure_queries': {'key': 'nonAzureQueries', 'type': '[NonAzureQueryProperties]'},
}
def __init__(
self,
*,
azure_queries: Optional[List["_models.AzureQueryProperties"]] = None,
non_azure_queries: Optional[List["_models.NonAzureQueryProperties"]] = None,
**kwargs
):
"""
:keyword azure_queries: List of Azure queries in the software update configuration.
:paramtype azure_queries: list[~azure.mgmt.automation.models.AzureQueryProperties]
:keyword non_azure_queries: List of non Azure queries in the software update configuration.
:paramtype non_azure_queries: list[~azure.mgmt.automation.models.NonAzureQueryProperties]
"""
super(TargetProperties, self).__init__(**kwargs)
self.azure_queries = azure_queries
self.non_azure_queries = non_azure_queries
class TaskProperties(msrest.serialization.Model):
"""Task properties of the software update configuration.
:ivar parameters: Gets or sets the parameters of the task.
:vartype parameters: dict[str, str]
:ivar source: Gets or sets the name of the runbook.
:vartype source: str
"""
_attribute_map = {
'parameters': {'key': 'parameters', 'type': '{str}'},
'source': {'key': 'source', 'type': 'str'},
}
def __init__(
self,
*,
parameters: Optional[Dict[str, str]] = None,
source: Optional[str] = None,
**kwargs
):
"""
:keyword parameters: Gets or sets the parameters of the task.
:paramtype parameters: dict[str, str]
:keyword source: Gets or sets the name of the runbook.
:paramtype source: str
"""
super(TaskProperties, self).__init__(**kwargs)
self.parameters = parameters
self.source = source
class TestJob(msrest.serialization.Model):
"""Definition of the test job.
:ivar creation_time: Gets or sets the creation time of the test job.
:vartype creation_time: ~datetime.datetime
:ivar status: Gets or sets the status of the test job.
:vartype status: str
:ivar status_details: Gets or sets the status details of the test job.
:vartype status_details: str
:ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:vartype run_on: str
:ivar start_time: Gets or sets the start time of the test job.
:vartype start_time: ~datetime.datetime
:ivar end_time: Gets or sets the end time of the test job.
:vartype end_time: ~datetime.datetime
:ivar exception: Gets or sets the exception of the test job.
:vartype exception: str
:ivar last_modified_time: Gets or sets the last modified time of the test job.
:vartype last_modified_time: ~datetime.datetime
:ivar last_status_modified_time: Gets or sets the last status modified time of the test job.
:vartype last_status_modified_time: ~datetime.datetime
:ivar parameters: Gets or sets the parameters of the test job.
:vartype parameters: dict[str, str]
:ivar log_activity_trace: The activity-level tracing options of the runbook.
:vartype log_activity_trace: int
"""
_attribute_map = {
'creation_time': {'key': 'creationTime', 'type': 'iso-8601'},
'status': {'key': 'status', 'type': 'str'},
'status_details': {'key': 'statusDetails', 'type': 'str'},
'run_on': {'key': 'runOn', 'type': 'str'},
'start_time': {'key': 'startTime', 'type': 'iso-8601'},
'end_time': {'key': 'endTime', 'type': 'iso-8601'},
'exception': {'key': 'exception', 'type': 'str'},
'last_modified_time': {'key': 'lastModifiedTime', 'type': 'iso-8601'},
'last_status_modified_time': {'key': 'lastStatusModifiedTime', 'type': 'iso-8601'},
'parameters': {'key': 'parameters', 'type': '{str}'},
'log_activity_trace': {'key': 'logActivityTrace', 'type': 'int'},
}
def __init__(
self,
*,
creation_time: Optional[datetime.datetime] = None,
status: Optional[str] = None,
status_details: Optional[str] = None,
run_on: Optional[str] = None,
start_time: Optional[datetime.datetime] = None,
end_time: Optional[datetime.datetime] = None,
exception: Optional[str] = None,
last_modified_time: Optional[datetime.datetime] = None,
last_status_modified_time: Optional[datetime.datetime] = None,
parameters: Optional[Dict[str, str]] = None,
log_activity_trace: Optional[int] = None,
**kwargs
):
"""
:keyword creation_time: Gets or sets the creation time of the test job.
:paramtype creation_time: ~datetime.datetime
:keyword status: Gets or sets the status of the test job.
:paramtype status: str
:keyword status_details: Gets or sets the status details of the test job.
:paramtype status_details: str
:keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:paramtype run_on: str
:keyword start_time: Gets or sets the start time of the test job.
:paramtype start_time: ~datetime.datetime
:keyword end_time: Gets or sets the end time of the test job.
:paramtype end_time: ~datetime.datetime
:keyword exception: Gets or sets the exception of the test job.
:paramtype exception: str
:keyword last_modified_time: Gets or sets the last modified time of the test job.
:paramtype last_modified_time: ~datetime.datetime
:keyword last_status_modified_time: Gets or sets the last status modified time of the test job.
:paramtype last_status_modified_time: ~datetime.datetime
:keyword parameters: Gets or sets the parameters of the test job.
:paramtype parameters: dict[str, str]
:keyword log_activity_trace: The activity-level tracing options of the runbook.
:paramtype log_activity_trace: int
"""
super(TestJob, self).__init__(**kwargs)
self.creation_time = creation_time
self.status = status
self.status_details = status_details
self.run_on = run_on
self.start_time = start_time
self.end_time = end_time
self.exception = exception
self.last_modified_time = last_modified_time
self.last_status_modified_time = last_status_modified_time
self.parameters = parameters
self.log_activity_trace = log_activity_trace
class TestJobCreateParameters(msrest.serialization.Model):
"""The parameters supplied to the create test job operation.
:ivar parameters: Gets or sets the parameters of the test job.
:vartype parameters: dict[str, str]
:ivar run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:vartype run_on: str
"""
_attribute_map = {
'parameters': {'key': 'parameters', 'type': '{str}'},
'run_on': {'key': 'runOn', 'type': 'str'},
}
def __init__(
self,
*,
parameters: Optional[Dict[str, str]] = None,
run_on: Optional[str] = None,
**kwargs
):
"""
:keyword parameters: Gets or sets the parameters of the test job.
:paramtype parameters: dict[str, str]
:keyword run_on: Gets or sets the runOn which specifies the group name where the job is to be
executed.
:paramtype run_on: str
"""
super(TestJobCreateParameters, self).__init__(**kwargs)
self.parameters = parameters
self.run_on = run_on
class TypeField(msrest.serialization.Model):
"""Information about a field of a type.
:ivar name: Gets or sets the name of the field.
:vartype name: str
:ivar type: Gets or sets the type of the field.
:vartype type: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
type: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the field.
:paramtype name: str
:keyword type: Gets or sets the type of the field.
:paramtype type: str
"""
super(TypeField, self).__init__(**kwargs)
self.name = name
self.type = type
class TypeFieldListResult(msrest.serialization.Model):
"""The response model for the list fields operation.
:ivar value: Gets or sets a list of fields.
:vartype value: list[~azure.mgmt.automation.models.TypeField]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[TypeField]'},
}
def __init__(
self,
*,
value: Optional[List["_models.TypeField"]] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of fields.
:paramtype value: list[~azure.mgmt.automation.models.TypeField]
"""
super(TypeFieldListResult, self).__init__(**kwargs)
self.value = value
class UpdateConfiguration(msrest.serialization.Model):
"""Update specific properties of the software update configuration.
All required parameters must be populated in order to send to Azure.
:ivar operating_system: Required. operating system of target machines. Known values are:
"Windows", "Linux".
:vartype operating_system: str or ~azure.mgmt.automation.models.OperatingSystemType
:ivar windows: Windows specific update configuration.
:vartype windows: ~azure.mgmt.automation.models.WindowsProperties
:ivar linux: Linux specific update configuration.
:vartype linux: ~azure.mgmt.automation.models.LinuxProperties
:ivar duration: Maximum time allowed for the software update configuration run. Duration needs
to be specified using the format PT[n]H[n]M[n]S as per ISO8601.
:vartype duration: ~datetime.timedelta
:ivar azure_virtual_machines: List of azure resource Ids for azure virtual machines targeted by
the software update configuration.
:vartype azure_virtual_machines: list[str]
:ivar non_azure_computer_names: List of names of non-azure machines targeted by the software
update configuration.
:vartype non_azure_computer_names: list[str]
:ivar targets: Group targets for the software update configuration.
:vartype targets: ~azure.mgmt.automation.models.TargetProperties
"""
_validation = {
'operating_system': {'required': True},
}
_attribute_map = {
'operating_system': {'key': 'operatingSystem', 'type': 'str'},
'windows': {'key': 'windows', 'type': 'WindowsProperties'},
'linux': {'key': 'linux', 'type': 'LinuxProperties'},
'duration': {'key': 'duration', 'type': 'duration'},
'azure_virtual_machines': {'key': 'azureVirtualMachines', 'type': '[str]'},
'non_azure_computer_names': {'key': 'nonAzureComputerNames', 'type': '[str]'},
'targets': {'key': 'targets', 'type': 'TargetProperties'},
}
def __init__(
self,
*,
operating_system: Union[str, "_models.OperatingSystemType"],
windows: Optional["_models.WindowsProperties"] = None,
linux: Optional["_models.LinuxProperties"] = None,
duration: Optional[datetime.timedelta] = None,
azure_virtual_machines: Optional[List[str]] = None,
non_azure_computer_names: Optional[List[str]] = None,
targets: Optional["_models.TargetProperties"] = None,
**kwargs
):
"""
:keyword operating_system: Required. operating system of target machines. Known values are:
"Windows", "Linux".
:paramtype operating_system: str or ~azure.mgmt.automation.models.OperatingSystemType
:keyword windows: Windows specific update configuration.
:paramtype windows: ~azure.mgmt.automation.models.WindowsProperties
:keyword linux: Linux specific update configuration.
:paramtype linux: ~azure.mgmt.automation.models.LinuxProperties
:keyword duration: Maximum time allowed for the software update configuration run. Duration
needs to be specified using the format PT[n]H[n]M[n]S as per ISO8601.
:paramtype duration: ~datetime.timedelta
:keyword azure_virtual_machines: List of azure resource Ids for azure virtual machines targeted
by the software update configuration.
:paramtype azure_virtual_machines: list[str]
:keyword non_azure_computer_names: List of names of non-azure machines targeted by the software
update configuration.
:paramtype non_azure_computer_names: list[str]
:keyword targets: Group targets for the software update configuration.
:paramtype targets: ~azure.mgmt.automation.models.TargetProperties
"""
super(UpdateConfiguration, self).__init__(**kwargs)
self.operating_system = operating_system
self.windows = windows
self.linux = linux
self.duration = duration
self.azure_virtual_machines = azure_virtual_machines
self.non_azure_computer_names = non_azure_computer_names
self.targets = targets
class UpdateConfigurationNavigation(msrest.serialization.Model):
"""Software update configuration Run Navigation model.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: Name of the software update configuration triggered the software update
configuration run.
:vartype name: str
"""
_validation = {
'name': {'readonly': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
}
def __init__(
self,
**kwargs
):
"""
"""
super(UpdateConfigurationNavigation, self).__init__(**kwargs)
self.name = None
class Usage(msrest.serialization.Model):
"""Definition of Usage.
:ivar id: Gets or sets the id of the resource.
:vartype id: str
:ivar name: Gets or sets the usage counter name.
:vartype name: ~azure.mgmt.automation.models.UsageCounterName
:ivar unit: Gets or sets the usage unit name.
:vartype unit: str
:ivar current_value: Gets or sets the current usage value.
:vartype current_value: float
:ivar limit: Gets or sets max limit. -1 for unlimited.
:vartype limit: long
:ivar throttle_status: Gets or sets the throttle status.
:vartype throttle_status: str
"""
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'UsageCounterName'},
'unit': {'key': 'unit', 'type': 'str'},
'current_value': {'key': 'currentValue', 'type': 'float'},
'limit': {'key': 'limit', 'type': 'long'},
'throttle_status': {'key': 'throttleStatus', 'type': 'str'},
}
def __init__(
self,
*,
id: Optional[str] = None,
name: Optional["_models.UsageCounterName"] = None,
unit: Optional[str] = None,
current_value: Optional[float] = None,
limit: Optional[int] = None,
throttle_status: Optional[str] = None,
**kwargs
):
"""
:keyword id: Gets or sets the id of the resource.
:paramtype id: str
:keyword name: Gets or sets the usage counter name.
:paramtype name: ~azure.mgmt.automation.models.UsageCounterName
:keyword unit: Gets or sets the usage unit name.
:paramtype unit: str
:keyword current_value: Gets or sets the current usage value.
:paramtype current_value: float
:keyword limit: Gets or sets max limit. -1 for unlimited.
:paramtype limit: long
:keyword throttle_status: Gets or sets the throttle status.
:paramtype throttle_status: str
"""
super(Usage, self).__init__(**kwargs)
self.id = id
self.name = name
self.unit = unit
self.current_value = current_value
self.limit = limit
self.throttle_status = throttle_status
class UsageCounterName(msrest.serialization.Model):
"""Definition of usage counter name.
:ivar value: Gets or sets the usage counter name.
:vartype value: str
:ivar localized_value: Gets or sets the localized usage counter name.
:vartype localized_value: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': 'str'},
'localized_value': {'key': 'localizedValue', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[str] = None,
localized_value: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets the usage counter name.
:paramtype value: str
:keyword localized_value: Gets or sets the localized usage counter name.
:paramtype localized_value: str
"""
super(UsageCounterName, self).__init__(**kwargs)
self.value = value
self.localized_value = localized_value
class UsageListResult(msrest.serialization.Model):
"""The response model for the get usage operation.
:ivar value: Gets or sets usage.
:vartype value: list[~azure.mgmt.automation.models.Usage]
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Usage]'},
}
def __init__(
self,
*,
value: Optional[List["_models.Usage"]] = None,
**kwargs
):
"""
:keyword value: Gets or sets usage.
:paramtype value: list[~azure.mgmt.automation.models.Usage]
"""
super(UsageListResult, self).__init__(**kwargs)
self.value = value
class Variable(ProxyResource):
"""Definition of the variable.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar value: Gets or sets the value of the variable.
:vartype value: str
:ivar is_encrypted: Gets or sets the encrypted flag of the variable.
:vartype is_encrypted: bool
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar description: Gets or sets the description.
:vartype description: 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'},
'value': {'key': 'properties.value', 'type': 'str'},
'is_encrypted': {'key': 'properties.isEncrypted', 'type': 'bool'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[str] = None,
is_encrypted: Optional[bool] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets the value of the variable.
:paramtype value: str
:keyword is_encrypted: Gets or sets the encrypted flag of the variable.
:paramtype is_encrypted: bool
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Variable, self).__init__(**kwargs)
self.value = value
self.is_encrypted = is_encrypted
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.description = description
class VariableCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update variable operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the variable.
:vartype name: str
:ivar value: Gets or sets the value of the variable.
:vartype value: str
:ivar description: Gets or sets the description of the variable.
:vartype description: str
:ivar is_encrypted: Gets or sets the encrypted flag of the variable.
:vartype is_encrypted: bool
"""
_validation = {
'name': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'value': {'key': 'properties.value', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
'is_encrypted': {'key': 'properties.isEncrypted', 'type': 'bool'},
}
def __init__(
self,
*,
name: str,
value: Optional[str] = None,
description: Optional[str] = None,
is_encrypted: Optional[bool] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the variable.
:paramtype name: str
:keyword value: Gets or sets the value of the variable.
:paramtype value: str
:keyword description: Gets or sets the description of the variable.
:paramtype description: str
:keyword is_encrypted: Gets or sets the encrypted flag of the variable.
:paramtype is_encrypted: bool
"""
super(VariableCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.value = value
self.description = description
self.is_encrypted = is_encrypted
class VariableListResult(msrest.serialization.Model):
"""The response model for the list variables operation.
:ivar value: Gets or sets a list of variables.
:vartype value: list[~azure.mgmt.automation.models.Variable]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Variable]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Variable"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of variables.
:paramtype value: list[~azure.mgmt.automation.models.Variable]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(VariableListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class VariableUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update variable operation.
:ivar name: Gets or sets the name of the variable.
:vartype name: str
:ivar value: Gets or sets the value of the variable.
:vartype value: str
:ivar description: Gets or sets the description of the variable.
:vartype description: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'value': {'key': 'properties.value', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
value: Optional[str] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the variable.
:paramtype name: str
:keyword value: Gets or sets the value of the variable.
:paramtype value: str
:keyword description: Gets or sets the description of the variable.
:paramtype description: str
"""
super(VariableUpdateParameters, self).__init__(**kwargs)
self.name = name
self.value = value
self.description = description
class Watcher(Resource):
"""Definition of the watcher type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar etag: Gets or sets the etag of the resource.
:vartype etag: str
:ivar tags: A set of tags. Resource tags.
:vartype tags: dict[str, str]
:ivar location: The geo-location where the resource lives.
:vartype location: str
:ivar execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is
invoked.
:vartype execution_frequency_in_seconds: long
:ivar script_name: Gets or sets the name of the script the watcher is attached to, i.e. the
name of an existing runbook.
:vartype script_name: str
:ivar script_parameters: Gets or sets the parameters of the script.
:vartype script_parameters: dict[str, str]
:ivar script_run_on: Gets or sets the name of the hybrid worker group the watcher will run on.
:vartype script_run_on: str
:ivar status: Gets the current status of the watcher.
:vartype status: str
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar last_modified_by: Details of the user who last modified the watcher.
:vartype last_modified_by: str
:ivar description: Gets or sets the description.
:vartype description: str
"""
_validation = {
'id': {'readonly': True},
'name': {'readonly': True},
'type': {'readonly': True},
'status': {'readonly': True},
'creation_time': {'readonly': True},
'last_modified_time': {'readonly': True},
'last_modified_by': {'readonly': True},
}
_attribute_map = {
'id': {'key': 'id', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
'type': {'key': 'type', 'type': 'str'},
'etag': {'key': 'etag', 'type': 'str'},
'tags': {'key': 'tags', 'type': '{str}'},
'location': {'key': 'location', 'type': 'str'},
'execution_frequency_in_seconds': {'key': 'properties.executionFrequencyInSeconds', 'type': 'long'},
'script_name': {'key': 'properties.scriptName', 'type': 'str'},
'script_parameters': {'key': 'properties.scriptParameters', 'type': '{str}'},
'script_run_on': {'key': 'properties.scriptRunOn', 'type': 'str'},
'status': {'key': 'properties.status', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
etag: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
location: Optional[str] = None,
execution_frequency_in_seconds: Optional[int] = None,
script_name: Optional[str] = None,
script_parameters: Optional[Dict[str, str]] = None,
script_run_on: Optional[str] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword etag: Gets or sets the etag of the resource.
:paramtype etag: str
:keyword tags: A set of tags. Resource tags.
:paramtype tags: dict[str, str]
:keyword location: The geo-location where the resource lives.
:paramtype location: str
:keyword execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is
invoked.
:paramtype execution_frequency_in_seconds: long
:keyword script_name: Gets or sets the name of the script the watcher is attached to, i.e. the
name of an existing runbook.
:paramtype script_name: str
:keyword script_parameters: Gets or sets the parameters of the script.
:paramtype script_parameters: dict[str, str]
:keyword script_run_on: Gets or sets the name of the hybrid worker group the watcher will run
on.
:paramtype script_run_on: str
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Watcher, self).__init__(**kwargs)
self.etag = etag
self.tags = tags
self.location = location
self.execution_frequency_in_seconds = execution_frequency_in_seconds
self.script_name = script_name
self.script_parameters = script_parameters
self.script_run_on = script_run_on
self.status = None
self.creation_time = None
self.last_modified_time = None
self.last_modified_by = None
self.description = description
class WatcherListResult(msrest.serialization.Model):
"""The response model for the list watcher operation.
:ivar value: Gets or sets a list of watchers.
:vartype value: list[~azure.mgmt.automation.models.Watcher]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Watcher]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Watcher"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of watchers.
:paramtype value: list[~azure.mgmt.automation.models.Watcher]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(WatcherListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class WatcherUpdateParameters(msrest.serialization.Model):
"""WatcherUpdateParameters.
:ivar name: Gets or sets the name of the resource.
:vartype name: str
:ivar execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is
invoked.
:vartype execution_frequency_in_seconds: long
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'execution_frequency_in_seconds': {'key': 'properties.executionFrequencyInSeconds', 'type': 'long'},
}
def __init__(
self,
*,
name: Optional[str] = None,
execution_frequency_in_seconds: Optional[int] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the resource.
:paramtype name: str
:keyword execution_frequency_in_seconds: Gets or sets the frequency at which the watcher is
invoked.
:paramtype execution_frequency_in_seconds: long
"""
super(WatcherUpdateParameters, self).__init__(**kwargs)
self.name = name
self.execution_frequency_in_seconds = execution_frequency_in_seconds
class Webhook(ProxyResource):
"""Definition of the webhook type.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Fully qualified resource Id for the resource.
:vartype id: str
:ivar name: The name of the resource.
:vartype name: str
:ivar type: The type of the resource.
:vartype type: str
:ivar is_enabled: Gets or sets the value of the enabled flag of the webhook.
:vartype is_enabled: bool
:ivar uri: Gets or sets the webhook uri.
:vartype uri: str
:ivar expiry_time: Gets or sets the expiry time.
:vartype expiry_time: ~datetime.datetime
:ivar last_invoked_time: Gets or sets the last invoked time.
:vartype last_invoked_time: ~datetime.datetime
:ivar parameters: Gets or sets the parameters of the job that is created when the webhook calls
the runbook it is associated with.
:vartype parameters: dict[str, str]
:ivar runbook: Gets or sets the runbook the webhook is associated with.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar run_on: Gets or sets the name of the hybrid worker group the webhook job will run on.
:vartype run_on: str
:ivar creation_time: Gets or sets the creation time.
:vartype creation_time: ~datetime.datetime
:ivar last_modified_time: Gets or sets the last modified time.
:vartype last_modified_time: ~datetime.datetime
:ivar last_modified_by: Details of the user who last modified the Webhook.
:vartype last_modified_by: str
:ivar description: Gets or sets the description.
:vartype description: 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'},
'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'},
'uri': {'key': 'properties.uri', 'type': 'str'},
'expiry_time': {'key': 'properties.expiryTime', 'type': 'iso-8601'},
'last_invoked_time': {'key': 'properties.lastInvokedTime', 'type': 'iso-8601'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
'creation_time': {'key': 'properties.creationTime', 'type': 'iso-8601'},
'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'},
'last_modified_by': {'key': 'properties.lastModifiedBy', 'type': 'str'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
is_enabled: Optional[bool] = False,
uri: Optional[str] = None,
expiry_time: Optional[datetime.datetime] = None,
last_invoked_time: Optional[datetime.datetime] = None,
parameters: Optional[Dict[str, str]] = None,
runbook: Optional["_models.RunbookAssociationProperty"] = None,
run_on: Optional[str] = None,
creation_time: Optional[datetime.datetime] = None,
last_modified_time: Optional[datetime.datetime] = None,
last_modified_by: Optional[str] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword is_enabled: Gets or sets the value of the enabled flag of the webhook.
:paramtype is_enabled: bool
:keyword uri: Gets or sets the webhook uri.
:paramtype uri: str
:keyword expiry_time: Gets or sets the expiry time.
:paramtype expiry_time: ~datetime.datetime
:keyword last_invoked_time: Gets or sets the last invoked time.
:paramtype last_invoked_time: ~datetime.datetime
:keyword parameters: Gets or sets the parameters of the job that is created when the webhook
calls the runbook it is associated with.
:paramtype parameters: dict[str, str]
:keyword runbook: Gets or sets the runbook the webhook is associated with.
:paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:keyword run_on: Gets or sets the name of the hybrid worker group the webhook job will run on.
:paramtype run_on: str
:keyword creation_time: Gets or sets the creation time.
:paramtype creation_time: ~datetime.datetime
:keyword last_modified_time: Gets or sets the last modified time.
:paramtype last_modified_time: ~datetime.datetime
:keyword last_modified_by: Details of the user who last modified the Webhook.
:paramtype last_modified_by: str
:keyword description: Gets or sets the description.
:paramtype description: str
"""
super(Webhook, self).__init__(**kwargs)
self.is_enabled = is_enabled
self.uri = uri
self.expiry_time = expiry_time
self.last_invoked_time = last_invoked_time
self.parameters = parameters
self.runbook = runbook
self.run_on = run_on
self.creation_time = creation_time
self.last_modified_time = last_modified_time
self.last_modified_by = last_modified_by
self.description = description
class WebhookCreateOrUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the create or update webhook operation.
All required parameters must be populated in order to send to Azure.
:ivar name: Required. Gets or sets the name of the webhook.
:vartype name: str
:ivar is_enabled: Gets or sets the value of the enabled flag of webhook.
:vartype is_enabled: bool
:ivar uri: Gets or sets the uri.
:vartype uri: str
:ivar expiry_time: Gets or sets the expiry time.
:vartype expiry_time: ~datetime.datetime
:ivar parameters: Gets or sets the parameters of the job.
:vartype parameters: dict[str, str]
:ivar runbook: Gets or sets the runbook.
:vartype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:ivar run_on: Gets or sets the name of the hybrid worker group the webhook job will run on.
:vartype run_on: str
"""
_validation = {
'name': {'required': True},
}
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'},
'uri': {'key': 'properties.uri', 'type': 'str'},
'expiry_time': {'key': 'properties.expiryTime', 'type': 'iso-8601'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
'runbook': {'key': 'properties.runbook', 'type': 'RunbookAssociationProperty'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
}
def __init__(
self,
*,
name: str,
is_enabled: Optional[bool] = None,
uri: Optional[str] = None,
expiry_time: Optional[datetime.datetime] = None,
parameters: Optional[Dict[str, str]] = None,
runbook: Optional["_models.RunbookAssociationProperty"] = None,
run_on: Optional[str] = None,
**kwargs
):
"""
:keyword name: Required. Gets or sets the name of the webhook.
:paramtype name: str
:keyword is_enabled: Gets or sets the value of the enabled flag of webhook.
:paramtype is_enabled: bool
:keyword uri: Gets or sets the uri.
:paramtype uri: str
:keyword expiry_time: Gets or sets the expiry time.
:paramtype expiry_time: ~datetime.datetime
:keyword parameters: Gets or sets the parameters of the job.
:paramtype parameters: dict[str, str]
:keyword runbook: Gets or sets the runbook.
:paramtype runbook: ~azure.mgmt.automation.models.RunbookAssociationProperty
:keyword run_on: Gets or sets the name of the hybrid worker group the webhook job will run on.
:paramtype run_on: str
"""
super(WebhookCreateOrUpdateParameters, self).__init__(**kwargs)
self.name = name
self.is_enabled = is_enabled
self.uri = uri
self.expiry_time = expiry_time
self.parameters = parameters
self.runbook = runbook
self.run_on = run_on
class WebhookListResult(msrest.serialization.Model):
"""The response model for the list webhook operation.
:ivar value: Gets or sets a list of webhooks.
:vartype value: list[~azure.mgmt.automation.models.Webhook]
:ivar next_link: Gets or sets the next link.
:vartype next_link: str
"""
_attribute_map = {
'value': {'key': 'value', 'type': '[Webhook]'},
'next_link': {'key': 'nextLink', 'type': 'str'},
}
def __init__(
self,
*,
value: Optional[List["_models.Webhook"]] = None,
next_link: Optional[str] = None,
**kwargs
):
"""
:keyword value: Gets or sets a list of webhooks.
:paramtype value: list[~azure.mgmt.automation.models.Webhook]
:keyword next_link: Gets or sets the next link.
:paramtype next_link: str
"""
super(WebhookListResult, self).__init__(**kwargs)
self.value = value
self.next_link = next_link
class WebhookUpdateParameters(msrest.serialization.Model):
"""The parameters supplied to the update webhook operation.
:ivar name: Gets or sets the name of the webhook.
:vartype name: str
:ivar is_enabled: Gets or sets the value of the enabled flag of webhook.
:vartype is_enabled: bool
:ivar run_on: Gets or sets the name of the hybrid worker group the webhook job will run on.
:vartype run_on: str
:ivar parameters: Gets or sets the parameters of the job.
:vartype parameters: dict[str, str]
:ivar description: Gets or sets the description of the webhook.
:vartype description: str
"""
_attribute_map = {
'name': {'key': 'name', 'type': 'str'},
'is_enabled': {'key': 'properties.isEnabled', 'type': 'bool'},
'run_on': {'key': 'properties.runOn', 'type': 'str'},
'parameters': {'key': 'properties.parameters', 'type': '{str}'},
'description': {'key': 'properties.description', 'type': 'str'},
}
def __init__(
self,
*,
name: Optional[str] = None,
is_enabled: Optional[bool] = None,
run_on: Optional[str] = None,
parameters: Optional[Dict[str, str]] = None,
description: Optional[str] = None,
**kwargs
):
"""
:keyword name: Gets or sets the name of the webhook.
:paramtype name: str
:keyword is_enabled: Gets or sets the value of the enabled flag of webhook.
:paramtype is_enabled: bool
:keyword run_on: Gets or sets the name of the hybrid worker group the webhook job will run on.
:paramtype run_on: str
:keyword parameters: Gets or sets the parameters of the job.
:paramtype parameters: dict[str, str]
:keyword description: Gets or sets the description of the webhook.
:paramtype description: str
"""
super(WebhookUpdateParameters, self).__init__(**kwargs)
self.name = name
self.is_enabled = is_enabled
self.run_on = run_on
self.parameters = parameters
self.description = description
class WindowsProperties(msrest.serialization.Model):
"""Windows specific update configuration.
:ivar included_update_classifications: Update classification included in the software update
configuration. A comma separated string with required values. Known values are: "Unclassified",
"Critical", "Security", "UpdateRollup", "FeaturePack", "ServicePack", "Definition", "Tools",
"Updates".
:vartype included_update_classifications: str or
~azure.mgmt.automation.models.WindowsUpdateClasses
:ivar excluded_kb_numbers: KB numbers excluded from the software update configuration.
:vartype excluded_kb_numbers: list[str]
:ivar included_kb_numbers: KB numbers included from the software update configuration.
:vartype included_kb_numbers: list[str]
:ivar reboot_setting: Reboot setting for the software update configuration.
:vartype reboot_setting: str
"""
_attribute_map = {
'included_update_classifications': {'key': 'includedUpdateClassifications', 'type': 'str'},
'excluded_kb_numbers': {'key': 'excludedKbNumbers', 'type': '[str]'},
'included_kb_numbers': {'key': 'includedKbNumbers', 'type': '[str]'},
'reboot_setting': {'key': 'rebootSetting', 'type': 'str'},
}
def __init__(
self,
*,
included_update_classifications: Optional[Union[str, "_models.WindowsUpdateClasses"]] = None,
excluded_kb_numbers: Optional[List[str]] = None,
included_kb_numbers: Optional[List[str]] = None,
reboot_setting: Optional[str] = None,
**kwargs
):
"""
:keyword included_update_classifications: Update classification included in the software update
configuration. A comma separated string with required values. Known values are: "Unclassified",
"Critical", "Security", "UpdateRollup", "FeaturePack", "ServicePack", "Definition", "Tools",
"Updates".
:paramtype included_update_classifications: str or
~azure.mgmt.automation.models.WindowsUpdateClasses
:keyword excluded_kb_numbers: KB numbers excluded from the software update configuration.
:paramtype excluded_kb_numbers: list[str]
:keyword included_kb_numbers: KB numbers included from the software update configuration.
:paramtype included_kb_numbers: list[str]
:keyword reboot_setting: Reboot setting for the software update configuration.
:paramtype reboot_setting: str
"""
super(WindowsProperties, self).__init__(**kwargs)
self.included_update_classifications = included_update_classifications
self.excluded_kb_numbers = excluded_kb_numbers
self.included_kb_numbers = included_kb_numbers
self.reboot_setting = reboot_setting
| 0.892941 | 0.305294 |
from enum import Enum
from azure.core import CaseInsensitiveEnumMeta
class AgentRegistrationKeyName(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the agent registration key name - primary or secondary.
"""
PRIMARY = "primary"
SECONDARY = "secondary"
class AutomationAccountState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets status of account.
"""
OK = "Ok"
UNAVAILABLE = "Unavailable"
SUSPENDED = "Suspended"
class AutomationKeyName(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Automation key name.
"""
PRIMARY = "Primary"
SECONDARY = "Secondary"
class AutomationKeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Automation key permissions.
"""
READ = "Read"
FULL = "Full"
class ContentSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the content source type.
"""
EMBEDDED_CONTENT = "embeddedContent"
URI = "uri"
class CountType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
STATUS = "status"
NODECONFIGURATION = "nodeconfiguration"
class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of identity that created the resource.
"""
USER = "User"
APPLICATION = "Application"
MANAGED_IDENTITY = "ManagedIdentity"
KEY = "Key"
class DscConfigurationState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the state of the configuration.
"""
NEW = "New"
EDIT = "Edit"
PUBLISHED = "Published"
class EncryptionKeySourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Encryption Key Source
"""
MICROSOFT_AUTOMATION = "Microsoft.Automation"
MICROSOFT_KEYVAULT = "Microsoft.Keyvault"
class GraphRunbookType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Runbook Type
"""
GRAPH_POWER_SHELL = "GraphPowerShell"
GRAPH_POWER_SHELL_WORKFLOW = "GraphPowerShellWorkflow"
class GroupTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of the HybridWorkerGroup.
"""
USER = "User"
SYSTEM = "System"
class HttpStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
CONTINUE_ENUM = "Continue"
SWITCHING_PROTOCOLS = "SwitchingProtocols"
OK = "OK"
CREATED = "Created"
ACCEPTED = "Accepted"
NON_AUTHORITATIVE_INFORMATION = "NonAuthoritativeInformation"
NO_CONTENT = "NoContent"
RESET_CONTENT = "ResetContent"
PARTIAL_CONTENT = "PartialContent"
MULTIPLE_CHOICES = "MultipleChoices"
AMBIGUOUS = "Ambiguous"
MOVED_PERMANENTLY = "MovedPermanently"
MOVED = "Moved"
FOUND = "Found"
REDIRECT = "Redirect"
SEE_OTHER = "SeeOther"
REDIRECT_METHOD = "RedirectMethod"
NOT_MODIFIED = "NotModified"
USE_PROXY = "UseProxy"
UNUSED = "Unused"
TEMPORARY_REDIRECT = "TemporaryRedirect"
REDIRECT_KEEP_VERB = "RedirectKeepVerb"
BAD_REQUEST = "BadRequest"
UNAUTHORIZED = "Unauthorized"
PAYMENT_REQUIRED = "PaymentRequired"
FORBIDDEN = "Forbidden"
NOT_FOUND = "NotFound"
METHOD_NOT_ALLOWED = "MethodNotAllowed"
NOT_ACCEPTABLE = "NotAcceptable"
PROXY_AUTHENTICATION_REQUIRED = "ProxyAuthenticationRequired"
REQUEST_TIMEOUT = "RequestTimeout"
CONFLICT = "Conflict"
GONE = "Gone"
LENGTH_REQUIRED = "LengthRequired"
PRECONDITION_FAILED = "PreconditionFailed"
REQUEST_ENTITY_TOO_LARGE = "RequestEntityTooLarge"
REQUEST_URI_TOO_LONG = "RequestUriTooLong"
UNSUPPORTED_MEDIA_TYPE = "UnsupportedMediaType"
REQUESTED_RANGE_NOT_SATISFIABLE = "RequestedRangeNotSatisfiable"
EXPECTATION_FAILED = "ExpectationFailed"
UPGRADE_REQUIRED = "UpgradeRequired"
INTERNAL_SERVER_ERROR = "InternalServerError"
NOT_IMPLEMENTED = "NotImplemented"
BAD_GATEWAY = "BadGateway"
SERVICE_UNAVAILABLE = "ServiceUnavailable"
GATEWAY_TIMEOUT = "GatewayTimeout"
HTTP_VERSION_NOT_SUPPORTED = "HttpVersionNotSupported"
class JobProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state of the resource.
"""
FAILED = "Failed"
SUCCEEDED = "Succeeded"
SUSPENDED = "Suspended"
PROCESSING = "Processing"
class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the status of the job.
"""
NEW = "New"
ACTIVATING = "Activating"
RUNNING = "Running"
COMPLETED = "Completed"
FAILED = "Failed"
STOPPED = "Stopped"
BLOCKED = "Blocked"
SUSPENDED = "Suspended"
DISCONNECTED = "Disconnected"
SUSPENDING = "Suspending"
STOPPING = "Stopping"
RESUMING = "Resuming"
REMOVING = "Removing"
class JobStreamType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the stream type.
"""
PROGRESS = "Progress"
OUTPUT = "Output"
WARNING = "Warning"
ERROR = "Error"
DEBUG = "Debug"
VERBOSE = "Verbose"
ANY = "Any"
class LinuxUpdateClasses(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Update classifications included in the software update configuration.
"""
UNCLASSIFIED = "Unclassified"
CRITICAL = "Critical"
SECURITY = "Security"
OTHER = "Other"
class ModuleProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the provisioning state of the module.
"""
CREATED = "Created"
CREATING = "Creating"
STARTING_IMPORT_MODULE_RUNBOOK = "StartingImportModuleRunbook"
RUNNING_IMPORT_MODULE_RUNBOOK = "RunningImportModuleRunbook"
CONTENT_RETRIEVED = "ContentRetrieved"
CONTENT_DOWNLOADED = "ContentDownloaded"
CONTENT_VALIDATED = "ContentValidated"
CONNECTION_TYPE_IMPORTED = "ConnectionTypeImported"
CONTENT_STORED = "ContentStored"
MODULE_DATA_STORED = "ModuleDataStored"
ACTIVITIES_STORED = "ActivitiesStored"
MODULE_IMPORT_RUNBOOK_COMPLETE = "ModuleImportRunbookComplete"
SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELLED = "Cancelled"
UPDATING = "Updating"
class OperatingSystemType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Target operating system for the software update configuration.
"""
WINDOWS = "Windows"
LINUX = "Linux"
class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state of the job.
"""
COMPLETED = "Completed"
FAILED = "Failed"
RUNNING = "Running"
class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The identity type.
"""
SYSTEM_ASSIGNED = "SystemAssigned"
USER_ASSIGNED = "UserAssigned"
SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned"
NONE = "None"
class RunbookState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the state of the runbook.
"""
NEW = "New"
EDIT = "Edit"
PUBLISHED = "Published"
class RunbookTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the type of the runbook.
"""
SCRIPT = "Script"
GRAPH = "Graph"
POWER_SHELL_WORKFLOW = "PowerShellWorkflow"
POWER_SHELL = "PowerShell"
GRAPH_POWER_SHELL_WORKFLOW = "GraphPowerShellWorkflow"
GRAPH_POWER_SHELL = "GraphPowerShell"
PYTHON2 = "Python2"
PYTHON3 = "Python3"
class ScheduleDay(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday, saturday,
sunday.
"""
MONDAY = "Monday"
TUESDAY = "Tuesday"
WEDNESDAY = "Wednesday"
THURSDAY = "Thursday"
FRIDAY = "Friday"
SATURDAY = "Saturday"
SUNDAY = "Sunday"
class ScheduleFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the frequency of the schedule.
"""
ONE_TIME = "OneTime"
DAY = "Day"
HOUR = "Hour"
WEEK = "Week"
MONTH = "Month"
#: The minimum allowed interval for Minute schedules is 15 minutes.
MINUTE = "Minute"
class SkuNameEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the SKU name of the account.
"""
FREE = "Free"
BASIC = "Basic"
class SourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The source type. Must be one of VsoGit, VsoTfvc, GitHub.
"""
VSO_GIT = "VsoGit"
VSO_TFVC = "VsoTfvc"
GIT_HUB = "GitHub"
class StreamType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of the sync job stream.
"""
ERROR = "Error"
OUTPUT = "Output"
class SyncType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The sync type.
"""
PARTIAL_SYNC = "PartialSync"
FULL_SYNC = "FullSync"
class TagOperators(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Filter VMs by Any or All specified tags.
"""
ALL = "All"
ANY = "Any"
class TokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The token type. Must be either PersonalAccessToken or Oauth.
"""
PERSONAL_ACCESS_TOKEN = "PersonalAccessToken"
OAUTH = "Oauth"
class WindowsUpdateClasses(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Update classification included in the software update configuration. A comma separated string
with required values
"""
UNCLASSIFIED = "Unclassified"
CRITICAL = "Critical"
SECURITY = "Security"
UPDATE_ROLLUP = "UpdateRollup"
FEATURE_PACK = "FeaturePack"
SERVICE_PACK = "ServicePack"
DEFINITION = "Definition"
TOOLS = "Tools"
UPDATES = "Updates"
class WorkerType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of the HybridWorker.
"""
HYBRID_V1 = "HybridV1"
HYBRID_V2 = "HybridV2"
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/models/_automation_client_enums.py
|
_automation_client_enums.py
|
from enum import Enum
from azure.core import CaseInsensitiveEnumMeta
class AgentRegistrationKeyName(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the agent registration key name - primary or secondary.
"""
PRIMARY = "primary"
SECONDARY = "secondary"
class AutomationAccountState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets status of account.
"""
OK = "Ok"
UNAVAILABLE = "Unavailable"
SUSPENDED = "Suspended"
class AutomationKeyName(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Automation key name.
"""
PRIMARY = "Primary"
SECONDARY = "Secondary"
class AutomationKeyPermissions(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Automation key permissions.
"""
READ = "Read"
FULL = "Full"
class ContentSourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the content source type.
"""
EMBEDDED_CONTENT = "embeddedContent"
URI = "uri"
class CountType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
STATUS = "status"
NODECONFIGURATION = "nodeconfiguration"
class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of identity that created the resource.
"""
USER = "User"
APPLICATION = "Application"
MANAGED_IDENTITY = "ManagedIdentity"
KEY = "Key"
class DscConfigurationState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the state of the configuration.
"""
NEW = "New"
EDIT = "Edit"
PUBLISHED = "Published"
class EncryptionKeySourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Encryption Key Source
"""
MICROSOFT_AUTOMATION = "Microsoft.Automation"
MICROSOFT_KEYVAULT = "Microsoft.Keyvault"
class GraphRunbookType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Runbook Type
"""
GRAPH_POWER_SHELL = "GraphPowerShell"
GRAPH_POWER_SHELL_WORKFLOW = "GraphPowerShellWorkflow"
class GroupTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of the HybridWorkerGroup.
"""
USER = "User"
SYSTEM = "System"
class HttpStatusCode(str, Enum, metaclass=CaseInsensitiveEnumMeta):
CONTINUE_ENUM = "Continue"
SWITCHING_PROTOCOLS = "SwitchingProtocols"
OK = "OK"
CREATED = "Created"
ACCEPTED = "Accepted"
NON_AUTHORITATIVE_INFORMATION = "NonAuthoritativeInformation"
NO_CONTENT = "NoContent"
RESET_CONTENT = "ResetContent"
PARTIAL_CONTENT = "PartialContent"
MULTIPLE_CHOICES = "MultipleChoices"
AMBIGUOUS = "Ambiguous"
MOVED_PERMANENTLY = "MovedPermanently"
MOVED = "Moved"
FOUND = "Found"
REDIRECT = "Redirect"
SEE_OTHER = "SeeOther"
REDIRECT_METHOD = "RedirectMethod"
NOT_MODIFIED = "NotModified"
USE_PROXY = "UseProxy"
UNUSED = "Unused"
TEMPORARY_REDIRECT = "TemporaryRedirect"
REDIRECT_KEEP_VERB = "RedirectKeepVerb"
BAD_REQUEST = "BadRequest"
UNAUTHORIZED = "Unauthorized"
PAYMENT_REQUIRED = "PaymentRequired"
FORBIDDEN = "Forbidden"
NOT_FOUND = "NotFound"
METHOD_NOT_ALLOWED = "MethodNotAllowed"
NOT_ACCEPTABLE = "NotAcceptable"
PROXY_AUTHENTICATION_REQUIRED = "ProxyAuthenticationRequired"
REQUEST_TIMEOUT = "RequestTimeout"
CONFLICT = "Conflict"
GONE = "Gone"
LENGTH_REQUIRED = "LengthRequired"
PRECONDITION_FAILED = "PreconditionFailed"
REQUEST_ENTITY_TOO_LARGE = "RequestEntityTooLarge"
REQUEST_URI_TOO_LONG = "RequestUriTooLong"
UNSUPPORTED_MEDIA_TYPE = "UnsupportedMediaType"
REQUESTED_RANGE_NOT_SATISFIABLE = "RequestedRangeNotSatisfiable"
EXPECTATION_FAILED = "ExpectationFailed"
UPGRADE_REQUIRED = "UpgradeRequired"
INTERNAL_SERVER_ERROR = "InternalServerError"
NOT_IMPLEMENTED = "NotImplemented"
BAD_GATEWAY = "BadGateway"
SERVICE_UNAVAILABLE = "ServiceUnavailable"
GATEWAY_TIMEOUT = "GatewayTimeout"
HTTP_VERSION_NOT_SUPPORTED = "HttpVersionNotSupported"
class JobProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state of the resource.
"""
FAILED = "Failed"
SUCCEEDED = "Succeeded"
SUSPENDED = "Suspended"
PROCESSING = "Processing"
class JobStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the status of the job.
"""
NEW = "New"
ACTIVATING = "Activating"
RUNNING = "Running"
COMPLETED = "Completed"
FAILED = "Failed"
STOPPED = "Stopped"
BLOCKED = "Blocked"
SUSPENDED = "Suspended"
DISCONNECTED = "Disconnected"
SUSPENDING = "Suspending"
STOPPING = "Stopping"
RESUMING = "Resuming"
REMOVING = "Removing"
class JobStreamType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the stream type.
"""
PROGRESS = "Progress"
OUTPUT = "Output"
WARNING = "Warning"
ERROR = "Error"
DEBUG = "Debug"
VERBOSE = "Verbose"
ANY = "Any"
class LinuxUpdateClasses(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Update classifications included in the software update configuration.
"""
UNCLASSIFIED = "Unclassified"
CRITICAL = "Critical"
SECURITY = "Security"
OTHER = "Other"
class ModuleProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the provisioning state of the module.
"""
CREATED = "Created"
CREATING = "Creating"
STARTING_IMPORT_MODULE_RUNBOOK = "StartingImportModuleRunbook"
RUNNING_IMPORT_MODULE_RUNBOOK = "RunningImportModuleRunbook"
CONTENT_RETRIEVED = "ContentRetrieved"
CONTENT_DOWNLOADED = "ContentDownloaded"
CONTENT_VALIDATED = "ContentValidated"
CONNECTION_TYPE_IMPORTED = "ConnectionTypeImported"
CONTENT_STORED = "ContentStored"
MODULE_DATA_STORED = "ModuleDataStored"
ACTIVITIES_STORED = "ActivitiesStored"
MODULE_IMPORT_RUNBOOK_COMPLETE = "ModuleImportRunbookComplete"
SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELLED = "Cancelled"
UPDATING = "Updating"
class OperatingSystemType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Target operating system for the software update configuration.
"""
WINDOWS = "Windows"
LINUX = "Linux"
class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state of the job.
"""
COMPLETED = "Completed"
FAILED = "Failed"
RUNNING = "Running"
class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The identity type.
"""
SYSTEM_ASSIGNED = "SystemAssigned"
USER_ASSIGNED = "UserAssigned"
SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned"
NONE = "None"
class RunbookState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the state of the runbook.
"""
NEW = "New"
EDIT = "Edit"
PUBLISHED = "Published"
class RunbookTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the type of the runbook.
"""
SCRIPT = "Script"
GRAPH = "Graph"
POWER_SHELL_WORKFLOW = "PowerShellWorkflow"
POWER_SHELL = "PowerShell"
GRAPH_POWER_SHELL_WORKFLOW = "GraphPowerShellWorkflow"
GRAPH_POWER_SHELL = "GraphPowerShell"
PYTHON2 = "Python2"
PYTHON3 = "Python3"
class ScheduleDay(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Day of the occurrence. Must be one of monday, tuesday, wednesday, thursday, friday, saturday,
sunday.
"""
MONDAY = "Monday"
TUESDAY = "Tuesday"
WEDNESDAY = "Wednesday"
THURSDAY = "Thursday"
FRIDAY = "Friday"
SATURDAY = "Saturday"
SUNDAY = "Sunday"
class ScheduleFrequency(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the frequency of the schedule.
"""
ONE_TIME = "OneTime"
DAY = "Day"
HOUR = "Hour"
WEEK = "Week"
MONTH = "Month"
#: The minimum allowed interval for Minute schedules is 15 minutes.
MINUTE = "Minute"
class SkuNameEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Gets or sets the SKU name of the account.
"""
FREE = "Free"
BASIC = "Basic"
class SourceType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The source type. Must be one of VsoGit, VsoTfvc, GitHub.
"""
VSO_GIT = "VsoGit"
VSO_TFVC = "VsoTfvc"
GIT_HUB = "GitHub"
class StreamType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of the sync job stream.
"""
ERROR = "Error"
OUTPUT = "Output"
class SyncType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The sync type.
"""
PARTIAL_SYNC = "PartialSync"
FULL_SYNC = "FullSync"
class TagOperators(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Filter VMs by Any or All specified tags.
"""
ALL = "All"
ANY = "Any"
class TokenType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The token type. Must be either PersonalAccessToken or Oauth.
"""
PERSONAL_ACCESS_TOKEN = "PersonalAccessToken"
OAUTH = "Oauth"
class WindowsUpdateClasses(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Update classification included in the software update configuration. A comma separated string
with required values
"""
UNCLASSIFIED = "Unclassified"
CRITICAL = "Critical"
SECURITY = "Security"
UPDATE_ROLLUP = "UpdateRollup"
FEATURE_PACK = "FeaturePack"
SERVICE_PACK = "ServicePack"
DEFINITION = "Definition"
TOOLS = "Tools"
UPDATES = "Updates"
class WorkerType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of the HybridWorker.
"""
HYBRID_V1 = "HybridV1"
HYBRID_V2 = "HybridV2"
| 0.566738 | 0.104432 |
from ._models_py3 import Activity
from ._models_py3 import ActivityListResult
from ._models_py3 import ActivityOutputType
from ._models_py3 import ActivityParameter
from ._models_py3 import ActivityParameterSet
from ._models_py3 import ActivityParameterValidationSet
from ._models_py3 import AdvancedSchedule
from ._models_py3 import AdvancedScheduleMonthlyOccurrence
from ._models_py3 import AgentRegistration
from ._models_py3 import AgentRegistrationKeys
from ._models_py3 import AgentRegistrationRegenerateKeyParameter
from ._models_py3 import AutomationAccount
from ._models_py3 import AutomationAccountCreateOrUpdateParameters
from ._models_py3 import AutomationAccountListResult
from ._models_py3 import AutomationAccountUpdateParameters
from ._models_py3 import AzureQueryProperties
from ._models_py3 import Certificate
from ._models_py3 import CertificateCreateOrUpdateParameters
from ._models_py3 import CertificateListResult
from ._models_py3 import CertificateUpdateParameters
from ._models_py3 import ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties
from ._models_py3 import Connection
from ._models_py3 import ConnectionCreateOrUpdateParameters
from ._models_py3 import ConnectionListResult
from ._models_py3 import ConnectionType
from ._models_py3 import ConnectionTypeAssociationProperty
from ._models_py3 import ConnectionTypeCreateOrUpdateParameters
from ._models_py3 import ConnectionTypeListResult
from ._models_py3 import ConnectionUpdateParameters
from ._models_py3 import ContentHash
from ._models_py3 import ContentLink
from ._models_py3 import ContentSource
from ._models_py3 import Credential
from ._models_py3 import CredentialCreateOrUpdateParameters
from ._models_py3 import CredentialListResult
from ._models_py3 import CredentialUpdateParameters
from ._models_py3 import DscCompilationJob
from ._models_py3 import DscCompilationJobCreateParameters
from ._models_py3 import DscCompilationJobListResult
from ._models_py3 import DscConfiguration
from ._models_py3 import DscConfigurationAssociationProperty
from ._models_py3 import DscConfigurationCreateOrUpdateParameters
from ._models_py3 import DscConfigurationListResult
from ._models_py3 import DscConfigurationParameter
from ._models_py3 import DscConfigurationUpdateParameters
from ._models_py3 import DscMetaConfiguration
from ._models_py3 import DscNode
from ._models_py3 import DscNodeConfiguration
from ._models_py3 import DscNodeConfigurationCreateOrUpdateParameters
from ._models_py3 import DscNodeConfigurationListResult
from ._models_py3 import DscNodeExtensionHandlerAssociationProperty
from ._models_py3 import DscNodeListResult
from ._models_py3 import DscNodeReport
from ._models_py3 import DscNodeReportListResult
from ._models_py3 import DscNodeUpdateParameters
from ._models_py3 import DscNodeUpdateParametersProperties
from ._models_py3 import DscReportError
from ._models_py3 import DscReportResource
from ._models_py3 import DscReportResourceNavigation
from ._models_py3 import EncryptionProperties
from ._models_py3 import EncryptionPropertiesIdentity
from ._models_py3 import ErrorResponse
from ._models_py3 import FieldDefinition
from ._models_py3 import GraphicalRunbookContent
from ._models_py3 import HybridRunbookWorker
from ._models_py3 import HybridRunbookWorkerCreateParameters
from ._models_py3 import HybridRunbookWorkerGroup
from ._models_py3 import HybridRunbookWorkerGroupCreateOrUpdateParameters
from ._models_py3 import HybridRunbookWorkerGroupUpdateParameters
from ._models_py3 import HybridRunbookWorkerGroupsListResult
from ._models_py3 import HybridRunbookWorkerLegacy
from ._models_py3 import HybridRunbookWorkerMoveParameters
from ._models_py3 import HybridRunbookWorkersListResult
from ._models_py3 import Identity
from ._models_py3 import Job
from ._models_py3 import JobCollectionItem
from ._models_py3 import JobCreateParameters
from ._models_py3 import JobListResultV2
from ._models_py3 import JobNavigation
from ._models_py3 import JobSchedule
from ._models_py3 import JobScheduleCreateParameters
from ._models_py3 import JobScheduleListResult
from ._models_py3 import JobStream
from ._models_py3 import JobStreamListResult
from ._models_py3 import Key
from ._models_py3 import KeyListResult
from ._models_py3 import KeyVaultProperties
from ._models_py3 import LinkedWorkspace
from ._models_py3 import LinuxProperties
from ._models_py3 import Module
from ._models_py3 import ModuleCreateOrUpdateParameters
from ._models_py3 import ModuleErrorInfo
from ._models_py3 import ModuleListResult
from ._models_py3 import ModuleUpdateParameters
from ._models_py3 import NodeCount
from ._models_py3 import NodeCountProperties
from ._models_py3 import NodeCounts
from ._models_py3 import NonAzureQueryProperties
from ._models_py3 import Operation
from ._models_py3 import OperationDisplay
from ._models_py3 import OperationListResult
from ._models_py3 import PrivateEndpointConnection
from ._models_py3 import PrivateEndpointConnectionListResult
from ._models_py3 import PrivateEndpointProperty
from ._models_py3 import PrivateLinkResource
from ._models_py3 import PrivateLinkResourceListResult
from ._models_py3 import PrivateLinkServiceConnectionStateProperty
from ._models_py3 import ProxyResource
from ._models_py3 import PythonPackageCreateParameters
from ._models_py3 import PythonPackageUpdateParameters
from ._models_py3 import RawGraphicalRunbookContent
from ._models_py3 import Resource
from ._models_py3 import RunAsCredentialAssociationProperty
from ._models_py3 import Runbook
from ._models_py3 import RunbookAssociationProperty
from ._models_py3 import RunbookCreateOrUpdateDraftParameters
from ._models_py3 import RunbookCreateOrUpdateDraftProperties
from ._models_py3 import RunbookCreateOrUpdateParameters
from ._models_py3 import RunbookDraft
from ._models_py3 import RunbookDraftUndoEditResult
from ._models_py3 import RunbookListResult
from ._models_py3 import RunbookParameter
from ._models_py3 import RunbookUpdateParameters
from ._models_py3 import SUCScheduleProperties
from ._models_py3 import Schedule
from ._models_py3 import ScheduleAssociationProperty
from ._models_py3 import ScheduleCreateOrUpdateParameters
from ._models_py3 import ScheduleListResult
from ._models_py3 import ScheduleUpdateParameters
from ._models_py3 import Sku
from ._models_py3 import SoftwareUpdateConfiguration
from ._models_py3 import SoftwareUpdateConfigurationCollectionItem
from ._models_py3 import SoftwareUpdateConfigurationListResult
from ._models_py3 import SoftwareUpdateConfigurationMachineRun
from ._models_py3 import SoftwareUpdateConfigurationMachineRunListResult
from ._models_py3 import SoftwareUpdateConfigurationRun
from ._models_py3 import SoftwareUpdateConfigurationRunListResult
from ._models_py3 import SoftwareUpdateConfigurationRunTaskProperties
from ._models_py3 import SoftwareUpdateConfigurationRunTasks
from ._models_py3 import SoftwareUpdateConfigurationTasks
from ._models_py3 import SourceControl
from ._models_py3 import SourceControlCreateOrUpdateParameters
from ._models_py3 import SourceControlListResult
from ._models_py3 import SourceControlSecurityTokenProperties
from ._models_py3 import SourceControlSyncJob
from ._models_py3 import SourceControlSyncJobById
from ._models_py3 import SourceControlSyncJobCreateParameters
from ._models_py3 import SourceControlSyncJobListResult
from ._models_py3 import SourceControlSyncJobStream
from ._models_py3 import SourceControlSyncJobStreamById
from ._models_py3 import SourceControlSyncJobStreamsListBySyncJob
from ._models_py3 import SourceControlUpdateParameters
from ._models_py3 import Statistics
from ._models_py3 import StatisticsListResult
from ._models_py3 import SystemData
from ._models_py3 import TagSettingsProperties
from ._models_py3 import TargetProperties
from ._models_py3 import TaskProperties
from ._models_py3 import TestJob
from ._models_py3 import TestJobCreateParameters
from ._models_py3 import TrackedResource
from ._models_py3 import TypeField
from ._models_py3 import TypeFieldListResult
from ._models_py3 import UpdateConfiguration
from ._models_py3 import UpdateConfigurationNavigation
from ._models_py3 import Usage
from ._models_py3 import UsageCounterName
from ._models_py3 import UsageListResult
from ._models_py3 import Variable
from ._models_py3 import VariableCreateOrUpdateParameters
from ._models_py3 import VariableListResult
from ._models_py3 import VariableUpdateParameters
from ._models_py3 import Watcher
from ._models_py3 import WatcherListResult
from ._models_py3 import WatcherUpdateParameters
from ._models_py3 import Webhook
from ._models_py3 import WebhookCreateOrUpdateParameters
from ._models_py3 import WebhookListResult
from ._models_py3 import WebhookUpdateParameters
from ._models_py3 import WindowsProperties
from ._automation_client_enums import (
AgentRegistrationKeyName,
AutomationAccountState,
AutomationKeyName,
AutomationKeyPermissions,
ContentSourceType,
CountType,
CreatedByType,
DscConfigurationState,
EncryptionKeySourceType,
GraphRunbookType,
GroupTypeEnum,
HttpStatusCode,
JobProvisioningState,
JobStatus,
JobStreamType,
LinuxUpdateClasses,
ModuleProvisioningState,
OperatingSystemType,
ProvisioningState,
ResourceIdentityType,
RunbookState,
RunbookTypeEnum,
ScheduleDay,
ScheduleFrequency,
SkuNameEnum,
SourceType,
StreamType,
SyncType,
TagOperators,
TokenType,
WindowsUpdateClasses,
WorkerType,
)
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'Activity',
'ActivityListResult',
'ActivityOutputType',
'ActivityParameter',
'ActivityParameterSet',
'ActivityParameterValidationSet',
'AdvancedSchedule',
'AdvancedScheduleMonthlyOccurrence',
'AgentRegistration',
'AgentRegistrationKeys',
'AgentRegistrationRegenerateKeyParameter',
'AutomationAccount',
'AutomationAccountCreateOrUpdateParameters',
'AutomationAccountListResult',
'AutomationAccountUpdateParameters',
'AzureQueryProperties',
'Certificate',
'CertificateCreateOrUpdateParameters',
'CertificateListResult',
'CertificateUpdateParameters',
'ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties',
'Connection',
'ConnectionCreateOrUpdateParameters',
'ConnectionListResult',
'ConnectionType',
'ConnectionTypeAssociationProperty',
'ConnectionTypeCreateOrUpdateParameters',
'ConnectionTypeListResult',
'ConnectionUpdateParameters',
'ContentHash',
'ContentLink',
'ContentSource',
'Credential',
'CredentialCreateOrUpdateParameters',
'CredentialListResult',
'CredentialUpdateParameters',
'DscCompilationJob',
'DscCompilationJobCreateParameters',
'DscCompilationJobListResult',
'DscConfiguration',
'DscConfigurationAssociationProperty',
'DscConfigurationCreateOrUpdateParameters',
'DscConfigurationListResult',
'DscConfigurationParameter',
'DscConfigurationUpdateParameters',
'DscMetaConfiguration',
'DscNode',
'DscNodeConfiguration',
'DscNodeConfigurationCreateOrUpdateParameters',
'DscNodeConfigurationListResult',
'DscNodeExtensionHandlerAssociationProperty',
'DscNodeListResult',
'DscNodeReport',
'DscNodeReportListResult',
'DscNodeUpdateParameters',
'DscNodeUpdateParametersProperties',
'DscReportError',
'DscReportResource',
'DscReportResourceNavigation',
'EncryptionProperties',
'EncryptionPropertiesIdentity',
'ErrorResponse',
'FieldDefinition',
'GraphicalRunbookContent',
'HybridRunbookWorker',
'HybridRunbookWorkerCreateParameters',
'HybridRunbookWorkerGroup',
'HybridRunbookWorkerGroupCreateOrUpdateParameters',
'HybridRunbookWorkerGroupUpdateParameters',
'HybridRunbookWorkerGroupsListResult',
'HybridRunbookWorkerLegacy',
'HybridRunbookWorkerMoveParameters',
'HybridRunbookWorkersListResult',
'Identity',
'Job',
'JobCollectionItem',
'JobCreateParameters',
'JobListResultV2',
'JobNavigation',
'JobSchedule',
'JobScheduleCreateParameters',
'JobScheduleListResult',
'JobStream',
'JobStreamListResult',
'Key',
'KeyListResult',
'KeyVaultProperties',
'LinkedWorkspace',
'LinuxProperties',
'Module',
'ModuleCreateOrUpdateParameters',
'ModuleErrorInfo',
'ModuleListResult',
'ModuleUpdateParameters',
'NodeCount',
'NodeCountProperties',
'NodeCounts',
'NonAzureQueryProperties',
'Operation',
'OperationDisplay',
'OperationListResult',
'PrivateEndpointConnection',
'PrivateEndpointConnectionListResult',
'PrivateEndpointProperty',
'PrivateLinkResource',
'PrivateLinkResourceListResult',
'PrivateLinkServiceConnectionStateProperty',
'ProxyResource',
'PythonPackageCreateParameters',
'PythonPackageUpdateParameters',
'RawGraphicalRunbookContent',
'Resource',
'RunAsCredentialAssociationProperty',
'Runbook',
'RunbookAssociationProperty',
'RunbookCreateOrUpdateDraftParameters',
'RunbookCreateOrUpdateDraftProperties',
'RunbookCreateOrUpdateParameters',
'RunbookDraft',
'RunbookDraftUndoEditResult',
'RunbookListResult',
'RunbookParameter',
'RunbookUpdateParameters',
'SUCScheduleProperties',
'Schedule',
'ScheduleAssociationProperty',
'ScheduleCreateOrUpdateParameters',
'ScheduleListResult',
'ScheduleUpdateParameters',
'Sku',
'SoftwareUpdateConfiguration',
'SoftwareUpdateConfigurationCollectionItem',
'SoftwareUpdateConfigurationListResult',
'SoftwareUpdateConfigurationMachineRun',
'SoftwareUpdateConfigurationMachineRunListResult',
'SoftwareUpdateConfigurationRun',
'SoftwareUpdateConfigurationRunListResult',
'SoftwareUpdateConfigurationRunTaskProperties',
'SoftwareUpdateConfigurationRunTasks',
'SoftwareUpdateConfigurationTasks',
'SourceControl',
'SourceControlCreateOrUpdateParameters',
'SourceControlListResult',
'SourceControlSecurityTokenProperties',
'SourceControlSyncJob',
'SourceControlSyncJobById',
'SourceControlSyncJobCreateParameters',
'SourceControlSyncJobListResult',
'SourceControlSyncJobStream',
'SourceControlSyncJobStreamById',
'SourceControlSyncJobStreamsListBySyncJob',
'SourceControlUpdateParameters',
'Statistics',
'StatisticsListResult',
'SystemData',
'TagSettingsProperties',
'TargetProperties',
'TaskProperties',
'TestJob',
'TestJobCreateParameters',
'TrackedResource',
'TypeField',
'TypeFieldListResult',
'UpdateConfiguration',
'UpdateConfigurationNavigation',
'Usage',
'UsageCounterName',
'UsageListResult',
'Variable',
'VariableCreateOrUpdateParameters',
'VariableListResult',
'VariableUpdateParameters',
'Watcher',
'WatcherListResult',
'WatcherUpdateParameters',
'Webhook',
'WebhookCreateOrUpdateParameters',
'WebhookListResult',
'WebhookUpdateParameters',
'WindowsProperties',
'AgentRegistrationKeyName',
'AutomationAccountState',
'AutomationKeyName',
'AutomationKeyPermissions',
'ContentSourceType',
'CountType',
'CreatedByType',
'DscConfigurationState',
'EncryptionKeySourceType',
'GraphRunbookType',
'GroupTypeEnum',
'HttpStatusCode',
'JobProvisioningState',
'JobStatus',
'JobStreamType',
'LinuxUpdateClasses',
'ModuleProvisioningState',
'OperatingSystemType',
'ProvisioningState',
'ResourceIdentityType',
'RunbookState',
'RunbookTypeEnum',
'ScheduleDay',
'ScheduleFrequency',
'SkuNameEnum',
'SourceType',
'StreamType',
'SyncType',
'TagOperators',
'TokenType',
'WindowsUpdateClasses',
'WorkerType',
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
|
azure-mgmt-automation
|
/azure-mgmt-automation-1.1.0b2.zip/azure-mgmt-automation-1.1.0b2/azure/mgmt/automation/models/__init__.py
|
__init__.py
|
from ._models_py3 import Activity
from ._models_py3 import ActivityListResult
from ._models_py3 import ActivityOutputType
from ._models_py3 import ActivityParameter
from ._models_py3 import ActivityParameterSet
from ._models_py3 import ActivityParameterValidationSet
from ._models_py3 import AdvancedSchedule
from ._models_py3 import AdvancedScheduleMonthlyOccurrence
from ._models_py3 import AgentRegistration
from ._models_py3 import AgentRegistrationKeys
from ._models_py3 import AgentRegistrationRegenerateKeyParameter
from ._models_py3 import AutomationAccount
from ._models_py3 import AutomationAccountCreateOrUpdateParameters
from ._models_py3 import AutomationAccountListResult
from ._models_py3 import AutomationAccountUpdateParameters
from ._models_py3 import AzureQueryProperties
from ._models_py3 import Certificate
from ._models_py3 import CertificateCreateOrUpdateParameters
from ._models_py3 import CertificateListResult
from ._models_py3 import CertificateUpdateParameters
from ._models_py3 import ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties
from ._models_py3 import Connection
from ._models_py3 import ConnectionCreateOrUpdateParameters
from ._models_py3 import ConnectionListResult
from ._models_py3 import ConnectionType
from ._models_py3 import ConnectionTypeAssociationProperty
from ._models_py3 import ConnectionTypeCreateOrUpdateParameters
from ._models_py3 import ConnectionTypeListResult
from ._models_py3 import ConnectionUpdateParameters
from ._models_py3 import ContentHash
from ._models_py3 import ContentLink
from ._models_py3 import ContentSource
from ._models_py3 import Credential
from ._models_py3 import CredentialCreateOrUpdateParameters
from ._models_py3 import CredentialListResult
from ._models_py3 import CredentialUpdateParameters
from ._models_py3 import DscCompilationJob
from ._models_py3 import DscCompilationJobCreateParameters
from ._models_py3 import DscCompilationJobListResult
from ._models_py3 import DscConfiguration
from ._models_py3 import DscConfigurationAssociationProperty
from ._models_py3 import DscConfigurationCreateOrUpdateParameters
from ._models_py3 import DscConfigurationListResult
from ._models_py3 import DscConfigurationParameter
from ._models_py3 import DscConfigurationUpdateParameters
from ._models_py3 import DscMetaConfiguration
from ._models_py3 import DscNode
from ._models_py3 import DscNodeConfiguration
from ._models_py3 import DscNodeConfigurationCreateOrUpdateParameters
from ._models_py3 import DscNodeConfigurationListResult
from ._models_py3 import DscNodeExtensionHandlerAssociationProperty
from ._models_py3 import DscNodeListResult
from ._models_py3 import DscNodeReport
from ._models_py3 import DscNodeReportListResult
from ._models_py3 import DscNodeUpdateParameters
from ._models_py3 import DscNodeUpdateParametersProperties
from ._models_py3 import DscReportError
from ._models_py3 import DscReportResource
from ._models_py3 import DscReportResourceNavigation
from ._models_py3 import EncryptionProperties
from ._models_py3 import EncryptionPropertiesIdentity
from ._models_py3 import ErrorResponse
from ._models_py3 import FieldDefinition
from ._models_py3 import GraphicalRunbookContent
from ._models_py3 import HybridRunbookWorker
from ._models_py3 import HybridRunbookWorkerCreateParameters
from ._models_py3 import HybridRunbookWorkerGroup
from ._models_py3 import HybridRunbookWorkerGroupCreateOrUpdateParameters
from ._models_py3 import HybridRunbookWorkerGroupUpdateParameters
from ._models_py3 import HybridRunbookWorkerGroupsListResult
from ._models_py3 import HybridRunbookWorkerLegacy
from ._models_py3 import HybridRunbookWorkerMoveParameters
from ._models_py3 import HybridRunbookWorkersListResult
from ._models_py3 import Identity
from ._models_py3 import Job
from ._models_py3 import JobCollectionItem
from ._models_py3 import JobCreateParameters
from ._models_py3 import JobListResultV2
from ._models_py3 import JobNavigation
from ._models_py3 import JobSchedule
from ._models_py3 import JobScheduleCreateParameters
from ._models_py3 import JobScheduleListResult
from ._models_py3 import JobStream
from ._models_py3 import JobStreamListResult
from ._models_py3 import Key
from ._models_py3 import KeyListResult
from ._models_py3 import KeyVaultProperties
from ._models_py3 import LinkedWorkspace
from ._models_py3 import LinuxProperties
from ._models_py3 import Module
from ._models_py3 import ModuleCreateOrUpdateParameters
from ._models_py3 import ModuleErrorInfo
from ._models_py3 import ModuleListResult
from ._models_py3 import ModuleUpdateParameters
from ._models_py3 import NodeCount
from ._models_py3 import NodeCountProperties
from ._models_py3 import NodeCounts
from ._models_py3 import NonAzureQueryProperties
from ._models_py3 import Operation
from ._models_py3 import OperationDisplay
from ._models_py3 import OperationListResult
from ._models_py3 import PrivateEndpointConnection
from ._models_py3 import PrivateEndpointConnectionListResult
from ._models_py3 import PrivateEndpointProperty
from ._models_py3 import PrivateLinkResource
from ._models_py3 import PrivateLinkResourceListResult
from ._models_py3 import PrivateLinkServiceConnectionStateProperty
from ._models_py3 import ProxyResource
from ._models_py3 import PythonPackageCreateParameters
from ._models_py3 import PythonPackageUpdateParameters
from ._models_py3 import RawGraphicalRunbookContent
from ._models_py3 import Resource
from ._models_py3 import RunAsCredentialAssociationProperty
from ._models_py3 import Runbook
from ._models_py3 import RunbookAssociationProperty
from ._models_py3 import RunbookCreateOrUpdateDraftParameters
from ._models_py3 import RunbookCreateOrUpdateDraftProperties
from ._models_py3 import RunbookCreateOrUpdateParameters
from ._models_py3 import RunbookDraft
from ._models_py3 import RunbookDraftUndoEditResult
from ._models_py3 import RunbookListResult
from ._models_py3 import RunbookParameter
from ._models_py3 import RunbookUpdateParameters
from ._models_py3 import SUCScheduleProperties
from ._models_py3 import Schedule
from ._models_py3 import ScheduleAssociationProperty
from ._models_py3 import ScheduleCreateOrUpdateParameters
from ._models_py3 import ScheduleListResult
from ._models_py3 import ScheduleUpdateParameters
from ._models_py3 import Sku
from ._models_py3 import SoftwareUpdateConfiguration
from ._models_py3 import SoftwareUpdateConfigurationCollectionItem
from ._models_py3 import SoftwareUpdateConfigurationListResult
from ._models_py3 import SoftwareUpdateConfigurationMachineRun
from ._models_py3 import SoftwareUpdateConfigurationMachineRunListResult
from ._models_py3 import SoftwareUpdateConfigurationRun
from ._models_py3 import SoftwareUpdateConfigurationRunListResult
from ._models_py3 import SoftwareUpdateConfigurationRunTaskProperties
from ._models_py3 import SoftwareUpdateConfigurationRunTasks
from ._models_py3 import SoftwareUpdateConfigurationTasks
from ._models_py3 import SourceControl
from ._models_py3 import SourceControlCreateOrUpdateParameters
from ._models_py3 import SourceControlListResult
from ._models_py3 import SourceControlSecurityTokenProperties
from ._models_py3 import SourceControlSyncJob
from ._models_py3 import SourceControlSyncJobById
from ._models_py3 import SourceControlSyncJobCreateParameters
from ._models_py3 import SourceControlSyncJobListResult
from ._models_py3 import SourceControlSyncJobStream
from ._models_py3 import SourceControlSyncJobStreamById
from ._models_py3 import SourceControlSyncJobStreamsListBySyncJob
from ._models_py3 import SourceControlUpdateParameters
from ._models_py3 import Statistics
from ._models_py3 import StatisticsListResult
from ._models_py3 import SystemData
from ._models_py3 import TagSettingsProperties
from ._models_py3 import TargetProperties
from ._models_py3 import TaskProperties
from ._models_py3 import TestJob
from ._models_py3 import TestJobCreateParameters
from ._models_py3 import TrackedResource
from ._models_py3 import TypeField
from ._models_py3 import TypeFieldListResult
from ._models_py3 import UpdateConfiguration
from ._models_py3 import UpdateConfigurationNavigation
from ._models_py3 import Usage
from ._models_py3 import UsageCounterName
from ._models_py3 import UsageListResult
from ._models_py3 import Variable
from ._models_py3 import VariableCreateOrUpdateParameters
from ._models_py3 import VariableListResult
from ._models_py3 import VariableUpdateParameters
from ._models_py3 import Watcher
from ._models_py3 import WatcherListResult
from ._models_py3 import WatcherUpdateParameters
from ._models_py3 import Webhook
from ._models_py3 import WebhookCreateOrUpdateParameters
from ._models_py3 import WebhookListResult
from ._models_py3 import WebhookUpdateParameters
from ._models_py3 import WindowsProperties
from ._automation_client_enums import (
AgentRegistrationKeyName,
AutomationAccountState,
AutomationKeyName,
AutomationKeyPermissions,
ContentSourceType,
CountType,
CreatedByType,
DscConfigurationState,
EncryptionKeySourceType,
GraphRunbookType,
GroupTypeEnum,
HttpStatusCode,
JobProvisioningState,
JobStatus,
JobStreamType,
LinuxUpdateClasses,
ModuleProvisioningState,
OperatingSystemType,
ProvisioningState,
ResourceIdentityType,
RunbookState,
RunbookTypeEnum,
ScheduleDay,
ScheduleFrequency,
SkuNameEnum,
SourceType,
StreamType,
SyncType,
TagOperators,
TokenType,
WindowsUpdateClasses,
WorkerType,
)
from ._patch import __all__ as _patch_all
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
'Activity',
'ActivityListResult',
'ActivityOutputType',
'ActivityParameter',
'ActivityParameterSet',
'ActivityParameterValidationSet',
'AdvancedSchedule',
'AdvancedScheduleMonthlyOccurrence',
'AgentRegistration',
'AgentRegistrationKeys',
'AgentRegistrationRegenerateKeyParameter',
'AutomationAccount',
'AutomationAccountCreateOrUpdateParameters',
'AutomationAccountListResult',
'AutomationAccountUpdateParameters',
'AzureQueryProperties',
'Certificate',
'CertificateCreateOrUpdateParameters',
'CertificateListResult',
'CertificateUpdateParameters',
'ComponentsSgqdofSchemasIdentityPropertiesUserassignedidentitiesAdditionalproperties',
'Connection',
'ConnectionCreateOrUpdateParameters',
'ConnectionListResult',
'ConnectionType',
'ConnectionTypeAssociationProperty',
'ConnectionTypeCreateOrUpdateParameters',
'ConnectionTypeListResult',
'ConnectionUpdateParameters',
'ContentHash',
'ContentLink',
'ContentSource',
'Credential',
'CredentialCreateOrUpdateParameters',
'CredentialListResult',
'CredentialUpdateParameters',
'DscCompilationJob',
'DscCompilationJobCreateParameters',
'DscCompilationJobListResult',
'DscConfiguration',
'DscConfigurationAssociationProperty',
'DscConfigurationCreateOrUpdateParameters',
'DscConfigurationListResult',
'DscConfigurationParameter',
'DscConfigurationUpdateParameters',
'DscMetaConfiguration',
'DscNode',
'DscNodeConfiguration',
'DscNodeConfigurationCreateOrUpdateParameters',
'DscNodeConfigurationListResult',
'DscNodeExtensionHandlerAssociationProperty',
'DscNodeListResult',
'DscNodeReport',
'DscNodeReportListResult',
'DscNodeUpdateParameters',
'DscNodeUpdateParametersProperties',
'DscReportError',
'DscReportResource',
'DscReportResourceNavigation',
'EncryptionProperties',
'EncryptionPropertiesIdentity',
'ErrorResponse',
'FieldDefinition',
'GraphicalRunbookContent',
'HybridRunbookWorker',
'HybridRunbookWorkerCreateParameters',
'HybridRunbookWorkerGroup',
'HybridRunbookWorkerGroupCreateOrUpdateParameters',
'HybridRunbookWorkerGroupUpdateParameters',
'HybridRunbookWorkerGroupsListResult',
'HybridRunbookWorkerLegacy',
'HybridRunbookWorkerMoveParameters',
'HybridRunbookWorkersListResult',
'Identity',
'Job',
'JobCollectionItem',
'JobCreateParameters',
'JobListResultV2',
'JobNavigation',
'JobSchedule',
'JobScheduleCreateParameters',
'JobScheduleListResult',
'JobStream',
'JobStreamListResult',
'Key',
'KeyListResult',
'KeyVaultProperties',
'LinkedWorkspace',
'LinuxProperties',
'Module',
'ModuleCreateOrUpdateParameters',
'ModuleErrorInfo',
'ModuleListResult',
'ModuleUpdateParameters',
'NodeCount',
'NodeCountProperties',
'NodeCounts',
'NonAzureQueryProperties',
'Operation',
'OperationDisplay',
'OperationListResult',
'PrivateEndpointConnection',
'PrivateEndpointConnectionListResult',
'PrivateEndpointProperty',
'PrivateLinkResource',
'PrivateLinkResourceListResult',
'PrivateLinkServiceConnectionStateProperty',
'ProxyResource',
'PythonPackageCreateParameters',
'PythonPackageUpdateParameters',
'RawGraphicalRunbookContent',
'Resource',
'RunAsCredentialAssociationProperty',
'Runbook',
'RunbookAssociationProperty',
'RunbookCreateOrUpdateDraftParameters',
'RunbookCreateOrUpdateDraftProperties',
'RunbookCreateOrUpdateParameters',
'RunbookDraft',
'RunbookDraftUndoEditResult',
'RunbookListResult',
'RunbookParameter',
'RunbookUpdateParameters',
'SUCScheduleProperties',
'Schedule',
'ScheduleAssociationProperty',
'ScheduleCreateOrUpdateParameters',
'ScheduleListResult',
'ScheduleUpdateParameters',
'Sku',
'SoftwareUpdateConfiguration',
'SoftwareUpdateConfigurationCollectionItem',
'SoftwareUpdateConfigurationListResult',
'SoftwareUpdateConfigurationMachineRun',
'SoftwareUpdateConfigurationMachineRunListResult',
'SoftwareUpdateConfigurationRun',
'SoftwareUpdateConfigurationRunListResult',
'SoftwareUpdateConfigurationRunTaskProperties',
'SoftwareUpdateConfigurationRunTasks',
'SoftwareUpdateConfigurationTasks',
'SourceControl',
'SourceControlCreateOrUpdateParameters',
'SourceControlListResult',
'SourceControlSecurityTokenProperties',
'SourceControlSyncJob',
'SourceControlSyncJobById',
'SourceControlSyncJobCreateParameters',
'SourceControlSyncJobListResult',
'SourceControlSyncJobStream',
'SourceControlSyncJobStreamById',
'SourceControlSyncJobStreamsListBySyncJob',
'SourceControlUpdateParameters',
'Statistics',
'StatisticsListResult',
'SystemData',
'TagSettingsProperties',
'TargetProperties',
'TaskProperties',
'TestJob',
'TestJobCreateParameters',
'TrackedResource',
'TypeField',
'TypeFieldListResult',
'UpdateConfiguration',
'UpdateConfigurationNavigation',
'Usage',
'UsageCounterName',
'UsageListResult',
'Variable',
'VariableCreateOrUpdateParameters',
'VariableListResult',
'VariableUpdateParameters',
'Watcher',
'WatcherListResult',
'WatcherUpdateParameters',
'Webhook',
'WebhookCreateOrUpdateParameters',
'WebhookListResult',
'WebhookUpdateParameters',
'WindowsProperties',
'AgentRegistrationKeyName',
'AutomationAccountState',
'AutomationKeyName',
'AutomationKeyPermissions',
'ContentSourceType',
'CountType',
'CreatedByType',
'DscConfigurationState',
'EncryptionKeySourceType',
'GraphRunbookType',
'GroupTypeEnum',
'HttpStatusCode',
'JobProvisioningState',
'JobStatus',
'JobStreamType',
'LinuxUpdateClasses',
'ModuleProvisioningState',
'OperatingSystemType',
'ProvisioningState',
'ResourceIdentityType',
'RunbookState',
'RunbookTypeEnum',
'ScheduleDay',
'ScheduleFrequency',
'SkuNameEnum',
'SourceType',
'StreamType',
'SyncType',
'TagOperators',
'TokenType',
'WindowsUpdateClasses',
'WorkerType',
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
| 0.490724 | 0.058105 |
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from . import models as _models
from ._configuration import AVSClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
AddonsOperations,
AuthorizationsOperations,
CloudLinksOperations,
ClustersOperations,
DatastoresOperations,
GlobalReachConnectionsOperations,
HcxEnterpriseSitesOperations,
LocationsOperations,
Operations,
PlacementPoliciesOperations,
PrivateCloudsOperations,
ScriptCmdletsOperations,
ScriptExecutionsOperations,
ScriptPackagesOperations,
VirtualMachinesOperations,
WorkloadNetworksOperations,
)
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
class AVSClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""Azure VMware Solution API.
:ivar operations: Operations operations
:vartype operations: azure.mgmt.avs.operations.Operations
:ivar locations: LocationsOperations operations
:vartype locations: azure.mgmt.avs.operations.LocationsOperations
:ivar private_clouds: PrivateCloudsOperations operations
:vartype private_clouds: azure.mgmt.avs.operations.PrivateCloudsOperations
:ivar clusters: ClustersOperations operations
:vartype clusters: azure.mgmt.avs.operations.ClustersOperations
:ivar datastores: DatastoresOperations operations
:vartype datastores: azure.mgmt.avs.operations.DatastoresOperations
:ivar hcx_enterprise_sites: HcxEnterpriseSitesOperations operations
:vartype hcx_enterprise_sites: azure.mgmt.avs.operations.HcxEnterpriseSitesOperations
:ivar authorizations: AuthorizationsOperations operations
:vartype authorizations: azure.mgmt.avs.operations.AuthorizationsOperations
:ivar global_reach_connections: GlobalReachConnectionsOperations operations
:vartype global_reach_connections: azure.mgmt.avs.operations.GlobalReachConnectionsOperations
:ivar workload_networks: WorkloadNetworksOperations operations
:vartype workload_networks: azure.mgmt.avs.operations.WorkloadNetworksOperations
:ivar cloud_links: CloudLinksOperations operations
:vartype cloud_links: azure.mgmt.avs.operations.CloudLinksOperations
:ivar addons: AddonsOperations operations
:vartype addons: azure.mgmt.avs.operations.AddonsOperations
:ivar virtual_machines: VirtualMachinesOperations operations
:vartype virtual_machines: azure.mgmt.avs.operations.VirtualMachinesOperations
:ivar placement_policies: PlacementPoliciesOperations operations
:vartype placement_policies: azure.mgmt.avs.operations.PlacementPoliciesOperations
:ivar script_packages: ScriptPackagesOperations operations
:vartype script_packages: azure.mgmt.avs.operations.ScriptPackagesOperations
:ivar script_cmdlets: ScriptCmdletsOperations operations
:vartype script_cmdlets: azure.mgmt.avs.operations.ScriptCmdletsOperations
:ivar script_executions: ScriptExecutionsOperations operations
:vartype script_executions: azure.mgmt.avs.operations.ScriptExecutionsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
"""
def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AVSClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._client: ARMPipelineClient = 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._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.private_clouds = PrivateCloudsOperations(self._client, self._config, self._serialize, self._deserialize)
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.datastores = DatastoresOperations(self._client, self._config, self._serialize, self._deserialize)
self.hcx_enterprise_sites = HcxEnterpriseSitesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.authorizations = AuthorizationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.global_reach_connections = GlobalReachConnectionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.workload_networks = WorkloadNetworksOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.cloud_links = CloudLinksOperations(self._client, self._config, self._serialize, self._deserialize)
self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_machines = VirtualMachinesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.placement_policies = PlacementPoliciesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.script_packages = ScriptPackagesOperations(self._client, self._config, self._serialize, self._deserialize)
self.script_cmdlets = ScriptCmdletsOperations(self._client, self._config, self._serialize, self._deserialize)
self.script_executions = ScriptExecutionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client._send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.HttpResponse
"""
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
def close(self) -> None:
self._client.close()
def __enter__(self) -> "AVSClient":
self._client.__enter__()
return self
def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/_avs_client.py
|
_avs_client.py
|
from copy import deepcopy
from typing import Any, TYPE_CHECKING
from azure.core.rest import HttpRequest, HttpResponse
from azure.mgmt.core import ARMPipelineClient
from . import models as _models
from ._configuration import AVSClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import (
AddonsOperations,
AuthorizationsOperations,
CloudLinksOperations,
ClustersOperations,
DatastoresOperations,
GlobalReachConnectionsOperations,
HcxEnterpriseSitesOperations,
LocationsOperations,
Operations,
PlacementPoliciesOperations,
PrivateCloudsOperations,
ScriptCmdletsOperations,
ScriptExecutionsOperations,
ScriptPackagesOperations,
VirtualMachinesOperations,
WorkloadNetworksOperations,
)
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
class AVSClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""Azure VMware Solution API.
:ivar operations: Operations operations
:vartype operations: azure.mgmt.avs.operations.Operations
:ivar locations: LocationsOperations operations
:vartype locations: azure.mgmt.avs.operations.LocationsOperations
:ivar private_clouds: PrivateCloudsOperations operations
:vartype private_clouds: azure.mgmt.avs.operations.PrivateCloudsOperations
:ivar clusters: ClustersOperations operations
:vartype clusters: azure.mgmt.avs.operations.ClustersOperations
:ivar datastores: DatastoresOperations operations
:vartype datastores: azure.mgmt.avs.operations.DatastoresOperations
:ivar hcx_enterprise_sites: HcxEnterpriseSitesOperations operations
:vartype hcx_enterprise_sites: azure.mgmt.avs.operations.HcxEnterpriseSitesOperations
:ivar authorizations: AuthorizationsOperations operations
:vartype authorizations: azure.mgmt.avs.operations.AuthorizationsOperations
:ivar global_reach_connections: GlobalReachConnectionsOperations operations
:vartype global_reach_connections: azure.mgmt.avs.operations.GlobalReachConnectionsOperations
:ivar workload_networks: WorkloadNetworksOperations operations
:vartype workload_networks: azure.mgmt.avs.operations.WorkloadNetworksOperations
:ivar cloud_links: CloudLinksOperations operations
:vartype cloud_links: azure.mgmt.avs.operations.CloudLinksOperations
:ivar addons: AddonsOperations operations
:vartype addons: azure.mgmt.avs.operations.AddonsOperations
:ivar virtual_machines: VirtualMachinesOperations operations
:vartype virtual_machines: azure.mgmt.avs.operations.VirtualMachinesOperations
:ivar placement_policies: PlacementPoliciesOperations operations
:vartype placement_policies: azure.mgmt.avs.operations.PlacementPoliciesOperations
:ivar script_packages: ScriptPackagesOperations operations
:vartype script_packages: azure.mgmt.avs.operations.ScriptPackagesOperations
:ivar script_cmdlets: ScriptCmdletsOperations operations
:vartype script_cmdlets: azure.mgmt.avs.operations.ScriptCmdletsOperations
:ivar script_executions: ScriptExecutionsOperations operations
:vartype script_executions: azure.mgmt.avs.operations.ScriptExecutionsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
"""
def __init__(
self,
credential: "TokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AVSClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._client: ARMPipelineClient = 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._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.private_clouds = PrivateCloudsOperations(self._client, self._config, self._serialize, self._deserialize)
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.datastores = DatastoresOperations(self._client, self._config, self._serialize, self._deserialize)
self.hcx_enterprise_sites = HcxEnterpriseSitesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.authorizations = AuthorizationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.global_reach_connections = GlobalReachConnectionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.workload_networks = WorkloadNetworksOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.cloud_links = CloudLinksOperations(self._client, self._config, self._serialize, self._deserialize)
self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_machines = VirtualMachinesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.placement_policies = PlacementPoliciesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.script_packages = ScriptPackagesOperations(self._client, self._config, self._serialize, self._deserialize)
self.script_cmdlets = ScriptCmdletsOperations(self._client, self._config, self._serialize, self._deserialize)
self.script_executions = ScriptExecutionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client._send_request(request)
<HttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.HttpResponse
"""
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
def close(self) -> None:
self._client.close()
def __enter__(self) -> "AVSClient":
self._client.__enter__()
return self
def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)
| 0.827932 | 0.085824 |
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
from ._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
class AVSClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for AVSClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(AVSClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-03-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-avs/{}".format(VERSION))
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/_configuration.py
|
_configuration.py
|
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy
from ._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential
class AVSClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for AVSClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(AVSClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-03-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-avs/{}".format(VERSION))
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = ARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)
| 0.835383 | 0.087486 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, authorization_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"authorizationName": _SERIALIZER.url("authorization_name", authorization_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, private_cloud_name: str, authorization_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"authorizationName": _SERIALIZER.url("authorization_name", authorization_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, private_cloud_name: str, authorization_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"authorizationName": _SERIALIZER.url("authorization_name", authorization_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class AuthorizationsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`authorizations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.ExpressRouteAuthorization"]:
"""List ExpressRoute Circuit Authorizations in a private cloud.
List ExpressRoute Circuit Authorizations in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ExpressRouteAuthorization or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ExpressRouteAuthorizationList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExpressRouteAuthorizationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any
) -> _models.ExpressRouteAuthorization:
"""Get an ExpressRoute Circuit Authorization by name in a private cloud.
Get an ExpressRoute Circuit Authorization by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ExpressRouteAuthorization or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ExpressRouteAuthorization
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: Union[_models.ExpressRouteAuthorization, IO],
**kwargs: Any
) -> _models.ExpressRouteAuthorization:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(authorization, (IOBase, bytes)):
_content = authorization
else:
_json = self._serialize.body(authorization, "ExpressRouteAuthorization")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: _models.ExpressRouteAuthorization,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ExpressRouteAuthorization]:
"""Create or update an ExpressRoute Circuit Authorization in a private cloud.
Create or update an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:param authorization: An ExpressRoute Circuit Authorization. Required.
:type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ExpressRouteAuthorization or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ExpressRouteAuthorization]:
"""Create or update an ExpressRoute Circuit Authorization in a private cloud.
Create or update an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:param authorization: An ExpressRoute Circuit Authorization. Required.
:type authorization: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ExpressRouteAuthorization or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: Union[_models.ExpressRouteAuthorization, IO],
**kwargs: Any
) -> LROPoller[_models.ExpressRouteAuthorization]:
"""Create or update an ExpressRoute Circuit Authorization in a private cloud.
Create or update an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:param authorization: An ExpressRoute Circuit Authorization. Is either a
ExpressRouteAuthorization type or a IO type. Required.
:type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ExpressRouteAuthorization or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
authorization=authorization,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete an ExpressRoute Circuit Authorization in a private cloud.
Delete an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_authorizations_operations.py
|
_authorizations_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, authorization_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"authorizationName": _SERIALIZER.url("authorization_name", authorization_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, private_cloud_name: str, authorization_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"authorizationName": _SERIALIZER.url("authorization_name", authorization_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, private_cloud_name: str, authorization_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"authorizationName": _SERIALIZER.url("authorization_name", authorization_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class AuthorizationsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`authorizations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.ExpressRouteAuthorization"]:
"""List ExpressRoute Circuit Authorizations in a private cloud.
List ExpressRoute Circuit Authorizations in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ExpressRouteAuthorization or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ExpressRouteAuthorizationList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("ExpressRouteAuthorizationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any
) -> _models.ExpressRouteAuthorization:
"""Get an ExpressRoute Circuit Authorization by name in a private cloud.
Get an ExpressRoute Circuit Authorization by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ExpressRouteAuthorization or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ExpressRouteAuthorization
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: Union[_models.ExpressRouteAuthorization, IO],
**kwargs: Any
) -> _models.ExpressRouteAuthorization:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(authorization, (IOBase, bytes)):
_content = authorization
else:
_json = self._serialize.body(authorization, "ExpressRouteAuthorization")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: _models.ExpressRouteAuthorization,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ExpressRouteAuthorization]:
"""Create or update an ExpressRoute Circuit Authorization in a private cloud.
Create or update an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:param authorization: An ExpressRoute Circuit Authorization. Required.
:type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ExpressRouteAuthorization or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ExpressRouteAuthorization]:
"""Create or update an ExpressRoute Circuit Authorization in a private cloud.
Create or update an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:param authorization: An ExpressRoute Circuit Authorization. Required.
:type authorization: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ExpressRouteAuthorization or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: Union[_models.ExpressRouteAuthorization, IO],
**kwargs: Any
) -> LROPoller[_models.ExpressRouteAuthorization]:
"""Create or update an ExpressRoute Circuit Authorization in a private cloud.
Create or update an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:param authorization: An ExpressRoute Circuit Authorization. Is either a
ExpressRouteAuthorization type or a IO type. Required.
:type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ExpressRouteAuthorization or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
authorization=authorization,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete an ExpressRoute Circuit Authorization in a private cloud.
Delete an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
| 0.78572 | 0.076132 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_in_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds")
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_rotate_vcenter_password_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
def build_rotate_nsxt_password_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_admin_credentials_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
class PrivateCloudsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`private_clouds` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.PrivateCloud"]:
"""List private clouds in a resource group.
List private clouds in a resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateCloud or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateCloudList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateCloudList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
}
@distributed_trace
def list_in_subscription(self, **kwargs: Any) -> Iterable["_models.PrivateCloud"]:
"""List private clouds in a subscription.
List private clouds in a subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateCloud or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateCloudList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_in_subscription_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_in_subscription.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateCloudList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds"}
@distributed_trace
def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> _models.PrivateCloud:
"""Get a private cloud.
Get a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateCloud or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.PrivateCloud
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: Union[_models.PrivateCloud, IO],
**kwargs: Any
) -> _models.PrivateCloud:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(private_cloud, (IOBase, bytes)):
_content = private_cloud
else:
_json = self._serialize.body(private_cloud, "PrivateCloud")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: _models.PrivateCloud,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PrivateCloud]:
"""Create or update a private cloud.
Create or update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud: The private cloud. Required.
:type private_cloud: ~azure.mgmt.avs.models.PrivateCloud
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PrivateCloud]:
"""Create or update a private cloud.
Create or update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud: The private cloud. Required.
:type private_cloud: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: Union[_models.PrivateCloud, IO],
**kwargs: Any
) -> LROPoller[_models.PrivateCloud]:
"""Create or update a private cloud.
Create or update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud: The private cloud. Is either a PrivateCloud type or a IO type. Required.
:type private_cloud: ~azure.mgmt.avs.models.PrivateCloud or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
private_cloud=private_cloud,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
def _update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: Union[_models.PrivateCloudUpdate, IO],
**kwargs: Any
) -> _models.PrivateCloud:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(private_cloud_update, (IOBase, bytes)):
_content = private_cloud_update
else:
_json = self._serialize.body(private_cloud_update, "PrivateCloudUpdate")
request = build_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
@overload
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: _models.PrivateCloudUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PrivateCloud]:
"""Update a private cloud.
Update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud_update: The private cloud properties to be updated. Required.
:type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PrivateCloud]:
"""Update a private cloud.
Update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud_update: The private cloud properties to be updated. Required.
:type private_cloud_update: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: Union[_models.PrivateCloudUpdate, IO],
**kwargs: Any
) -> LROPoller[_models.PrivateCloud]:
"""Update a private cloud.
Update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud_update: The private cloud properties to be updated. Is either a
PrivateCloudUpdate type or a IO type. Required.
:type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
private_cloud_update=private_cloud_update,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
@distributed_trace
def begin_delete(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> LROPoller[None]:
"""Delete a private cloud.
Delete a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
def _rotate_vcenter_password_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_rotate_vcenter_password_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._rotate_vcenter_password_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_rotate_vcenter_password_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword"
}
@distributed_trace
def begin_rotate_vcenter_password(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Rotate the vCenter password.
Rotate the vCenter password.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._rotate_vcenter_password_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_rotate_vcenter_password.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword"
}
def _rotate_nsxt_password_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_rotate_nsxt_password_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._rotate_nsxt_password_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_rotate_nsxt_password_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword"
}
@distributed_trace
def begin_rotate_nsxt_password(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Rotate the NSX-T Manager password.
Rotate the NSX-T Manager password.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._rotate_nsxt_password_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_rotate_nsxt_password.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword"
}
@distributed_trace
def list_admin_credentials(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> _models.AdminCredentials:
"""List the admin credentials for the private cloud.
List the admin credentials for the private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AdminCredentials or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.AdminCredentials
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AdminCredentials] = kwargs.pop("cls", None)
request = build_list_admin_credentials_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_admin_credentials.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("AdminCredentials", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list_admin_credentials.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_private_clouds_operations.py
|
_private_clouds_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_in_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds")
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_rotate_vcenter_password_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
def build_rotate_nsxt_password_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_admin_credentials_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
class PrivateCloudsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`private_clouds` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.PrivateCloud"]:
"""List private clouds in a resource group.
List private clouds in a resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateCloud or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateCloudList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateCloudList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
}
@distributed_trace
def list_in_subscription(self, **kwargs: Any) -> Iterable["_models.PrivateCloud"]:
"""List private clouds in a subscription.
List private clouds in a subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateCloud or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateCloudList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_in_subscription_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_in_subscription.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateCloudList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds"}
@distributed_trace
def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> _models.PrivateCloud:
"""Get a private cloud.
Get a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateCloud or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.PrivateCloud
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: Union[_models.PrivateCloud, IO],
**kwargs: Any
) -> _models.PrivateCloud:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(private_cloud, (IOBase, bytes)):
_content = private_cloud
else:
_json = self._serialize.body(private_cloud, "PrivateCloud")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: _models.PrivateCloud,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PrivateCloud]:
"""Create or update a private cloud.
Create or update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud: The private cloud. Required.
:type private_cloud: ~azure.mgmt.avs.models.PrivateCloud
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PrivateCloud]:
"""Create or update a private cloud.
Create or update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud: The private cloud. Required.
:type private_cloud: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: Union[_models.PrivateCloud, IO],
**kwargs: Any
) -> LROPoller[_models.PrivateCloud]:
"""Create or update a private cloud.
Create or update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud: The private cloud. Is either a PrivateCloud type or a IO type. Required.
:type private_cloud: ~azure.mgmt.avs.models.PrivateCloud or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
private_cloud=private_cloud,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
def _update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: Union[_models.PrivateCloudUpdate, IO],
**kwargs: Any
) -> _models.PrivateCloud:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(private_cloud_update, (IOBase, bytes)):
_content = private_cloud_update
else:
_json = self._serialize.body(private_cloud_update, "PrivateCloudUpdate")
request = build_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
@overload
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: _models.PrivateCloudUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PrivateCloud]:
"""Update a private cloud.
Update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud_update: The private cloud properties to be updated. Required.
:type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PrivateCloud]:
"""Update a private cloud.
Update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud_update: The private cloud properties to be updated. Required.
:type private_cloud_update: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: Union[_models.PrivateCloudUpdate, IO],
**kwargs: Any
) -> LROPoller[_models.PrivateCloud]:
"""Update a private cloud.
Update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud_update: The private cloud properties to be updated. Is either a
PrivateCloudUpdate type or a IO type. Required.
:type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
private_cloud_update=private_cloud_update,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
@distributed_trace
def begin_delete(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> LROPoller[None]:
"""Delete a private cloud.
Delete a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
def _rotate_vcenter_password_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_rotate_vcenter_password_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._rotate_vcenter_password_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_rotate_vcenter_password_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword"
}
@distributed_trace
def begin_rotate_vcenter_password(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Rotate the vCenter password.
Rotate the vCenter password.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._rotate_vcenter_password_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_rotate_vcenter_password.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword"
}
def _rotate_nsxt_password_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_rotate_nsxt_password_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._rotate_nsxt_password_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_rotate_nsxt_password_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword"
}
@distributed_trace
def begin_rotate_nsxt_password(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Rotate the NSX-T Manager password.
Rotate the NSX-T Manager password.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._rotate_nsxt_password_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_rotate_nsxt_password.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword"
}
@distributed_trace
def list_admin_credentials(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> _models.AdminCredentials:
"""List the admin credentials for the private cloud.
List the admin credentials for the private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AdminCredentials or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.AdminCredentials
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AdminCredentials] = kwargs.pop("cls", None)
request = build_list_admin_credentials_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_admin_credentials.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("AdminCredentials", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list_admin_credentials.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials"
}
| 0.786254 | 0.08152 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_check_trial_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"location": _SERIALIZER.url("location", location, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
def build_check_quota_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"location": _SERIALIZER.url("location", location, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
class LocationsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`locations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@overload
def check_trial_availability(
self, location: str, sku: Optional[_models.Sku] = None, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Trial:
"""Return trial status for subscription by region.
:param location: Azure region. Required.
:type location: str
:param sku: The sku to check for trial availability. Default value is None.
:type sku: ~azure.mgmt.avs.models.Sku
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Trial or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Trial
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def check_trial_availability(
self, location: str, sku: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Trial:
"""Return trial status for subscription by region.
:param location: Azure region. Required.
:type location: str
:param sku: The sku to check for trial availability. Default value is None.
:type sku: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Trial or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Trial
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def check_trial_availability(
self, location: str, sku: Optional[Union[_models.Sku, IO]] = None, **kwargs: Any
) -> _models.Trial:
"""Return trial status for subscription by region.
:param location: Azure region. Required.
:type location: str
:param sku: The sku to check for trial availability. Is either a Sku type or a IO type. Default
value is None.
:type sku: ~azure.mgmt.avs.models.Sku or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Trial or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Trial
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Trial] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(sku, (IOBase, bytes)):
_content = sku
else:
if sku is not None:
_json = self._serialize.body(sku, "Sku")
else:
_json = None
request = build_check_trial_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.check_trial_availability.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Trial", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
check_trial_availability.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability"
}
@distributed_trace
def check_quota_availability(self, location: str, **kwargs: Any) -> _models.Quota:
"""Return quota for subscription by region.
:param location: Azure region. Required.
:type location: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Quota or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Quota
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Quota] = kwargs.pop("cls", None)
request = build_check_quota_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.check_quota_availability.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Quota", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
check_quota_availability.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_locations_operations.py
|
_locations_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_check_trial_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"location": _SERIALIZER.url("location", location, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
def build_check_quota_availability_request(location: str, subscription_id: str, **kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"location": _SERIALIZER.url("location", location, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
class LocationsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`locations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@overload
def check_trial_availability(
self, location: str, sku: Optional[_models.Sku] = None, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Trial:
"""Return trial status for subscription by region.
:param location: Azure region. Required.
:type location: str
:param sku: The sku to check for trial availability. Default value is None.
:type sku: ~azure.mgmt.avs.models.Sku
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Trial or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Trial
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def check_trial_availability(
self, location: str, sku: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Trial:
"""Return trial status for subscription by region.
:param location: Azure region. Required.
:type location: str
:param sku: The sku to check for trial availability. Default value is None.
:type sku: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Trial or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Trial
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def check_trial_availability(
self, location: str, sku: Optional[Union[_models.Sku, IO]] = None, **kwargs: Any
) -> _models.Trial:
"""Return trial status for subscription by region.
:param location: Azure region. Required.
:type location: str
:param sku: The sku to check for trial availability. Is either a Sku type or a IO type. Default
value is None.
:type sku: ~azure.mgmt.avs.models.Sku or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Trial or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Trial
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Trial] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(sku, (IOBase, bytes)):
_content = sku
else:
if sku is not None:
_json = self._serialize.body(sku, "Sku")
else:
_json = None
request = build_check_trial_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.check_trial_availability.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Trial", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
check_trial_availability.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability"
}
@distributed_trace
def check_quota_availability(self, location: str, **kwargs: Any) -> _models.Quota:
"""Return quota for subscription by region.
:param location: Azure region. Required.
:type location: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Quota or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Quota
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Quota] = kwargs.pop("cls", None)
request = build_check_quota_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.check_quota_availability.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Quota", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
check_quota_availability.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability"
}
| 0.889126 | 0.080285 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, cloud_link_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"cloudLinkName": _SERIALIZER.url("cloud_link_name", cloud_link_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, private_cloud_name: str, cloud_link_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"cloudLinkName": _SERIALIZER.url("cloud_link_name", cloud_link_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, private_cloud_name: str, cloud_link_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"cloudLinkName": _SERIALIZER.url("cloud_link_name", cloud_link_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class CloudLinksOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`cloud_links` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> Iterable["_models.CloudLink"]:
"""List cloud link in a private cloud.
List cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either CloudLink or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CloudLinkList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("CloudLinkList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any
) -> _models.CloudLink:
"""Get an cloud link by name in a private cloud.
Get an cloud link by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: CloudLink or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.CloudLink
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("CloudLink", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: Union[_models.CloudLink, IO],
**kwargs: Any
) -> _models.CloudLink:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cloud_link, (IOBase, bytes)):
_content = cloud_link
else:
_json = self._serialize.body(cloud_link, "CloudLink")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("CloudLink", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("CloudLink", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: _models.CloudLink,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CloudLink]:
"""Create or update a cloud link in a private cloud.
Create or update a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:param cloud_link: A cloud link in the private cloud. Required.
:type cloud_link: ~azure.mgmt.avs.models.CloudLink
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either CloudLink or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CloudLink]:
"""Create or update a cloud link in a private cloud.
Create or update a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:param cloud_link: A cloud link in the private cloud. Required.
:type cloud_link: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either CloudLink or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: Union[_models.CloudLink, IO],
**kwargs: Any
) -> LROPoller[_models.CloudLink]:
"""Create or update a cloud link in a private cloud.
Create or update a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:param cloud_link: A cloud link in the private cloud. Is either a CloudLink type or a IO type.
Required.
:type cloud_link: ~azure.mgmt.avs.models.CloudLink or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either CloudLink or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
cloud_link=cloud_link,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CloudLink", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a cloud link in a private cloud.
Delete a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_cloud_links_operations.py
|
_cloud_links_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, cloud_link_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"cloudLinkName": _SERIALIZER.url("cloud_link_name", cloud_link_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, private_cloud_name: str, cloud_link_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"cloudLinkName": _SERIALIZER.url("cloud_link_name", cloud_link_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, private_cloud_name: str, cloud_link_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"cloudLinkName": _SERIALIZER.url("cloud_link_name", cloud_link_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class CloudLinksOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`cloud_links` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> Iterable["_models.CloudLink"]:
"""List cloud link in a private cloud.
List cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either CloudLink or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CloudLinkList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("CloudLinkList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any
) -> _models.CloudLink:
"""Get an cloud link by name in a private cloud.
Get an cloud link by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: CloudLink or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.CloudLink
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("CloudLink", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: Union[_models.CloudLink, IO],
**kwargs: Any
) -> _models.CloudLink:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cloud_link, (IOBase, bytes)):
_content = cloud_link
else:
_json = self._serialize.body(cloud_link, "CloudLink")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("CloudLink", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("CloudLink", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: _models.CloudLink,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CloudLink]:
"""Create or update a cloud link in a private cloud.
Create or update a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:param cloud_link: A cloud link in the private cloud. Required.
:type cloud_link: ~azure.mgmt.avs.models.CloudLink
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either CloudLink or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.CloudLink]:
"""Create or update a cloud link in a private cloud.
Create or update a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:param cloud_link: A cloud link in the private cloud. Required.
:type cloud_link: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either CloudLink or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: Union[_models.CloudLink, IO],
**kwargs: Any
) -> LROPoller[_models.CloudLink]:
"""Create or update a cloud link in a private cloud.
Create or update a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:param cloud_link: A cloud link in the private cloud. Is either a CloudLink type or a IO type.
Required.
:type cloud_link: ~azure.mgmt.avs.models.CloudLink or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either CloudLink or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
cloud_link=cloud_link,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CloudLink", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a cloud link in a private cloud.
Delete a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
| 0.800575 | 0.080141 |
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, script_package_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"scriptPackageName": _SERIALIZER.url(
"script_package_name", script_package_name, "str", pattern=r"^[-\w\._@]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
script_package_name: str,
script_cmdlet_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"scriptPackageName": _SERIALIZER.url(
"script_package_name", script_package_name, "str", pattern=r"^[-\w\._@]+$"
),
"scriptCmdletName": _SERIALIZER.url("script_cmdlet_name", script_cmdlet_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
class ScriptCmdletsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`script_cmdlets` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, script_package_name: str, **kwargs: Any
) -> Iterable["_models.ScriptCmdlet"]:
"""List script cmdlet resources available for a private cloud to create a script execution
resource on a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_package_name: Name of the script package in the private cloud. Required.
:type script_package_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScriptCmdlet or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ScriptCmdlet]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptCmdletsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_package_name=script_package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("ScriptCmdletsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets"
}
@distributed_trace
def get(
self,
resource_group_name: str,
private_cloud_name: str,
script_package_name: str,
script_cmdlet_name: str,
**kwargs: Any
) -> _models.ScriptCmdlet:
"""Return information about a script cmdlet resource in a specific package on a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_package_name: Name of the script package in the private cloud. Required.
:type script_package_name: str
:param script_cmdlet_name: Name of the script cmdlet resource in the script package in the
private cloud. Required.
:type script_cmdlet_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptCmdlet or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptCmdlet
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptCmdlet] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_package_name=script_package_name,
script_cmdlet_name=script_cmdlet_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptCmdlet", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_script_cmdlets_operations.py
|
_script_cmdlets_operations.py
|
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, script_package_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"scriptPackageName": _SERIALIZER.url(
"script_package_name", script_package_name, "str", pattern=r"^[-\w\._@]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
script_package_name: str,
script_cmdlet_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"scriptPackageName": _SERIALIZER.url(
"script_package_name", script_package_name, "str", pattern=r"^[-\w\._@]+$"
),
"scriptCmdletName": _SERIALIZER.url("script_cmdlet_name", script_cmdlet_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
class ScriptCmdletsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`script_cmdlets` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, script_package_name: str, **kwargs: Any
) -> Iterable["_models.ScriptCmdlet"]:
"""List script cmdlet resources available for a private cloud to create a script execution
resource on a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_package_name: Name of the script package in the private cloud. Required.
:type script_package_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScriptCmdlet or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ScriptCmdlet]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptCmdletsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_package_name=script_package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("ScriptCmdletsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets"
}
@distributed_trace
def get(
self,
resource_group_name: str,
private_cloud_name: str,
script_package_name: str,
script_cmdlet_name: str,
**kwargs: Any
) -> _models.ScriptCmdlet:
"""Return information about a script cmdlet resource in a specific package on a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_package_name: Name of the script package in the private cloud. Required.
:type script_package_name: str
:param script_cmdlet_name: Name of the script cmdlet resource in the script package in the
private cloud. Required.
:type script_cmdlet_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptCmdlet or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptCmdlet
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptCmdlet] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_package_name=script_package_name,
script_cmdlet_name=script_cmdlet_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptCmdlet", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}"
}
| 0.808899 | 0.088229 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, script_execution_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"scriptExecutionName": _SERIALIZER.url(
"script_execution_name", script_execution_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, private_cloud_name: str, script_execution_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"scriptExecutionName": _SERIALIZER.url(
"script_execution_name", script_execution_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, private_cloud_name: str, script_execution_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"scriptExecutionName": _SERIALIZER.url(
"script_execution_name", script_execution_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_execution_logs_request(
resource_group_name: str, private_cloud_name: str, script_execution_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"scriptExecutionName": _SERIALIZER.url(
"script_execution_name", script_execution_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
class ScriptExecutionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`script_executions` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.ScriptExecution"]:
"""List script executions in a private cloud.
List script executions in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScriptExecution or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptExecutionsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("ScriptExecutionsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any
) -> _models.ScriptExecution:
"""Get an script execution by name in a private cloud.
Get an script execution by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: Union[_models.ScriptExecution, IO],
**kwargs: Any
) -> _models.ScriptExecution:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(script_execution, (IOBase, bytes)):
_content = script_execution
else:
_json = self._serialize.body(script_execution, "ScriptExecution")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: _models.ScriptExecution,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ScriptExecution]:
"""Create or update a script execution in a private cloud.
Create or update a script execution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_execution: A script running in the private cloud. Required.
:type script_execution: ~azure.mgmt.avs.models.ScriptExecution
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ScriptExecution or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ScriptExecution]:
"""Create or update a script execution in a private cloud.
Create or update a script execution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_execution: A script running in the private cloud. Required.
:type script_execution: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ScriptExecution or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: Union[_models.ScriptExecution, IO],
**kwargs: Any
) -> LROPoller[_models.ScriptExecution]:
"""Create or update a script execution in a private cloud.
Create or update a script execution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_execution: A script running in the private cloud. Is either a ScriptExecution
type or a IO type. Required.
:type script_execution: ~azure.mgmt.avs.models.ScriptExecution or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ScriptExecution or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
script_execution=script_execution,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Cancel a ScriptExecution in a private cloud.
Cancel a ScriptExecution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
@overload
def get_execution_logs(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_output_stream_type: Optional[List[Union[str, _models.ScriptOutputStreamType]]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.ScriptExecution:
"""Return the logs for a script execution resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_output_stream_type: Name of the desired output stream to return. If not provided,
will return all. An empty array will return nothing. Default value is None.
:type script_output_stream_type: list[str or ~azure.mgmt.avs.models.ScriptOutputStreamType]
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def get_execution_logs(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_output_stream_type: Optional[IO] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.ScriptExecution:
"""Return the logs for a script execution resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_output_stream_type: Name of the desired output stream to return. If not provided,
will return all. An empty array will return nothing. Default value is None.
:type script_output_stream_type: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def get_execution_logs(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_output_stream_type: Optional[Union[List[Union[str, _models.ScriptOutputStreamType]], IO]] = None,
**kwargs: Any
) -> _models.ScriptExecution:
"""Return the logs for a script execution resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_output_stream_type: Name of the desired output stream to return. If not provided,
will return all. An empty array will return nothing. Is either a [Union[str,
"_models.ScriptOutputStreamType"]] type or a IO type. Default value is None.
:type script_output_stream_type: list[str or ~azure.mgmt.avs.models.ScriptOutputStreamType] or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(script_output_stream_type, (IOBase, bytes)):
_content = script_output_stream_type
else:
if script_output_stream_type is not None:
_json = self._serialize.body(script_output_stream_type, "[str]")
else:
_json = None
request = build_get_execution_logs_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.get_execution_logs.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_execution_logs.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_script_executions_operations.py
|
_script_executions_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, List, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, script_execution_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"scriptExecutionName": _SERIALIZER.url(
"script_execution_name", script_execution_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, private_cloud_name: str, script_execution_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"scriptExecutionName": _SERIALIZER.url(
"script_execution_name", script_execution_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, private_cloud_name: str, script_execution_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"scriptExecutionName": _SERIALIZER.url(
"script_execution_name", script_execution_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_execution_logs_request(
resource_group_name: str, private_cloud_name: str, script_execution_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"scriptExecutionName": _SERIALIZER.url(
"script_execution_name", script_execution_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
class ScriptExecutionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`script_executions` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.ScriptExecution"]:
"""List script executions in a private cloud.
List script executions in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScriptExecution or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptExecutionsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("ScriptExecutionsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any
) -> _models.ScriptExecution:
"""Get an script execution by name in a private cloud.
Get an script execution by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: Union[_models.ScriptExecution, IO],
**kwargs: Any
) -> _models.ScriptExecution:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(script_execution, (IOBase, bytes)):
_content = script_execution
else:
_json = self._serialize.body(script_execution, "ScriptExecution")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: _models.ScriptExecution,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ScriptExecution]:
"""Create or update a script execution in a private cloud.
Create or update a script execution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_execution: A script running in the private cloud. Required.
:type script_execution: ~azure.mgmt.avs.models.ScriptExecution
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ScriptExecution or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.ScriptExecution]:
"""Create or update a script execution in a private cloud.
Create or update a script execution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_execution: A script running in the private cloud. Required.
:type script_execution: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ScriptExecution or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: Union[_models.ScriptExecution, IO],
**kwargs: Any
) -> LROPoller[_models.ScriptExecution]:
"""Create or update a script execution in a private cloud.
Create or update a script execution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_execution: A script running in the private cloud. Is either a ScriptExecution
type or a IO type. Required.
:type script_execution: ~azure.mgmt.avs.models.ScriptExecution or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either ScriptExecution or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
script_execution=script_execution,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Cancel a ScriptExecution in a private cloud.
Cancel a ScriptExecution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
@overload
def get_execution_logs(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_output_stream_type: Optional[List[Union[str, _models.ScriptOutputStreamType]]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.ScriptExecution:
"""Return the logs for a script execution resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_output_stream_type: Name of the desired output stream to return. If not provided,
will return all. An empty array will return nothing. Default value is None.
:type script_output_stream_type: list[str or ~azure.mgmt.avs.models.ScriptOutputStreamType]
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def get_execution_logs(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_output_stream_type: Optional[IO] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.ScriptExecution:
"""Return the logs for a script execution resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_output_stream_type: Name of the desired output stream to return. If not provided,
will return all. An empty array will return nothing. Default value is None.
:type script_output_stream_type: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def get_execution_logs(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_output_stream_type: Optional[Union[List[Union[str, _models.ScriptOutputStreamType]], IO]] = None,
**kwargs: Any
) -> _models.ScriptExecution:
"""Return the logs for a script execution resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_output_stream_type: Name of the desired output stream to return. If not provided,
will return all. An empty array will return nothing. Is either a [Union[str,
"_models.ScriptOutputStreamType"]] type or a IO type. Default value is None.
:type script_output_stream_type: list[str or ~azure.mgmt.avs.models.ScriptOutputStreamType] or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(script_output_stream_type, (IOBase, bytes)):
_content = script_output_stream_type
else:
if script_output_stream_type is not None:
_json = self._serialize.body(script_output_stream_type, "[str]")
else:
_json = None
request = build_get_execution_logs_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.get_execution_logs.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_execution_logs.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs"
}
| 0.780035 | 0.07383 |
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, script_package_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"scriptPackageName": _SERIALIZER.url(
"script_package_name", script_package_name, "str", pattern=r"^[-\w\._@]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
class ScriptPackagesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`script_packages` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.ScriptPackage"]:
"""List script packages available to run on the private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScriptPackage or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ScriptPackage]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptPackagesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("ScriptPackagesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, script_package_name: str, **kwargs: Any
) -> _models.ScriptPackage:
"""Get a script package available to run on a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_package_name: Name of the script package in the private cloud. Required.
:type script_package_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptPackage or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptPackage
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptPackage] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_package_name=script_package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptPackage", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_script_packages_operations.py
|
_script_packages_operations.py
|
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, script_package_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"scriptPackageName": _SERIALIZER.url(
"script_package_name", script_package_name, "str", pattern=r"^[-\w\._@]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
class ScriptPackagesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`script_packages` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.ScriptPackage"]:
"""List script packages available to run on the private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScriptPackage or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.ScriptPackage]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptPackagesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("ScriptPackagesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, script_package_name: str, **kwargs: Any
) -> _models.ScriptPackage:
"""Get a script package available to run on a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_package_name: Name of the script package in the private cloud. Required.
:type script_package_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptPackage or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptPackage
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptPackage] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_package_name=script_package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptPackage", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}"
}
| 0.837221 | 0.083329 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
workload_network_name: Union[str, _models.WorkloadNetworkName],
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/{workloadNetworkName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"workloadNetworkName": _SERIALIZER.url("workload_network_name", workload_network_name, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_segments_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_segment_request(
resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"segmentId": _SERIALIZER.url("segment_id", segment_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_segments_request(
resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"segmentId": _SERIALIZER.url("segment_id", segment_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_segments_request(
resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"segmentId": _SERIALIZER.url("segment_id", segment_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_segment_request(
resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"segmentId": _SERIALIZER.url("segment_id", segment_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_dhcp_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_dhcp_request(
resource_group_name: str, dhcp_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str"),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_dhcp_request(
resource_group_name: str, private_cloud_name: str, dhcp_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_dhcp_request(
resource_group_name: str, private_cloud_name: str, dhcp_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_dhcp_request(
resource_group_name: str, private_cloud_name: str, dhcp_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_gateways_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_gateway_request(
resource_group_name: str, private_cloud_name: str, gateway_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_port_mirroring_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_port_mirroring_request(
resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_port_mirroring_request(
resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_port_mirroring_request(
resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_port_mirroring_request(
resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str"),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_vm_groups_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_vm_group_request(
resource_group_name: str, private_cloud_name: str, vm_group_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_vm_group_request(
resource_group_name: str, private_cloud_name: str, vm_group_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_vm_group_request(
resource_group_name: str, private_cloud_name: str, vm_group_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_vm_group_request(
resource_group_name: str, vm_group_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str"),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_virtual_machines_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_virtual_machine_request(
resource_group_name: str, private_cloud_name: str, virtual_machine_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_dns_services_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_dns_service_request(
resource_group_name: str, private_cloud_name: str, dns_service_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_dns_service_request(
resource_group_name: str, private_cloud_name: str, dns_service_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_dns_service_request(
resource_group_name: str, private_cloud_name: str, dns_service_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_dns_service_request(
resource_group_name: str, dns_service_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str"),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_dns_zones_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_dns_zone_request(
resource_group_name: str, private_cloud_name: str, dns_zone_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_dns_zone_request(
resource_group_name: str, private_cloud_name: str, dns_zone_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_dns_zone_request(
resource_group_name: str, private_cloud_name: str, dns_zone_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_dns_zone_request(
resource_group_name: str, dns_zone_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str"),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_public_i_ps_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_public_ip_request(
resource_group_name: str, private_cloud_name: str, public_ip_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_public_ip_request(
resource_group_name: str, private_cloud_name: str, public_ip_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_public_ip_request(
resource_group_name: str, public_ip_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, "str"),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class WorkloadNetworksOperations: # pylint: disable=too-many-public-methods
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`workload_networks` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def get(
self,
resource_group_name: str,
private_cloud_name: str,
workload_network_name: Union[str, _models.WorkloadNetworkName],
**kwargs: Any
) -> _models.WorkloadNetwork:
"""Get a private cloud workload network.
Get a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param workload_network_name: Name for the workload network in the private cloud. "default"
Required.
:type workload_network_name: str or ~azure.mgmt.avs.models.WorkloadNetworkName
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetwork or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetwork
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetwork] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
workload_network_name=workload_network_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetwork", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/{workloadNetworkName}"
}
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetwork"]:
"""List of workload networks in a private cloud.
List of workload networks in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetwork or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetwork]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks"
}
@distributed_trace
def list_segments(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkSegment"]:
"""List of segments in a private cloud workload network.
List of segments in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkSegmentsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_segments_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_segments.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkSegmentsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_segments.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments"
}
@distributed_trace
def get_segment(
self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any
) -> _models.WorkloadNetworkSegment:
"""Get a segment by id in a private cloud workload network.
Get a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkSegment or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkSegment
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
request = build_get_segment_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_segment.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_segment.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
def _create_segments_initial(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> _models.WorkloadNetworkSegment:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_segment, (IOBase, bytes)):
_content = workload_network_segment
else:
_json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment")
request = build_create_segments_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_segments_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_segments_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@overload
def begin_create_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: _models.WorkloadNetworkSegment,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkSegment]:
"""Create a segment by id in a private cloud workload network.
Create a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkSegment]:
"""Create a segment by id in a private cloud workload network.
Create a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkSegment]:
"""Create a segment by id in a private cloud workload network.
Create a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Is either a WorkloadNetworkSegment type or a IO
type. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_segments_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
workload_network_segment=workload_network_segment,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_segments.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
def _update_segments_initial(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkSegment]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkSegment]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_segment, (IOBase, bytes)):
_content = workload_network_segment
else:
_json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment")
request = build_update_segments_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_segments_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_segments_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@overload
def begin_update_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: _models.WorkloadNetworkSegment,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkSegment]:
"""Create or update a segment by id in a private cloud workload network.
Create or update a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkSegment]:
"""Create or update a segment by id in a private cloud workload network.
Create or update a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkSegment]:
"""Create or update a segment by id in a private cloud workload network.
Create or update a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Is either a WorkloadNetworkSegment type or a IO
type. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_segments_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
workload_network_segment=workload_network_segment,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_segments.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
def _delete_segment_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_segment_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_segment_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_segment_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@distributed_trace
def begin_delete_segment(
self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a segment by id in a private cloud workload network.
Delete a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_segment_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_segment.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@distributed_trace
def list_dhcp(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkDhcp"]:
"""List dhcp in a private cloud workload network.
List dhcp in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkDhcp or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDhcpList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_dhcp.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDhcpList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations"
}
@distributed_trace
def get_dhcp(
self, resource_group_name: str, dhcp_id: str, private_cloud_name: str, **kwargs: Any
) -> _models.WorkloadNetworkDhcp:
"""Get dhcp by id in a private cloud workload network.
Get dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkDhcp or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkDhcp
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
request = build_get_dhcp_request(
resource_group_name=resource_group_name,
dhcp_id=dhcp_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_dhcp.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
def _create_dhcp_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> _models.WorkloadNetworkDhcp:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dhcp, (IOBase, bytes)):
_content = workload_network_dhcp
else:
_json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp")
request = build_create_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_dhcp_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_dhcp_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@overload
def begin_create_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: _models.WorkloadNetworkDhcp,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDhcp]:
"""Create dhcp by id in a private cloud workload network.
Create dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDhcp]:
"""Create dhcp by id in a private cloud workload network.
Create dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDhcp]:
"""Create dhcp by id in a private cloud workload network.
Create dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Is either a WorkloadNetworkDhcp type or a IO type.
Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_dhcp_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
workload_network_dhcp=workload_network_dhcp,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
def _update_dhcp_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkDhcp]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkDhcp]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dhcp, (IOBase, bytes)):
_content = workload_network_dhcp
else:
_json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp")
request = build_update_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_dhcp_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_dhcp_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@overload
def begin_update_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: _models.WorkloadNetworkDhcp,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDhcp]:
"""Create or update dhcp by id in a private cloud workload network.
Create or update dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDhcp]:
"""Create or update dhcp by id in a private cloud workload network.
Create or update dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDhcp]:
"""Create or update dhcp by id in a private cloud workload network.
Create or update dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Is either a WorkloadNetworkDhcp type or a IO type.
Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_dhcp_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
workload_network_dhcp=workload_network_dhcp,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
def _delete_dhcp_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_dhcp_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_dhcp_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@distributed_trace
def begin_delete_dhcp(
self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete dhcp by id in a private cloud workload network.
Delete dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_dhcp_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@distributed_trace
def list_gateways(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkGateway"]:
"""List of gateways in a private cloud workload network.
List of gateways in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkGateway or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkGateway]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkGatewayList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_gateways_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_gateways.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkGatewayList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_gateways.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways"
}
@distributed_trace
def get_gateway(
self, resource_group_name: str, private_cloud_name: str, gateway_id: str, **kwargs: Any
) -> _models.WorkloadNetworkGateway:
"""Get a gateway by id in a private cloud workload network.
Get a gateway by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param gateway_id: NSX Gateway identifier. Generally the same as the Gateway's display name.
Required.
:type gateway_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkGateway or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkGateway
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkGateway] = kwargs.pop("cls", None)
request = build_get_gateway_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
gateway_id=gateway_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_gateway.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkGateway", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_gateway.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}"
}
@distributed_trace
def list_port_mirroring(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkPortMirroring"]:
"""List of port mirroring profiles in a private cloud workload network.
List of port mirroring profiles in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkPortMirroring or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPortMirroringList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_port_mirroring.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPortMirroringList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles"
}
@distributed_trace
def get_port_mirroring(
self, resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, **kwargs: Any
) -> _models.WorkloadNetworkPortMirroring:
"""Get a port mirroring profile by id in a private cloud workload network.
Get a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkPortMirroring or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
request = build_get_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_port_mirroring.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
def _create_port_mirroring_initial(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> _models.WorkloadNetworkPortMirroring:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_port_mirroring, (IOBase, bytes)):
_content = workload_network_port_mirroring
else:
_json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring")
request = build_create_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_port_mirroring_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_port_mirroring_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@overload
def begin_create_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create a port mirroring profile by id in a private cloud workload network.
Create a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create a port mirroring profile by id in a private cloud workload network.
Create a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create a port mirroring profile by id in a private cloud workload network.
Create a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Is either a
WorkloadNetworkPortMirroring type or a IO type. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_port_mirroring_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
workload_network_port_mirroring=workload_network_port_mirroring,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
def _update_port_mirroring_initial(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkPortMirroring]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkPortMirroring]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_port_mirroring, (IOBase, bytes)):
_content = workload_network_port_mirroring
else:
_json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring")
request = build_update_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_port_mirroring_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_port_mirroring_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@overload
def begin_update_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create or update a port mirroring profile by id in a private cloud workload network.
Create or update a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create or update a port mirroring profile by id in a private cloud workload network.
Create or update a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create or update a port mirroring profile by id in a private cloud workload network.
Create or update a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Is either a
WorkloadNetworkPortMirroring type or a IO type. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_port_mirroring_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
workload_network_port_mirroring=workload_network_port_mirroring,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
def _delete_port_mirroring_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_port_mirroring_request(
resource_group_name=resource_group_name,
port_mirroring_id=port_mirroring_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_port_mirroring_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_port_mirroring_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@distributed_trace
def begin_delete_port_mirroring(
self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a port mirroring profile by id in a private cloud workload network.
Delete a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_port_mirroring_initial( # type: ignore
resource_group_name=resource_group_name,
port_mirroring_id=port_mirroring_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@distributed_trace
def list_vm_groups(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkVMGroup"]:
"""List of vm groups in a private cloud workload network.
List of vm groups in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVMGroupsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_vm_groups_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_vm_groups.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVMGroupsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_vm_groups.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups"
}
@distributed_trace
def get_vm_group(
self, resource_group_name: str, private_cloud_name: str, vm_group_id: str, **kwargs: Any
) -> _models.WorkloadNetworkVMGroup:
"""Get a vm group by id in a private cloud workload network.
Get a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkVMGroup or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
request = build_get_vm_group_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_vm_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
def _create_vm_group_initial(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> _models.WorkloadNetworkVMGroup:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_vm_group, (IOBase, bytes)):
_content = workload_network_vm_group
else:
_json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup")
request = build_create_vm_group_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_vm_group_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_vm_group_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@overload
def begin_create_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: _models.WorkloadNetworkVMGroup,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkVMGroup]:
"""Create a vm group by id in a private cloud workload network.
Create a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkVMGroup]:
"""Create a vm group by id in a private cloud workload network.
Create a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkVMGroup]:
"""Create a vm group by id in a private cloud workload network.
Create a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Is either a WorkloadNetworkVMGroup type or a IO
type. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_vm_group_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
workload_network_vm_group=workload_network_vm_group,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
def _update_vm_group_initial(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkVMGroup]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkVMGroup]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_vm_group, (IOBase, bytes)):
_content = workload_network_vm_group
else:
_json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup")
request = build_update_vm_group_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_vm_group_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_vm_group_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@overload
def begin_update_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: _models.WorkloadNetworkVMGroup,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkVMGroup]:
"""Create or update a vm group by id in a private cloud workload network.
Create or update a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkVMGroup]:
"""Create or update a vm group by id in a private cloud workload network.
Create or update a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkVMGroup]:
"""Create or update a vm group by id in a private cloud workload network.
Create or update a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Is either a WorkloadNetworkVMGroup type or a IO
type. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_vm_group_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
workload_network_vm_group=workload_network_vm_group,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
def _delete_vm_group_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_vm_group_request(
resource_group_name=resource_group_name,
vm_group_id=vm_group_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_vm_group_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_vm_group_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@distributed_trace
def begin_delete_vm_group(
self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a vm group by id in a private cloud workload network.
Delete a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_vm_group_initial( # type: ignore
resource_group_name=resource_group_name,
vm_group_id=vm_group_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@distributed_trace
def list_virtual_machines(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkVirtualMachine"]:
"""List of virtual machines in a private cloud workload network.
List of virtual machines in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkVirtualMachine or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVirtualMachinesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_virtual_machines_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_virtual_machines.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVirtualMachinesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_virtual_machines.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines"
}
@distributed_trace
def get_virtual_machine(
self, resource_group_name: str, private_cloud_name: str, virtual_machine_id: str, **kwargs: Any
) -> _models.WorkloadNetworkVirtualMachine:
"""Get a virtual machine by id in a private cloud workload network.
Get a virtual machine by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkVirtualMachine or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVirtualMachine] = kwargs.pop("cls", None)
request = build_get_virtual_machine_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
virtual_machine_id=virtual_machine_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_virtual_machine.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkVirtualMachine", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_virtual_machine.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}"
}
@distributed_trace
def list_dns_services(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkDnsService"]:
"""List of DNS services in a private cloud workload network.
List of DNS services in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkDnsService or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsServicesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_dns_services_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_dns_services.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsServicesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_dns_services.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices"
}
@distributed_trace
def get_dns_service(
self, resource_group_name: str, private_cloud_name: str, dns_service_id: str, **kwargs: Any
) -> _models.WorkloadNetworkDnsService:
"""Get a DNS service by id in a private cloud workload network.
Get a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkDnsService or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsService
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
request = build_get_dns_service_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_dns_service.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
def _create_dns_service_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> _models.WorkloadNetworkDnsService:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_service, (IOBase, bytes)):
_content = workload_network_dns_service
else:
_json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService")
request = build_create_dns_service_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_dns_service_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_dns_service_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@overload
def begin_create_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: _models.WorkloadNetworkDnsService,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsService]:
"""Create a DNS service by id in a private cloud workload network.
Create a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsService]:
"""Create a DNS service by id in a private cloud workload network.
Create a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsService]:
"""Create a DNS service by id in a private cloud workload network.
Create a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Is either a WorkloadNetworkDnsService
type or a IO type. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_dns_service_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
workload_network_dns_service=workload_network_dns_service,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
def _update_dns_service_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkDnsService]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkDnsService]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_service, (IOBase, bytes)):
_content = workload_network_dns_service
else:
_json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService")
request = build_update_dns_service_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_dns_service_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_dns_service_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@overload
def begin_update_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: _models.WorkloadNetworkDnsService,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsService]:
"""Create or update a DNS service by id in a private cloud workload network.
Create or update a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsService]:
"""Create or update a DNS service by id in a private cloud workload network.
Create or update a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsService]:
"""Create or update a DNS service by id in a private cloud workload network.
Create or update a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Is either a WorkloadNetworkDnsService
type or a IO type. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_dns_service_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
workload_network_dns_service=workload_network_dns_service,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
def _delete_dns_service_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_dns_service_request(
resource_group_name=resource_group_name,
dns_service_id=dns_service_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_dns_service_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_dns_service_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@distributed_trace
def begin_delete_dns_service(
self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a DNS service by id in a private cloud workload network.
Delete a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_dns_service_initial( # type: ignore
resource_group_name=resource_group_name,
dns_service_id=dns_service_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@distributed_trace
def list_dns_zones(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkDnsZone"]:
"""List of DNS zones in a private cloud workload network.
List of DNS zones in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsZonesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_dns_zones_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_dns_zones.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsZonesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_dns_zones.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones"
}
@distributed_trace
def get_dns_zone(
self, resource_group_name: str, private_cloud_name: str, dns_zone_id: str, **kwargs: Any
) -> _models.WorkloadNetworkDnsZone:
"""Get a DNS zone by id in a private cloud workload network.
Get a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkDnsZone or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
request = build_get_dns_zone_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_dns_zone.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
def _create_dns_zone_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> _models.WorkloadNetworkDnsZone:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_zone, (IOBase, bytes)):
_content = workload_network_dns_zone
else:
_json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone")
request = build_create_dns_zone_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_dns_zone_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_dns_zone_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@overload
def begin_create_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: _models.WorkloadNetworkDnsZone,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsZone]:
"""Create a DNS zone by id in a private cloud workload network.
Create a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsZone]:
"""Create a DNS zone by id in a private cloud workload network.
Create a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsZone]:
"""Create a DNS zone by id in a private cloud workload network.
Create a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Is either a WorkloadNetworkDnsZone type or a IO
type. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_dns_zone_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
workload_network_dns_zone=workload_network_dns_zone,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
def _update_dns_zone_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkDnsZone]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkDnsZone]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_zone, (IOBase, bytes)):
_content = workload_network_dns_zone
else:
_json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone")
request = build_update_dns_zone_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_dns_zone_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_dns_zone_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@overload
def begin_update_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: _models.WorkloadNetworkDnsZone,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsZone]:
"""Create or update a DNS zone by id in a private cloud workload network.
Create or update a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsZone]:
"""Create or update a DNS zone by id in a private cloud workload network.
Create or update a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsZone]:
"""Create or update a DNS zone by id in a private cloud workload network.
Create or update a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Is either a WorkloadNetworkDnsZone type or a IO
type. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_dns_zone_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
workload_network_dns_zone=workload_network_dns_zone,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
def _delete_dns_zone_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_dns_zone_request(
resource_group_name=resource_group_name,
dns_zone_id=dns_zone_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_dns_zone_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_dns_zone_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@distributed_trace
def begin_delete_dns_zone(
self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a DNS zone by id in a private cloud workload network.
Delete a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_dns_zone_initial( # type: ignore
resource_group_name=resource_group_name,
dns_zone_id=dns_zone_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@distributed_trace
def list_public_i_ps(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkPublicIP"]:
"""List of Public IP Blocks in a private cloud workload network.
List of Public IP Blocks in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkPublicIP or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPublicIPsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_public_i_ps_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_public_i_ps.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPublicIPsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_public_i_ps.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs"
}
@distributed_trace
def get_public_ip(
self, resource_group_name: str, private_cloud_name: str, public_ip_id: str, **kwargs: Any
) -> _models.WorkloadNetworkPublicIP:
"""Get a Public IP Block by id in a private cloud workload network.
Get a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkPublicIP or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None)
request = build_get_public_ip_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
public_ip_id=public_ip_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_public_ip.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_public_ip.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
def _create_public_ip_initial(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO],
**kwargs: Any
) -> _models.WorkloadNetworkPublicIP:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_public_ip, (IOBase, bytes)):
_content = workload_network_public_ip
else:
_json = self._serialize.body(workload_network_public_ip, "WorkloadNetworkPublicIP")
request = build_create_public_ip_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
public_ip_id=public_ip_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_public_ip_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_public_ip_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
@overload
def begin_create_public_ip(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: _models.WorkloadNetworkPublicIP,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPublicIP]:
"""Create a Public IP Block by id in a private cloud workload network.
Create a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param workload_network_public_ip: NSX Public IP Block. Required.
:type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPublicIP or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_public_ip(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPublicIP]:
"""Create a Public IP Block by id in a private cloud workload network.
Create a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param workload_network_public_ip: NSX Public IP Block. Required.
:type workload_network_public_ip: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPublicIP or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_public_ip(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPublicIP]:
"""Create a Public IP Block by id in a private cloud workload network.
Create a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param workload_network_public_ip: NSX Public IP Block. Is either a WorkloadNetworkPublicIP
type or a IO type. Required.
:type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPublicIP or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_public_ip_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
public_ip_id=public_ip_id,
workload_network_public_ip=workload_network_public_ip,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_public_ip.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
def _delete_public_ip_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_public_ip_request(
resource_group_name=resource_group_name,
public_ip_id=public_ip_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_public_ip_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_public_ip_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
@distributed_trace
def begin_delete_public_ip(
self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a Public IP Block by id in a private cloud workload network.
Delete a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_public_ip_initial( # type: ignore
resource_group_name=resource_group_name,
public_ip_id=public_ip_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_public_ip.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_workload_networks_operations.py
|
_workload_networks_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
workload_network_name: Union[str, _models.WorkloadNetworkName],
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/{workloadNetworkName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"workloadNetworkName": _SERIALIZER.url("workload_network_name", workload_network_name, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_segments_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_segment_request(
resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"segmentId": _SERIALIZER.url("segment_id", segment_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_segments_request(
resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"segmentId": _SERIALIZER.url("segment_id", segment_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_segments_request(
resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"segmentId": _SERIALIZER.url("segment_id", segment_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_segment_request(
resource_group_name: str, private_cloud_name: str, segment_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"segmentId": _SERIALIZER.url("segment_id", segment_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_dhcp_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_dhcp_request(
resource_group_name: str, dhcp_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str"),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_dhcp_request(
resource_group_name: str, private_cloud_name: str, dhcp_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_dhcp_request(
resource_group_name: str, private_cloud_name: str, dhcp_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_dhcp_request(
resource_group_name: str, private_cloud_name: str, dhcp_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dhcpId": _SERIALIZER.url("dhcp_id", dhcp_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_gateways_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_gateway_request(
resource_group_name: str, private_cloud_name: str, gateway_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"gatewayId": _SERIALIZER.url("gateway_id", gateway_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_port_mirroring_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_port_mirroring_request(
resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_port_mirroring_request(
resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_port_mirroring_request(
resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_port_mirroring_request(
resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"portMirroringId": _SERIALIZER.url("port_mirroring_id", port_mirroring_id, "str"),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_vm_groups_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_vm_group_request(
resource_group_name: str, private_cloud_name: str, vm_group_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_vm_group_request(
resource_group_name: str, private_cloud_name: str, vm_group_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_vm_group_request(
resource_group_name: str, private_cloud_name: str, vm_group_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_vm_group_request(
resource_group_name: str, vm_group_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"vmGroupId": _SERIALIZER.url("vm_group_id", vm_group_id, "str"),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_virtual_machines_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_virtual_machine_request(
resource_group_name: str, private_cloud_name: str, virtual_machine_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_dns_services_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_dns_service_request(
resource_group_name: str, private_cloud_name: str, dns_service_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_dns_service_request(
resource_group_name: str, private_cloud_name: str, dns_service_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_dns_service_request(
resource_group_name: str, private_cloud_name: str, dns_service_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_dns_service_request(
resource_group_name: str, dns_service_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"dnsServiceId": _SERIALIZER.url("dns_service_id", dns_service_id, "str"),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_dns_zones_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_dns_zone_request(
resource_group_name: str, private_cloud_name: str, dns_zone_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_dns_zone_request(
resource_group_name: str, private_cloud_name: str, dns_zone_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_dns_zone_request(
resource_group_name: str, private_cloud_name: str, dns_zone_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_dns_zone_request(
resource_group_name: str, dns_zone_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"dnsZoneId": _SERIALIZER.url("dns_zone_id", dns_zone_id, "str"),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_public_i_ps_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_public_ip_request(
resource_group_name: str, private_cloud_name: str, public_ip_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_public_ip_request(
resource_group_name: str, private_cloud_name: str, public_ip_id: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_public_ip_request(
resource_group_name: str, public_ip_id: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"publicIPId": _SERIALIZER.url("public_ip_id", public_ip_id, "str"),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class WorkloadNetworksOperations: # pylint: disable=too-many-public-methods
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`workload_networks` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def get(
self,
resource_group_name: str,
private_cloud_name: str,
workload_network_name: Union[str, _models.WorkloadNetworkName],
**kwargs: Any
) -> _models.WorkloadNetwork:
"""Get a private cloud workload network.
Get a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param workload_network_name: Name for the workload network in the private cloud. "default"
Required.
:type workload_network_name: str or ~azure.mgmt.avs.models.WorkloadNetworkName
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetwork or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetwork
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetwork] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
workload_network_name=workload_network_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetwork", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/{workloadNetworkName}"
}
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetwork"]:
"""List of workload networks in a private cloud.
List of workload networks in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetwork or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetwork]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks"
}
@distributed_trace
def list_segments(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkSegment"]:
"""List of segments in a private cloud workload network.
List of segments in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkSegmentsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_segments_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_segments.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkSegmentsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_segments.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments"
}
@distributed_trace
def get_segment(
self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any
) -> _models.WorkloadNetworkSegment:
"""Get a segment by id in a private cloud workload network.
Get a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkSegment or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkSegment
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
request = build_get_segment_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_segment.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_segment.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
def _create_segments_initial(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> _models.WorkloadNetworkSegment:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_segment, (IOBase, bytes)):
_content = workload_network_segment
else:
_json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment")
request = build_create_segments_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_segments_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_segments_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@overload
def begin_create_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: _models.WorkloadNetworkSegment,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkSegment]:
"""Create a segment by id in a private cloud workload network.
Create a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkSegment]:
"""Create a segment by id in a private cloud workload network.
Create a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkSegment]:
"""Create a segment by id in a private cloud workload network.
Create a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Is either a WorkloadNetworkSegment type or a IO
type. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_segments_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
workload_network_segment=workload_network_segment,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_segments.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
def _update_segments_initial(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkSegment]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkSegment]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_segment, (IOBase, bytes)):
_content = workload_network_segment
else:
_json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment")
request = build_update_segments_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_segments_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_segments_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@overload
def begin_update_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: _models.WorkloadNetworkSegment,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkSegment]:
"""Create or update a segment by id in a private cloud workload network.
Create or update a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkSegment]:
"""Create or update a segment by id in a private cloud workload network.
Create or update a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkSegment]:
"""Create or update a segment by id in a private cloud workload network.
Create or update a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Is either a WorkloadNetworkSegment type or a IO
type. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_segments_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
workload_network_segment=workload_network_segment,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_segments.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
def _delete_segment_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_segment_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_segment_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_segment_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@distributed_trace
def begin_delete_segment(
self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a segment by id in a private cloud workload network.
Delete a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_segment_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_segment.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@distributed_trace
def list_dhcp(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkDhcp"]:
"""List dhcp in a private cloud workload network.
List dhcp in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkDhcp or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDhcpList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_dhcp.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDhcpList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations"
}
@distributed_trace
def get_dhcp(
self, resource_group_name: str, dhcp_id: str, private_cloud_name: str, **kwargs: Any
) -> _models.WorkloadNetworkDhcp:
"""Get dhcp by id in a private cloud workload network.
Get dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkDhcp or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkDhcp
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
request = build_get_dhcp_request(
resource_group_name=resource_group_name,
dhcp_id=dhcp_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_dhcp.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
def _create_dhcp_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> _models.WorkloadNetworkDhcp:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dhcp, (IOBase, bytes)):
_content = workload_network_dhcp
else:
_json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp")
request = build_create_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_dhcp_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_dhcp_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@overload
def begin_create_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: _models.WorkloadNetworkDhcp,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDhcp]:
"""Create dhcp by id in a private cloud workload network.
Create dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDhcp]:
"""Create dhcp by id in a private cloud workload network.
Create dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDhcp]:
"""Create dhcp by id in a private cloud workload network.
Create dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Is either a WorkloadNetworkDhcp type or a IO type.
Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_dhcp_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
workload_network_dhcp=workload_network_dhcp,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
def _update_dhcp_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkDhcp]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkDhcp]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dhcp, (IOBase, bytes)):
_content = workload_network_dhcp
else:
_json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp")
request = build_update_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_dhcp_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_dhcp_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@overload
def begin_update_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: _models.WorkloadNetworkDhcp,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDhcp]:
"""Create or update dhcp by id in a private cloud workload network.
Create or update dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDhcp]:
"""Create or update dhcp by id in a private cloud workload network.
Create or update dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDhcp]:
"""Create or update dhcp by id in a private cloud workload network.
Create or update dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Is either a WorkloadNetworkDhcp type or a IO type.
Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_dhcp_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
workload_network_dhcp=workload_network_dhcp,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
def _delete_dhcp_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_dhcp_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_dhcp_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@distributed_trace
def begin_delete_dhcp(
self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete dhcp by id in a private cloud workload network.
Delete dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_dhcp_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@distributed_trace
def list_gateways(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkGateway"]:
"""List of gateways in a private cloud workload network.
List of gateways in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkGateway or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkGateway]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkGatewayList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_gateways_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_gateways.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkGatewayList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_gateways.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways"
}
@distributed_trace
def get_gateway(
self, resource_group_name: str, private_cloud_name: str, gateway_id: str, **kwargs: Any
) -> _models.WorkloadNetworkGateway:
"""Get a gateway by id in a private cloud workload network.
Get a gateway by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param gateway_id: NSX Gateway identifier. Generally the same as the Gateway's display name.
Required.
:type gateway_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkGateway or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkGateway
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkGateway] = kwargs.pop("cls", None)
request = build_get_gateway_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
gateway_id=gateway_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_gateway.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkGateway", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_gateway.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}"
}
@distributed_trace
def list_port_mirroring(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkPortMirroring"]:
"""List of port mirroring profiles in a private cloud workload network.
List of port mirroring profiles in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkPortMirroring or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPortMirroringList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_port_mirroring.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPortMirroringList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles"
}
@distributed_trace
def get_port_mirroring(
self, resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, **kwargs: Any
) -> _models.WorkloadNetworkPortMirroring:
"""Get a port mirroring profile by id in a private cloud workload network.
Get a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkPortMirroring or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
request = build_get_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_port_mirroring.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
def _create_port_mirroring_initial(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> _models.WorkloadNetworkPortMirroring:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_port_mirroring, (IOBase, bytes)):
_content = workload_network_port_mirroring
else:
_json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring")
request = build_create_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_port_mirroring_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_port_mirroring_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@overload
def begin_create_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create a port mirroring profile by id in a private cloud workload network.
Create a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create a port mirroring profile by id in a private cloud workload network.
Create a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create a port mirroring profile by id in a private cloud workload network.
Create a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Is either a
WorkloadNetworkPortMirroring type or a IO type. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_port_mirroring_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
workload_network_port_mirroring=workload_network_port_mirroring,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
def _update_port_mirroring_initial(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkPortMirroring]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkPortMirroring]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_port_mirroring, (IOBase, bytes)):
_content = workload_network_port_mirroring
else:
_json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring")
request = build_update_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_port_mirroring_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_port_mirroring_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@overload
def begin_update_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create or update a port mirroring profile by id in a private cloud workload network.
Create or update a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create or update a port mirroring profile by id in a private cloud workload network.
Create or update a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create or update a port mirroring profile by id in a private cloud workload network.
Create or update a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Is either a
WorkloadNetworkPortMirroring type or a IO type. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_port_mirroring_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
workload_network_port_mirroring=workload_network_port_mirroring,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
def _delete_port_mirroring_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_port_mirroring_request(
resource_group_name=resource_group_name,
port_mirroring_id=port_mirroring_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_port_mirroring_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_port_mirroring_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@distributed_trace
def begin_delete_port_mirroring(
self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a port mirroring profile by id in a private cloud workload network.
Delete a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_port_mirroring_initial( # type: ignore
resource_group_name=resource_group_name,
port_mirroring_id=port_mirroring_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@distributed_trace
def list_vm_groups(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkVMGroup"]:
"""List of vm groups in a private cloud workload network.
List of vm groups in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVMGroupsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_vm_groups_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_vm_groups.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVMGroupsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_vm_groups.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups"
}
@distributed_trace
def get_vm_group(
self, resource_group_name: str, private_cloud_name: str, vm_group_id: str, **kwargs: Any
) -> _models.WorkloadNetworkVMGroup:
"""Get a vm group by id in a private cloud workload network.
Get a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkVMGroup or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
request = build_get_vm_group_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_vm_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
def _create_vm_group_initial(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> _models.WorkloadNetworkVMGroup:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_vm_group, (IOBase, bytes)):
_content = workload_network_vm_group
else:
_json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup")
request = build_create_vm_group_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_vm_group_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_vm_group_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@overload
def begin_create_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: _models.WorkloadNetworkVMGroup,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkVMGroup]:
"""Create a vm group by id in a private cloud workload network.
Create a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkVMGroup]:
"""Create a vm group by id in a private cloud workload network.
Create a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkVMGroup]:
"""Create a vm group by id in a private cloud workload network.
Create a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Is either a WorkloadNetworkVMGroup type or a IO
type. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_vm_group_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
workload_network_vm_group=workload_network_vm_group,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
def _update_vm_group_initial(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkVMGroup]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkVMGroup]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_vm_group, (IOBase, bytes)):
_content = workload_network_vm_group
else:
_json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup")
request = build_update_vm_group_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_vm_group_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_vm_group_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@overload
def begin_update_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: _models.WorkloadNetworkVMGroup,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkVMGroup]:
"""Create or update a vm group by id in a private cloud workload network.
Create or update a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkVMGroup]:
"""Create or update a vm group by id in a private cloud workload network.
Create or update a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkVMGroup]:
"""Create or update a vm group by id in a private cloud workload network.
Create or update a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Is either a WorkloadNetworkVMGroup type or a IO
type. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_vm_group_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
workload_network_vm_group=workload_network_vm_group,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
def _delete_vm_group_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_vm_group_request(
resource_group_name=resource_group_name,
vm_group_id=vm_group_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_vm_group_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_vm_group_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@distributed_trace
def begin_delete_vm_group(
self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a vm group by id in a private cloud workload network.
Delete a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_vm_group_initial( # type: ignore
resource_group_name=resource_group_name,
vm_group_id=vm_group_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@distributed_trace
def list_virtual_machines(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkVirtualMachine"]:
"""List of virtual machines in a private cloud workload network.
List of virtual machines in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkVirtualMachine or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVirtualMachinesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_virtual_machines_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_virtual_machines.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVirtualMachinesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_virtual_machines.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines"
}
@distributed_trace
def get_virtual_machine(
self, resource_group_name: str, private_cloud_name: str, virtual_machine_id: str, **kwargs: Any
) -> _models.WorkloadNetworkVirtualMachine:
"""Get a virtual machine by id in a private cloud workload network.
Get a virtual machine by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkVirtualMachine or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVirtualMachine] = kwargs.pop("cls", None)
request = build_get_virtual_machine_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
virtual_machine_id=virtual_machine_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_virtual_machine.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkVirtualMachine", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_virtual_machine.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}"
}
@distributed_trace
def list_dns_services(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkDnsService"]:
"""List of DNS services in a private cloud workload network.
List of DNS services in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkDnsService or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsServicesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_dns_services_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_dns_services.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsServicesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_dns_services.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices"
}
@distributed_trace
def get_dns_service(
self, resource_group_name: str, private_cloud_name: str, dns_service_id: str, **kwargs: Any
) -> _models.WorkloadNetworkDnsService:
"""Get a DNS service by id in a private cloud workload network.
Get a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkDnsService or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsService
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
request = build_get_dns_service_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_dns_service.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
def _create_dns_service_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> _models.WorkloadNetworkDnsService:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_service, (IOBase, bytes)):
_content = workload_network_dns_service
else:
_json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService")
request = build_create_dns_service_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_dns_service_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_dns_service_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@overload
def begin_create_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: _models.WorkloadNetworkDnsService,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsService]:
"""Create a DNS service by id in a private cloud workload network.
Create a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsService]:
"""Create a DNS service by id in a private cloud workload network.
Create a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsService]:
"""Create a DNS service by id in a private cloud workload network.
Create a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Is either a WorkloadNetworkDnsService
type or a IO type. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_dns_service_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
workload_network_dns_service=workload_network_dns_service,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
def _update_dns_service_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkDnsService]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkDnsService]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_service, (IOBase, bytes)):
_content = workload_network_dns_service
else:
_json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService")
request = build_update_dns_service_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_dns_service_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_dns_service_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@overload
def begin_update_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: _models.WorkloadNetworkDnsService,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsService]:
"""Create or update a DNS service by id in a private cloud workload network.
Create or update a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsService]:
"""Create or update a DNS service by id in a private cloud workload network.
Create or update a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsService]:
"""Create or update a DNS service by id in a private cloud workload network.
Create or update a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Is either a WorkloadNetworkDnsService
type or a IO type. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsService or the result
of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_dns_service_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
workload_network_dns_service=workload_network_dns_service,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
def _delete_dns_service_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_dns_service_request(
resource_group_name=resource_group_name,
dns_service_id=dns_service_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_dns_service_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_dns_service_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@distributed_trace
def begin_delete_dns_service(
self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a DNS service by id in a private cloud workload network.
Delete a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_dns_service_initial( # type: ignore
resource_group_name=resource_group_name,
dns_service_id=dns_service_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@distributed_trace
def list_dns_zones(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkDnsZone"]:
"""List of DNS zones in a private cloud workload network.
List of DNS zones in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsZonesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_dns_zones_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_dns_zones.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsZonesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_dns_zones.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones"
}
@distributed_trace
def get_dns_zone(
self, resource_group_name: str, private_cloud_name: str, dns_zone_id: str, **kwargs: Any
) -> _models.WorkloadNetworkDnsZone:
"""Get a DNS zone by id in a private cloud workload network.
Get a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkDnsZone or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
request = build_get_dns_zone_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_dns_zone.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
def _create_dns_zone_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> _models.WorkloadNetworkDnsZone:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_zone, (IOBase, bytes)):
_content = workload_network_dns_zone
else:
_json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone")
request = build_create_dns_zone_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_dns_zone_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_dns_zone_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@overload
def begin_create_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: _models.WorkloadNetworkDnsZone,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsZone]:
"""Create a DNS zone by id in a private cloud workload network.
Create a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsZone]:
"""Create a DNS zone by id in a private cloud workload network.
Create a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsZone]:
"""Create a DNS zone by id in a private cloud workload network.
Create a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Is either a WorkloadNetworkDnsZone type or a IO
type. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_dns_zone_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
workload_network_dns_zone=workload_network_dns_zone,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
def _update_dns_zone_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkDnsZone]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkDnsZone]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_zone, (IOBase, bytes)):
_content = workload_network_dns_zone
else:
_json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone")
request = build_update_dns_zone_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_dns_zone_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_dns_zone_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@overload
def begin_update_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: _models.WorkloadNetworkDnsZone,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsZone]:
"""Create or update a DNS zone by id in a private cloud workload network.
Create or update a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsZone]:
"""Create or update a DNS zone by id in a private cloud workload network.
Create or update a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkDnsZone]:
"""Create or update a DNS zone by id in a private cloud workload network.
Create or update a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Is either a WorkloadNetworkDnsZone type or a IO
type. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_dns_zone_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
workload_network_dns_zone=workload_network_dns_zone,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
def _delete_dns_zone_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_dns_zone_request(
resource_group_name=resource_group_name,
dns_zone_id=dns_zone_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_dns_zone_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_dns_zone_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@distributed_trace
def begin_delete_dns_zone(
self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a DNS zone by id in a private cloud workload network.
Delete a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_dns_zone_initial( # type: ignore
resource_group_name=resource_group_name,
dns_zone_id=dns_zone_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@distributed_trace
def list_public_i_ps(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.WorkloadNetworkPublicIP"]:
"""List of Public IP Blocks in a private cloud workload network.
List of Public IP Blocks in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkPublicIP or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPublicIPsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_public_i_ps_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_public_i_ps.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPublicIPsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list_public_i_ps.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs"
}
@distributed_trace
def get_public_ip(
self, resource_group_name: str, private_cloud_name: str, public_ip_id: str, **kwargs: Any
) -> _models.WorkloadNetworkPublicIP:
"""Get a Public IP Block by id in a private cloud workload network.
Get a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkPublicIP or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None)
request = build_get_public_ip_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
public_ip_id=public_ip_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_public_ip.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_public_ip.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
def _create_public_ip_initial(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO],
**kwargs: Any
) -> _models.WorkloadNetworkPublicIP:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_public_ip, (IOBase, bytes)):
_content = workload_network_public_ip
else:
_json = self._serialize.body(workload_network_public_ip, "WorkloadNetworkPublicIP")
request = build_create_public_ip_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
public_ip_id=public_ip_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_public_ip_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_public_ip_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
@overload
def begin_create_public_ip(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: _models.WorkloadNetworkPublicIP,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPublicIP]:
"""Create a Public IP Block by id in a private cloud workload network.
Create a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param workload_network_public_ip: NSX Public IP Block. Required.
:type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPublicIP or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_public_ip(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPublicIP]:
"""Create a Public IP Block by id in a private cloud workload network.
Create a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param workload_network_public_ip: NSX Public IP Block. Required.
:type workload_network_public_ip: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPublicIP or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_public_ip(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO],
**kwargs: Any
) -> LROPoller[_models.WorkloadNetworkPublicIP]:
"""Create a Public IP Block by id in a private cloud workload network.
Create a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param workload_network_public_ip: NSX Public IP Block. Is either a WorkloadNetworkPublicIP
type or a IO type. Required.
:type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either WorkloadNetworkPublicIP or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_public_ip_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
public_ip_id=public_ip_id,
workload_network_public_ip=workload_network_public_ip,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_public_ip.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
def _delete_public_ip_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_public_ip_request(
resource_group_name=resource_group_name,
public_ip_id=public_ip_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_public_ip_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_public_ip_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
@distributed_trace
def begin_delete_public_ip(
self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a Public IP Block by id in a private cloud workload network.
Delete a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_public_ip_initial( # type: ignore
resource_group_name=resource_group_name,
public_ip_id=public_ip_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_public_ip.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
| 0.769903 | 0.066904 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_zones_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/listZones",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
class ClustersOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`clusters` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> Iterable["_models.Cluster"]:
"""List clusters in a private cloud.
List clusters in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Cluster or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> _models.Cluster:
"""Get a cluster by name in a private cloud.
Get a cluster by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Cluster or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: Union[_models.Cluster, IO],
**kwargs: Any
) -> _models.Cluster:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cluster, (IOBase, bytes)):
_content = cluster
else:
_json = self._serialize.body(cluster, "Cluster")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: _models.Cluster,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Create or update a cluster in a private cloud.
Create or update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster: A cluster in the private cloud. Required.
:type cluster: ~azure.mgmt.avs.models.Cluster
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Create or update a cluster in a private cloud.
Create or update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster: A cluster in the private cloud. Required.
:type cluster: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: Union[_models.Cluster, IO],
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Create or update a cluster in a private cloud.
Create or update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster: A cluster in the private cloud. Is either a Cluster type or a IO type.
Required.
:type cluster: ~azure.mgmt.avs.models.Cluster or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
cluster=cluster,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
def _update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: Union[_models.ClusterUpdate, IO],
**kwargs: Any
) -> _models.Cluster:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cluster_update, (IOBase, bytes)):
_content = cluster_update
else:
_json = self._serialize.body(cluster_update, "ClusterUpdate")
request = build_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@overload
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: _models.ClusterUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Update a cluster in a private cloud.
Update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster_update: The cluster properties to be updated. Required.
:type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Update a cluster in a private cloud.
Update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster_update: The cluster properties to be updated. Required.
:type cluster_update: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: Union[_models.ClusterUpdate, IO],
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Update a cluster in a private cloud.
Update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster_update: The cluster properties to be updated. Is either a ClusterUpdate type or
a IO type. Required.
:type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
cluster_update=cluster_update,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a cluster in a private cloud.
Delete a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@distributed_trace
def list_zones(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> _models.ClusterZoneList:
"""List hosts by zone in a cluster.
List hosts by zone in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ClusterZoneList or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ClusterZoneList
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterZoneList] = kwargs.pop("cls", None)
request = build_list_zones_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_zones.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ClusterZoneList", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list_zones.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/listZones"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_clusters_operations.py
|
_clusters_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
def build_list_zones_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/listZones",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
class ClustersOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`clusters` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> Iterable["_models.Cluster"]:
"""List clusters in a private cloud.
List clusters in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Cluster or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> _models.Cluster:
"""Get a cluster by name in a private cloud.
Get a cluster by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Cluster or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: Union[_models.Cluster, IO],
**kwargs: Any
) -> _models.Cluster:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cluster, (IOBase, bytes)):
_content = cluster
else:
_json = self._serialize.body(cluster, "Cluster")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: _models.Cluster,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Create or update a cluster in a private cloud.
Create or update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster: A cluster in the private cloud. Required.
:type cluster: ~azure.mgmt.avs.models.Cluster
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Create or update a cluster in a private cloud.
Create or update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster: A cluster in the private cloud. Required.
:type cluster: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: Union[_models.Cluster, IO],
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Create or update a cluster in a private cloud.
Create or update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster: A cluster in the private cloud. Is either a Cluster type or a IO type.
Required.
:type cluster: ~azure.mgmt.avs.models.Cluster or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
cluster=cluster,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
def _update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: Union[_models.ClusterUpdate, IO],
**kwargs: Any
) -> _models.Cluster:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cluster_update, (IOBase, bytes)):
_content = cluster_update
else:
_json = self._serialize.body(cluster_update, "ClusterUpdate")
request = build_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@overload
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: _models.ClusterUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Update a cluster in a private cloud.
Update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster_update: The cluster properties to be updated. Required.
:type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Update a cluster in a private cloud.
Update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster_update: The cluster properties to be updated. Required.
:type cluster_update: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: Union[_models.ClusterUpdate, IO],
**kwargs: Any
) -> LROPoller[_models.Cluster]:
"""Update a cluster in a private cloud.
Update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster_update: The cluster properties to be updated. Is either a ClusterUpdate type or
a IO type. Required.
:type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Cluster or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
cluster_update=cluster_update,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a cluster in a private cloud.
Delete a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@distributed_trace
def list_zones(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> _models.ClusterZoneList:
"""List hosts by zone in a cluster.
List hosts by zone in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ClusterZoneList or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ClusterZoneList
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterZoneList] = kwargs.pop("cls", None)
request = build_list_zones_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_zones.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ClusterZoneList", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list_zones.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/listZones"
}
| 0.792103 | 0.072801 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_restrict_movement_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
class VirtualMachinesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`virtual_machines` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.VirtualMachine"]:
"""List of virtual machines in a private cloud cluster.
List of virtual machines in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either VirtualMachine or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.VirtualMachine]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("VirtualMachinesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines"
}
@distributed_trace
def get(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
**kwargs: Any
) -> _models.VirtualMachine:
"""Get a virtual machine by id in a private cloud cluster.
Get a virtual machine by id in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: VirtualMachine or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.VirtualMachine
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
virtual_machine_id=virtual_machine_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("VirtualMachine", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}"
}
def _restrict_movement_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO],
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(restrict_movement, (IOBase, bytes)):
_content = restrict_movement
else:
_json = self._serialize.body(restrict_movement, "VirtualMachineRestrictMovement")
request = build_restrict_movement_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
virtual_machine_id=virtual_machine_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._restrict_movement_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_restrict_movement_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement"
}
@overload
def begin_restrict_movement(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: _models.VirtualMachineRestrictMovement,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Enable or disable DRS-driven VM movement restriction.
Enable or disable DRS-driven VM movement restriction.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not
(Disabled). Required.
:type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_restrict_movement(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Enable or disable DRS-driven VM movement restriction.
Enable or disable DRS-driven VM movement restriction.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not
(Disabled). Required.
:type restrict_movement: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_restrict_movement(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO],
**kwargs: Any
) -> LROPoller[None]:
"""Enable or disable DRS-driven VM movement restriction.
Enable or disable DRS-driven VM movement restriction.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not
(Disabled). Is either a VirtualMachineRestrictMovement type or a IO type. Required.
:type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._restrict_movement_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
virtual_machine_id=virtual_machine_id,
restrict_movement=restrict_movement,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_restrict_movement.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_virtual_machines_operations.py
|
_virtual_machines_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_restrict_movement_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"virtualMachineId": _SERIALIZER.url("virtual_machine_id", virtual_machine_id, "str"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
class VirtualMachinesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`virtual_machines` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.VirtualMachine"]:
"""List of virtual machines in a private cloud cluster.
List of virtual machines in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either VirtualMachine or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.VirtualMachine]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("VirtualMachinesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines"
}
@distributed_trace
def get(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
**kwargs: Any
) -> _models.VirtualMachine:
"""Get a virtual machine by id in a private cloud cluster.
Get a virtual machine by id in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: VirtualMachine or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.VirtualMachine
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
virtual_machine_id=virtual_machine_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("VirtualMachine", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}"
}
def _restrict_movement_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO],
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(restrict_movement, (IOBase, bytes)):
_content = restrict_movement
else:
_json = self._serialize.body(restrict_movement, "VirtualMachineRestrictMovement")
request = build_restrict_movement_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
virtual_machine_id=virtual_machine_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._restrict_movement_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_restrict_movement_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement"
}
@overload
def begin_restrict_movement(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: _models.VirtualMachineRestrictMovement,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Enable or disable DRS-driven VM movement restriction.
Enable or disable DRS-driven VM movement restriction.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not
(Disabled). Required.
:type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_restrict_movement(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[None]:
"""Enable or disable DRS-driven VM movement restriction.
Enable or disable DRS-driven VM movement restriction.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not
(Disabled). Required.
:type restrict_movement: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_restrict_movement(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO],
**kwargs: Any
) -> LROPoller[None]:
"""Enable or disable DRS-driven VM movement restriction.
Enable or disable DRS-driven VM movement restriction.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not
(Disabled). Is either a VirtualMachineRestrictMovement type or a IO type. Required.
:type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._restrict_movement_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
virtual_machine_id=virtual_machine_id,
restrict_movement=restrict_movement,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_restrict_movement.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement"
}
| 0.773516 | 0.072243 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"hcxEnterpriseSiteName": _SERIALIZER.url(
"hcx_enterprise_site_name", hcx_enterprise_site_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"hcxEnterpriseSiteName": _SERIALIZER.url(
"hcx_enterprise_site_name", hcx_enterprise_site_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"hcxEnterpriseSiteName": _SERIALIZER.url(
"hcx_enterprise_site_name", hcx_enterprise_site_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class HcxEnterpriseSitesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`hcx_enterprise_sites` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.HcxEnterpriseSite"]:
"""List HCX on-premises key in a private cloud.
List HCX on-premises key in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.HcxEnterpriseSite]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.HcxEnterpriseSiteList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("HcxEnterpriseSiteList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, **kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Get an HCX on-premises key by name in a private cloud.
Get an HCX on-premises key by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.HcxEnterpriseSite] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
hcx_enterprise_site_name=hcx_enterprise_site_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"
}
@overload
def create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
hcx_enterprise_site: _models.HcxEnterpriseSite,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Create or update an activation key for on-premises HCX site.
Create or update an activation key for on-premises HCX site.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:param hcx_enterprise_site: The HCX Enterprise Site. Required.
:type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
hcx_enterprise_site: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Create or update an activation key for on-premises HCX site.
Create or update an activation key for on-premises HCX site.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:param hcx_enterprise_site: The HCX Enterprise Site. Required.
:type hcx_enterprise_site: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
hcx_enterprise_site: Union[_models.HcxEnterpriseSite, IO],
**kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Create or update an activation key for on-premises HCX site.
Create or update an activation key for on-premises HCX site.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:param hcx_enterprise_site: The HCX Enterprise Site. Is either a HcxEnterpriseSite type or a IO
type. Required.
:type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.HcxEnterpriseSite] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(hcx_enterprise_site, (IOBase, bytes)):
_content = hcx_enterprise_site
else:
_json = self._serialize.body(hcx_enterprise_site, "HcxEnterpriseSite")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
hcx_enterprise_site_name=hcx_enterprise_site_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"
}
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, **kwargs: Any
) -> None:
"""Delete HCX on-premises key in a private cloud.
Delete HCX on-premises key in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
hcx_enterprise_site_name=hcx_enterprise_site_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_hcx_enterprise_sites_operations.py
|
_hcx_enterprise_sites_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"hcxEnterpriseSiteName": _SERIALIZER.url(
"hcx_enterprise_site_name", hcx_enterprise_site_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"hcxEnterpriseSiteName": _SERIALIZER.url(
"hcx_enterprise_site_name", hcx_enterprise_site_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"hcxEnterpriseSiteName": _SERIALIZER.url(
"hcx_enterprise_site_name", hcx_enterprise_site_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class HcxEnterpriseSitesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`hcx_enterprise_sites` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.HcxEnterpriseSite"]:
"""List HCX on-premises key in a private cloud.
List HCX on-premises key in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.HcxEnterpriseSite]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.HcxEnterpriseSiteList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("HcxEnterpriseSiteList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, **kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Get an HCX on-premises key by name in a private cloud.
Get an HCX on-premises key by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.HcxEnterpriseSite] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
hcx_enterprise_site_name=hcx_enterprise_site_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"
}
@overload
def create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
hcx_enterprise_site: _models.HcxEnterpriseSite,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Create or update an activation key for on-premises HCX site.
Create or update an activation key for on-premises HCX site.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:param hcx_enterprise_site: The HCX Enterprise Site. Required.
:type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
hcx_enterprise_site: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Create or update an activation key for on-premises HCX site.
Create or update an activation key for on-premises HCX site.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:param hcx_enterprise_site: The HCX Enterprise Site. Required.
:type hcx_enterprise_site: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
hcx_enterprise_site: Union[_models.HcxEnterpriseSite, IO],
**kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Create or update an activation key for on-premises HCX site.
Create or update an activation key for on-premises HCX site.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:param hcx_enterprise_site: The HCX Enterprise Site. Is either a HcxEnterpriseSite type or a IO
type. Required.
:type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.HcxEnterpriseSite] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(hcx_enterprise_site, (IOBase, bytes)):
_content = hcx_enterprise_site
else:
_json = self._serialize.body(hcx_enterprise_site, "HcxEnterpriseSite")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
hcx_enterprise_site_name=hcx_enterprise_site_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"
}
@distributed_trace
def delete( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, **kwargs: Any
) -> None:
"""Delete HCX on-premises key in a private cloud.
Delete HCX on-premises key in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
hcx_enterprise_site_name=hcx_enterprise_site_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"
}
| 0.773345 | 0.077588 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, addon_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"addonName": _SERIALIZER.url("addon_name", addon_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, private_cloud_name: str, addon_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"addonName": _SERIALIZER.url("addon_name", addon_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, private_cloud_name: str, addon_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"addonName": _SERIALIZER.url("addon_name", addon_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class AddonsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`addons` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> Iterable["_models.Addon"]:
"""List addons in a private cloud.
List addons in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Addon or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AddonList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("AddonList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons"
}
@distributed_trace
def get(self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any) -> _models.Addon:
"""Get an addon by name in a private cloud.
Get an addon by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Addon or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Addon
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Addon] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Addon", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: Union[_models.Addon, IO],
**kwargs: Any
) -> _models.Addon:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Addon] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(addon, (IOBase, bytes)):
_content = addon
else:
_json = self._serialize.body(addon, "Addon")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Addon", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Addon", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: _models.Addon,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Addon]:
"""Create or update a addon in a private cloud.
Create or update a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:param addon: A addon in the private cloud. Required.
:type addon: ~azure.mgmt.avs.models.Addon
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Addon or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Addon]:
"""Create or update a addon in a private cloud.
Create or update a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:param addon: A addon in the private cloud. Required.
:type addon: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Addon or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: Union[_models.Addon, IO],
**kwargs: Any
) -> LROPoller[_models.Addon]:
"""Create or update a addon in a private cloud.
Create or update a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:param addon: A addon in the private cloud. Is either a Addon type or a IO type. Required.
:type addon: ~azure.mgmt.avs.models.Addon or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Addon or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Addon] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
addon=addon,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Addon", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a addon in a private cloud.
Delete a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_addons_operations.py
|
_addons_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str, private_cloud_name: str, addon_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"addonName": _SERIALIZER.url("addon_name", addon_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str, private_cloud_name: str, addon_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"addonName": _SERIALIZER.url("addon_name", addon_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str, private_cloud_name: str, addon_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"addonName": _SERIALIZER.url("addon_name", addon_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class AddonsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`addons` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> Iterable["_models.Addon"]:
"""List addons in a private cloud.
List addons in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Addon or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AddonList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("AddonList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons"
}
@distributed_trace
def get(self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any) -> _models.Addon:
"""Get an addon by name in a private cloud.
Get an addon by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Addon or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Addon
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Addon] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Addon", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: Union[_models.Addon, IO],
**kwargs: Any
) -> _models.Addon:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Addon] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(addon, (IOBase, bytes)):
_content = addon
else:
_json = self._serialize.body(addon, "Addon")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Addon", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Addon", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: _models.Addon,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Addon]:
"""Create or update a addon in a private cloud.
Create or update a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:param addon: A addon in the private cloud. Required.
:type addon: ~azure.mgmt.avs.models.Addon
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Addon or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Addon]:
"""Create or update a addon in a private cloud.
Create or update a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:param addon: A addon in the private cloud. Required.
:type addon: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Addon or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: Union[_models.Addon, IO],
**kwargs: Any
) -> LROPoller[_models.Addon]:
"""Create or update a addon in a private cloud.
Create or update a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:param addon: A addon in the private cloud. Is either a Addon type or a IO type. Required.
:type addon: ~azure.mgmt.avs.models.Addon or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Addon or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Addon] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
addon=addon,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Addon", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a addon in a private cloud.
Delete a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
| 0.794185 | 0.089455 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class DatastoresOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`datastores` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.Datastore"]:
"""List datastores in a private cloud cluster.
List datastores in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Datastore or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DatastoreList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("DatastoreList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any
) -> _models.Datastore:
"""Get a datastore in a private cloud cluster.
Get a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Datastore or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Datastore
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Datastore] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Datastore", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: Union[_models.Datastore, IO],
**kwargs: Any
) -> _models.Datastore:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Datastore] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(datastore, (IOBase, bytes)):
_content = datastore
else:
_json = self._serialize.body(datastore, "Datastore")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Datastore", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Datastore", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: _models.Datastore,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Datastore]:
"""Create or update a datastore in a private cloud cluster.
Create or update a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:param datastore: A datastore in a private cloud cluster. Required.
:type datastore: ~azure.mgmt.avs.models.Datastore
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Datastore or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Datastore]:
"""Create or update a datastore in a private cloud cluster.
Create or update a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:param datastore: A datastore in a private cloud cluster. Required.
:type datastore: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Datastore or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: Union[_models.Datastore, IO],
**kwargs: Any
) -> LROPoller[_models.Datastore]:
"""Create or update a datastore in a private cloud cluster.
Create or update a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:param datastore: A datastore in a private cloud cluster. Is either a Datastore type or a IO
type. Required.
:type datastore: ~azure.mgmt.avs.models.Datastore or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Datastore or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Datastore] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
datastore=datastore,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Datastore", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a datastore in a private cloud cluster.
Delete a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_datastores_operations.py
|
_datastores_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"datastoreName": _SERIALIZER.url("datastore_name", datastore_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class DatastoresOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`datastores` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.Datastore"]:
"""List datastores in a private cloud cluster.
List datastores in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Datastore or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DatastoreList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("DatastoreList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any
) -> _models.Datastore:
"""Get a datastore in a private cloud cluster.
Get a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Datastore or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Datastore
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Datastore] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Datastore", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: Union[_models.Datastore, IO],
**kwargs: Any
) -> _models.Datastore:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Datastore] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(datastore, (IOBase, bytes)):
_content = datastore
else:
_json = self._serialize.body(datastore, "Datastore")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Datastore", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Datastore", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: _models.Datastore,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Datastore]:
"""Create or update a datastore in a private cloud cluster.
Create or update a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:param datastore: A datastore in a private cloud cluster. Required.
:type datastore: ~azure.mgmt.avs.models.Datastore
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Datastore or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.Datastore]:
"""Create or update a datastore in a private cloud cluster.
Create or update a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:param datastore: A datastore in a private cloud cluster. Required.
:type datastore: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Datastore or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: Union[_models.Datastore, IO],
**kwargs: Any
) -> LROPoller[_models.Datastore]:
"""Create or update a datastore in a private cloud cluster.
Create or update a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:param datastore: A datastore in a private cloud cluster. Is either a Datastore type or a IO
type. Required.
:type datastore: ~azure.mgmt.avs.models.Datastore or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either Datastore or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Datastore] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
datastore=datastore,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Datastore", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a datastore in a private cloud cluster.
Delete a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
| 0.785185 | 0.078008 |
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(**kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/providers/Microsoft.AVS/operations")
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
class Operations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`operations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
"""Lists all of the available operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {"url": "/providers/Microsoft.AVS/operations"}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_operations.py
|
_operations.py
|
from typing import Any, Callable, Dict, Iterable, Optional, TypeVar
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(**kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop("template_url", "/providers/Microsoft.AVS/operations")
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
class Operations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`operations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, **kwargs: Any) -> Iterable["_models.Operation"]:
"""Lists all of the available operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("OperationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {"url": "/providers/Microsoft.AVS/operations"}
| 0.840193 | 0.078536 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"placementPolicyName": _SERIALIZER.url(
"placement_policy_name", placement_policy_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"placementPolicyName": _SERIALIZER.url(
"placement_policy_name", placement_policy_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"placementPolicyName": _SERIALIZER.url(
"placement_policy_name", placement_policy_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"placementPolicyName": _SERIALIZER.url(
"placement_policy_name", placement_policy_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class PlacementPoliciesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`placement_policies` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.PlacementPolicy"]:
"""List placement policies in a private cloud cluster.
List placement policies in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PlacementPolicy or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PlacementPoliciesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PlacementPoliciesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies"
}
@distributed_trace
def get(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
**kwargs: Any
) -> _models.PlacementPolicy:
"""Get a placement policy by name in a private cloud cluster.
Get a placement policy by name in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PlacementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.PlacementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: Union[_models.PlacementPolicy, IO],
**kwargs: Any
) -> _models.PlacementPolicy:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(placement_policy, (IOBase, bytes)):
_content = placement_policy
else:
_json = self._serialize.body(placement_policy, "PlacementPolicy")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: _models.PlacementPolicy,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PlacementPolicy]:
"""Create or update a placement policy in a private cloud cluster.
Create or update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy: A placement policy in the private cloud cluster. Required.
:type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PlacementPolicy]:
"""Create or update a placement policy in a private cloud cluster.
Create or update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy: A placement policy in the private cloud cluster. Required.
:type placement_policy: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: Union[_models.PlacementPolicy, IO],
**kwargs: Any
) -> LROPoller[_models.PlacementPolicy]:
"""Create or update a placement policy in a private cloud cluster.
Create or update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy: A placement policy in the private cloud cluster. Is either a
PlacementPolicy type or a IO type. Required.
:type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
placement_policy=placement_policy,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
def _update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: Union[_models.PlacementPolicyUpdate, IO],
**kwargs: Any
) -> _models.PlacementPolicy:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(placement_policy_update, (IOBase, bytes)):
_content = placement_policy_update
else:
_json = self._serialize.body(placement_policy_update, "PlacementPolicyUpdate")
request = build_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
@overload
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: _models.PlacementPolicyUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PlacementPolicy]:
"""Update a placement policy in a private cloud cluster.
Update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy_update: The placement policy properties that may be updated. Required.
:type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PlacementPolicy]:
"""Update a placement policy in a private cloud cluster.
Update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy_update: The placement policy properties that may be updated. Required.
:type placement_policy_update: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: Union[_models.PlacementPolicyUpdate, IO],
**kwargs: Any
) -> LROPoller[_models.PlacementPolicy]:
"""Update a placement policy in a private cloud cluster.
Update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy_update: The placement policy properties that may be updated. Is either
a PlacementPolicyUpdate type or a IO type. Required.
:type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
placement_policy_update=placement_policy_update,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
@distributed_trace
def begin_delete(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
**kwargs: Any
) -> LROPoller[None]:
"""Delete a placement policy in a private cloud cluster.
Delete a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_placement_policies_operations.py
|
_placement_policies_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, cluster_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"placementPolicyName": _SERIALIZER.url(
"placement_policy_name", placement_policy_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"placementPolicyName": _SERIALIZER.url(
"placement_policy_name", placement_policy_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_update_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"placementPolicyName": _SERIALIZER.url(
"placement_policy_name", placement_policy_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"clusterName": _SERIALIZER.url("cluster_name", cluster_name, "str", pattern=r"^[-\w\._]+$"),
"placementPolicyName": _SERIALIZER.url(
"placement_policy_name", placement_policy_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class PlacementPoliciesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`placement_policies` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> Iterable["_models.PlacementPolicy"]:
"""List placement policies in a private cloud cluster.
List placement policies in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PlacementPolicy or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PlacementPoliciesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("PlacementPoliciesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies"
}
@distributed_trace
def get(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
**kwargs: Any
) -> _models.PlacementPolicy:
"""Get a placement policy by name in a private cloud cluster.
Get a placement policy by name in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PlacementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.PlacementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: Union[_models.PlacementPolicy, IO],
**kwargs: Any
) -> _models.PlacementPolicy:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(placement_policy, (IOBase, bytes)):
_content = placement_policy
else:
_json = self._serialize.body(placement_policy, "PlacementPolicy")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: _models.PlacementPolicy,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PlacementPolicy]:
"""Create or update a placement policy in a private cloud cluster.
Create or update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy: A placement policy in the private cloud cluster. Required.
:type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PlacementPolicy]:
"""Create or update a placement policy in a private cloud cluster.
Create or update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy: A placement policy in the private cloud cluster. Required.
:type placement_policy: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: Union[_models.PlacementPolicy, IO],
**kwargs: Any
) -> LROPoller[_models.PlacementPolicy]:
"""Create or update a placement policy in a private cloud cluster.
Create or update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy: A placement policy in the private cloud cluster. Is either a
PlacementPolicy type or a IO type. Required.
:type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
placement_policy=placement_policy,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
def _update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: Union[_models.PlacementPolicyUpdate, IO],
**kwargs: Any
) -> _models.PlacementPolicy:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(placement_policy_update, (IOBase, bytes)):
_content = placement_policy_update
else:
_json = self._serialize.body(placement_policy_update, "PlacementPolicyUpdate")
request = build_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
@overload
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: _models.PlacementPolicyUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PlacementPolicy]:
"""Update a placement policy in a private cloud cluster.
Update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy_update: The placement policy properties that may be updated. Required.
:type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.PlacementPolicy]:
"""Update a placement policy in a private cloud cluster.
Update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy_update: The placement policy properties that may be updated. Required.
:type placement_policy_update: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: Union[_models.PlacementPolicyUpdate, IO],
**kwargs: Any
) -> LROPoller[_models.PlacementPolicy]:
"""Update a placement policy in a private cloud cluster.
Update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy_update: The placement policy properties that may be updated. Is either
a PlacementPolicyUpdate type or a IO type. Required.
:type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
placement_policy_update=placement_policy_update,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
@distributed_trace
def begin_delete(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
**kwargs: Any
) -> LROPoller[None]:
"""Delete a placement policy in a private cloud cluster.
Delete a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
| 0.788746 | 0.085901 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"globalReachConnectionName": _SERIALIZER.url(
"global_reach_connection_name", global_reach_connection_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"globalReachConnectionName": _SERIALIZER.url(
"global_reach_connection_name", global_reach_connection_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"globalReachConnectionName": _SERIALIZER.url(
"global_reach_connection_name", global_reach_connection_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class GlobalReachConnectionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`global_reach_connections` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.GlobalReachConnection"]:
"""List global reach connections in a private cloud.
List global reach connections in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either GlobalReachConnection or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GlobalReachConnectionList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("GlobalReachConnectionList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any
) -> _models.GlobalReachConnection:
"""Get a global reach connection by name in a private cloud.
Get a global reach connection by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: GlobalReachConnection or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.GlobalReachConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: Union[_models.GlobalReachConnection, IO],
**kwargs: Any
) -> _models.GlobalReachConnection:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(global_reach_connection, (IOBase, bytes)):
_content = global_reach_connection
else:
_json = self._serialize.body(global_reach_connection, "GlobalReachConnection")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: _models.GlobalReachConnection,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GlobalReachConnection]:
"""Create or update a global reach connection in a private cloud.
Create or update a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:param global_reach_connection: A global reach connection in the private cloud. Required.
:type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either GlobalReachConnection or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GlobalReachConnection]:
"""Create or update a global reach connection in a private cloud.
Create or update a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:param global_reach_connection: A global reach connection in the private cloud. Required.
:type global_reach_connection: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either GlobalReachConnection or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: Union[_models.GlobalReachConnection, IO],
**kwargs: Any
) -> LROPoller[_models.GlobalReachConnection]:
"""Create or update a global reach connection in a private cloud.
Create or update a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:param global_reach_connection: A global reach connection in the private cloud. Is either a
GlobalReachConnection type or a IO type. Required.
:type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either GlobalReachConnection or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
global_reach_connection=global_reach_connection,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a global reach connection in a private cloud.
Delete a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/operations/_global_reach_connections_operations.py
|
_global_reach_connections_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Iterable, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
from .._serialization import Serializer
from .._vendor import _convert_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
_SERIALIZER = Serializer()
_SERIALIZER.client_side_validation = False
def build_list_request(
resource_group_name: str, private_cloud_name: str, subscription_id: str, **kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_get_request(
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"globalReachConnectionName": _SERIALIZER.url(
"global_reach_connection_name", global_reach_connection_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)
def build_create_or_update_request(
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str"),
"globalReachConnectionName": _SERIALIZER.url(
"global_reach_connection_name", global_reach_connection_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
if content_type is not None:
_headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str")
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs)
def build_delete_request(
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
subscription_id: str,
**kwargs: Any
) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-01"))
accept = _headers.pop("Accept", "application/json")
# Construct URL
_url = kwargs.pop(
"template_url",
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}",
) # pylint: disable=line-too-long
path_format_arguments = {
"subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1),
"resourceGroupName": _SERIALIZER.url(
"resource_group_name", resource_group_name, "str", max_length=90, min_length=1
),
"privateCloudName": _SERIALIZER.url("private_cloud_name", private_cloud_name, "str", pattern=r"^[-\w\._]+$"),
"globalReachConnectionName": _SERIALIZER.url(
"global_reach_connection_name", global_reach_connection_name, "str", pattern=r"^[-\w\._]+$"
),
}
_url: str = _url.format(**path_format_arguments) # type: ignore
# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
# Construct headers
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
class GlobalReachConnectionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.AVSClient`'s
:attr:`global_reach_connections` attribute.
"""
models = _models
def __init__(self, *args, **kwargs):
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> Iterable["_models.GlobalReachConnection"]:
"""List global reach connections in a private cloud.
List global reach connections in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either GlobalReachConnection or the result of
cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GlobalReachConnectionList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
def extract_data(pipeline_response):
deserialized = self._deserialize("GlobalReachConnectionList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections"
}
@distributed_trace
def get(
self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any
) -> _models.GlobalReachConnection:
"""Get a global reach connection by name in a private cloud.
Get a global reach connection by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: GlobalReachConnection or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.GlobalReachConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: Union[_models.GlobalReachConnection, IO],
**kwargs: Any
) -> _models.GlobalReachConnection:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(global_reach_connection, (IOBase, bytes)):
_content = global_reach_connection
else:
_json = self._serialize.body(global_reach_connection, "GlobalReachConnection")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: _models.GlobalReachConnection,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GlobalReachConnection]:
"""Create or update a global reach connection in a private cloud.
Create or update a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:param global_reach_connection: A global reach connection in the private cloud. Required.
:type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either GlobalReachConnection or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.GlobalReachConnection]:
"""Create or update a global reach connection in a private cloud.
Create or update a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:param global_reach_connection: A global reach connection in the private cloud. Required.
:type global_reach_connection: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either GlobalReachConnection or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace
def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: Union[_models.GlobalReachConnection, IO],
**kwargs: Any
) -> LROPoller[_models.GlobalReachConnection]:
"""Create or update a global reach connection in a private cloud.
Create or update a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:param global_reach_connection: A global reach connection in the private cloud. Is either a
GlobalReachConnection type or a IO type. Required.
:type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either GlobalReachConnection or the result of
cls(response)
:rtype: ~azure.core.polling.LROPoller[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
global_reach_connection=global_reach_connection,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
@distributed_trace
def begin_delete(
self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any
) -> LROPoller[None]:
"""Delete a global reach connection in a private cloud.
Delete a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this
operation to not poll, or pass in your own initialized polling object for a personal polling
strategy.
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return LROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
| 0.788217 | 0.077692 |
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from .. import models as _models
from .._serialization import Deserializer, Serializer
from ._configuration import AVSClientConfiguration
from .operations import (
AddonsOperations,
AuthorizationsOperations,
CloudLinksOperations,
ClustersOperations,
DatastoresOperations,
GlobalReachConnectionsOperations,
HcxEnterpriseSitesOperations,
LocationsOperations,
Operations,
PlacementPoliciesOperations,
PrivateCloudsOperations,
ScriptCmdletsOperations,
ScriptExecutionsOperations,
ScriptPackagesOperations,
VirtualMachinesOperations,
WorkloadNetworksOperations,
)
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
class AVSClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""Azure VMware Solution API.
:ivar operations: Operations operations
:vartype operations: azure.mgmt.avs.aio.operations.Operations
:ivar locations: LocationsOperations operations
:vartype locations: azure.mgmt.avs.aio.operations.LocationsOperations
:ivar private_clouds: PrivateCloudsOperations operations
:vartype private_clouds: azure.mgmt.avs.aio.operations.PrivateCloudsOperations
:ivar clusters: ClustersOperations operations
:vartype clusters: azure.mgmt.avs.aio.operations.ClustersOperations
:ivar datastores: DatastoresOperations operations
:vartype datastores: azure.mgmt.avs.aio.operations.DatastoresOperations
:ivar hcx_enterprise_sites: HcxEnterpriseSitesOperations operations
:vartype hcx_enterprise_sites: azure.mgmt.avs.aio.operations.HcxEnterpriseSitesOperations
:ivar authorizations: AuthorizationsOperations operations
:vartype authorizations: azure.mgmt.avs.aio.operations.AuthorizationsOperations
:ivar global_reach_connections: GlobalReachConnectionsOperations operations
:vartype global_reach_connections:
azure.mgmt.avs.aio.operations.GlobalReachConnectionsOperations
:ivar workload_networks: WorkloadNetworksOperations operations
:vartype workload_networks: azure.mgmt.avs.aio.operations.WorkloadNetworksOperations
:ivar cloud_links: CloudLinksOperations operations
:vartype cloud_links: azure.mgmt.avs.aio.operations.CloudLinksOperations
:ivar addons: AddonsOperations operations
:vartype addons: azure.mgmt.avs.aio.operations.AddonsOperations
:ivar virtual_machines: VirtualMachinesOperations operations
:vartype virtual_machines: azure.mgmt.avs.aio.operations.VirtualMachinesOperations
:ivar placement_policies: PlacementPoliciesOperations operations
:vartype placement_policies: azure.mgmt.avs.aio.operations.PlacementPoliciesOperations
:ivar script_packages: ScriptPackagesOperations operations
:vartype script_packages: azure.mgmt.avs.aio.operations.ScriptPackagesOperations
:ivar script_cmdlets: ScriptCmdletsOperations operations
:vartype script_cmdlets: azure.mgmt.avs.aio.operations.ScriptCmdletsOperations
:ivar script_executions: ScriptExecutionsOperations operations
:vartype script_executions: azure.mgmt.avs.aio.operations.ScriptExecutionsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
"""
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AVSClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.private_clouds = PrivateCloudsOperations(self._client, self._config, self._serialize, self._deserialize)
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.datastores = DatastoresOperations(self._client, self._config, self._serialize, self._deserialize)
self.hcx_enterprise_sites = HcxEnterpriseSitesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.authorizations = AuthorizationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.global_reach_connections = GlobalReachConnectionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.workload_networks = WorkloadNetworksOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.cloud_links = CloudLinksOperations(self._client, self._config, self._serialize, self._deserialize)
self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_machines = VirtualMachinesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.placement_policies = PlacementPoliciesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.script_packages = ScriptPackagesOperations(self._client, self._config, self._serialize, self._deserialize)
self.script_cmdlets = ScriptCmdletsOperations(self._client, self._config, self._serialize, self._deserialize)
self.script_executions = ScriptExecutionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client._send_request(request)
<AsyncHttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.AsyncHttpResponse
"""
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
async def close(self) -> None:
await self._client.close()
async def __aenter__(self) -> "AVSClient":
await self._client.__aenter__()
return self
async def __aexit__(self, *exc_details: Any) -> None:
await self._client.__aexit__(*exc_details)
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/_avs_client.py
|
_avs_client.py
|
from copy import deepcopy
from typing import Any, Awaitable, TYPE_CHECKING
from azure.core.rest import AsyncHttpResponse, HttpRequest
from azure.mgmt.core import AsyncARMPipelineClient
from .. import models as _models
from .._serialization import Deserializer, Serializer
from ._configuration import AVSClientConfiguration
from .operations import (
AddonsOperations,
AuthorizationsOperations,
CloudLinksOperations,
ClustersOperations,
DatastoresOperations,
GlobalReachConnectionsOperations,
HcxEnterpriseSitesOperations,
LocationsOperations,
Operations,
PlacementPoliciesOperations,
PrivateCloudsOperations,
ScriptCmdletsOperations,
ScriptExecutionsOperations,
ScriptPackagesOperations,
VirtualMachinesOperations,
WorkloadNetworksOperations,
)
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
class AVSClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes
"""Azure VMware Solution API.
:ivar operations: Operations operations
:vartype operations: azure.mgmt.avs.aio.operations.Operations
:ivar locations: LocationsOperations operations
:vartype locations: azure.mgmt.avs.aio.operations.LocationsOperations
:ivar private_clouds: PrivateCloudsOperations operations
:vartype private_clouds: azure.mgmt.avs.aio.operations.PrivateCloudsOperations
:ivar clusters: ClustersOperations operations
:vartype clusters: azure.mgmt.avs.aio.operations.ClustersOperations
:ivar datastores: DatastoresOperations operations
:vartype datastores: azure.mgmt.avs.aio.operations.DatastoresOperations
:ivar hcx_enterprise_sites: HcxEnterpriseSitesOperations operations
:vartype hcx_enterprise_sites: azure.mgmt.avs.aio.operations.HcxEnterpriseSitesOperations
:ivar authorizations: AuthorizationsOperations operations
:vartype authorizations: azure.mgmt.avs.aio.operations.AuthorizationsOperations
:ivar global_reach_connections: GlobalReachConnectionsOperations operations
:vartype global_reach_connections:
azure.mgmt.avs.aio.operations.GlobalReachConnectionsOperations
:ivar workload_networks: WorkloadNetworksOperations operations
:vartype workload_networks: azure.mgmt.avs.aio.operations.WorkloadNetworksOperations
:ivar cloud_links: CloudLinksOperations operations
:vartype cloud_links: azure.mgmt.avs.aio.operations.CloudLinksOperations
:ivar addons: AddonsOperations operations
:vartype addons: azure.mgmt.avs.aio.operations.AddonsOperations
:ivar virtual_machines: VirtualMachinesOperations operations
:vartype virtual_machines: azure.mgmt.avs.aio.operations.VirtualMachinesOperations
:ivar placement_policies: PlacementPoliciesOperations operations
:vartype placement_policies: azure.mgmt.avs.aio.operations.PlacementPoliciesOperations
:ivar script_packages: ScriptPackagesOperations operations
:vartype script_packages: azure.mgmt.avs.aio.operations.ScriptPackagesOperations
:ivar script_cmdlets: ScriptCmdletsOperations operations
:vartype script_cmdlets: azure.mgmt.avs.aio.operations.ScriptCmdletsOperations
:ivar script_executions: ScriptExecutionsOperations operations
:vartype script_executions: azure.mgmt.avs.aio.operations.ScriptExecutionsOperations
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:param base_url: Service URL. Default value is "https://management.azure.com".
:type base_url: str
:keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
"""
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
base_url: str = "https://management.azure.com",
**kwargs: Any
) -> None:
self._config = AVSClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs)
self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self._serialize.client_side_validation = False
self.operations = Operations(self._client, self._config, self._serialize, self._deserialize)
self.locations = LocationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.private_clouds = PrivateCloudsOperations(self._client, self._config, self._serialize, self._deserialize)
self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize)
self.datastores = DatastoresOperations(self._client, self._config, self._serialize, self._deserialize)
self.hcx_enterprise_sites = HcxEnterpriseSitesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.authorizations = AuthorizationsOperations(self._client, self._config, self._serialize, self._deserialize)
self.global_reach_connections = GlobalReachConnectionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.workload_networks = WorkloadNetworksOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.cloud_links = CloudLinksOperations(self._client, self._config, self._serialize, self._deserialize)
self.addons = AddonsOperations(self._client, self._config, self._serialize, self._deserialize)
self.virtual_machines = VirtualMachinesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.placement_policies = PlacementPoliciesOperations(
self._client, self._config, self._serialize, self._deserialize
)
self.script_packages = ScriptPackagesOperations(self._client, self._config, self._serialize, self._deserialize)
self.script_cmdlets = ScriptCmdletsOperations(self._client, self._config, self._serialize, self._deserialize)
self.script_executions = ScriptExecutionsOperations(
self._client, self._config, self._serialize, self._deserialize
)
def _send_request(self, request: HttpRequest, **kwargs: Any) -> Awaitable[AsyncHttpResponse]:
"""Runs the network request through the client's chained policies.
>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client._send_request(request)
<AsyncHttpResponse: 200 OK>
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.AsyncHttpResponse
"""
request_copy = deepcopy(request)
request_copy.url = self._client.format_url(request_copy.url)
return self._client.send_request(request_copy, **kwargs)
async def close(self) -> None:
await self._client.close()
async def __aenter__(self) -> "AVSClient":
await self._client.__aenter__()
return self
async def __aexit__(self, *exc_details: Any) -> None:
await self._client.__aexit__(*exc_details)
| 0.79162 | 0.106458 |
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
class AVSClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for AVSClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(AVSClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-03-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-avs/{}".format(VERSION))
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/_configuration.py
|
_configuration.py
|
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy
from .._version import VERSION
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
class AVSClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
"""Configuration for AVSClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure. Required.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The ID of the target subscription. Required.
:type subscription_id: str
:keyword api_version: Api Version. Default value is "2023-03-01". Note that overriding this
default value may result in unsupported behavior.
:paramtype api_version: str
"""
def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None:
super(AVSClientConfiguration, self).__init__(**kwargs)
api_version: str = kwargs.pop("api_version", "2023-03-01")
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
self.credential = credential
self.subscription_id = subscription_id
self.api_version = api_version
self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"])
kwargs.setdefault("sdk_moniker", "mgmt-avs/{}".format(VERSION))
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
if self.credential and not self.authentication_policy:
self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(
self.credential, *self.credential_scopes, **kwargs
)
| 0.834744 | 0.089216 |
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._authorizations_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class AuthorizationsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`authorizations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.ExpressRouteAuthorization"]:
"""List ExpressRoute Circuit Authorizations in a private cloud.
List ExpressRoute Circuit Authorizations in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ExpressRouteAuthorization or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ExpressRouteAuthorizationList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExpressRouteAuthorizationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any
) -> _models.ExpressRouteAuthorization:
"""Get an ExpressRoute Circuit Authorization by name in a private cloud.
Get an ExpressRoute Circuit Authorization by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ExpressRouteAuthorization or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ExpressRouteAuthorization
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: Union[_models.ExpressRouteAuthorization, IO],
**kwargs: Any
) -> _models.ExpressRouteAuthorization:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(authorization, (IOBase, bytes)):
_content = authorization
else:
_json = self._serialize.body(authorization, "ExpressRouteAuthorization")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: _models.ExpressRouteAuthorization,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ExpressRouteAuthorization]:
"""Create or update an ExpressRoute Circuit Authorization in a private cloud.
Create or update an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:param authorization: An ExpressRoute Circuit Authorization. Required.
:type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ExpressRouteAuthorization or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ExpressRouteAuthorization]:
"""Create or update an ExpressRoute Circuit Authorization in a private cloud.
Create or update an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:param authorization: An ExpressRoute Circuit Authorization. Required.
:type authorization: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ExpressRouteAuthorization or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: Union[_models.ExpressRouteAuthorization, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.ExpressRouteAuthorization]:
"""Create or update an ExpressRoute Circuit Authorization in a private cloud.
Create or update an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:param authorization: An ExpressRoute Circuit Authorization. Is either a
ExpressRouteAuthorization type or a IO type. Required.
:type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ExpressRouteAuthorization or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
authorization=authorization,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete an ExpressRoute Circuit Authorization in a private cloud.
Delete an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_authorizations_operations.py
|
_authorizations_operations.py
|
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._authorizations_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class AuthorizationsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`authorizations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.ExpressRouteAuthorization"]:
"""List ExpressRoute Circuit Authorizations in a private cloud.
List ExpressRoute Circuit Authorizations in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ExpressRouteAuthorization or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ExpressRouteAuthorizationList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ExpressRouteAuthorizationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any
) -> _models.ExpressRouteAuthorization:
"""Get an ExpressRoute Circuit Authorization by name in a private cloud.
Get an ExpressRoute Circuit Authorization by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ExpressRouteAuthorization or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ExpressRouteAuthorization
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: Union[_models.ExpressRouteAuthorization, IO],
**kwargs: Any
) -> _models.ExpressRouteAuthorization:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(authorization, (IOBase, bytes)):
_content = authorization
else:
_json = self._serialize.body(authorization, "ExpressRouteAuthorization")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: _models.ExpressRouteAuthorization,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ExpressRouteAuthorization]:
"""Create or update an ExpressRoute Circuit Authorization in a private cloud.
Create or update an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:param authorization: An ExpressRoute Circuit Authorization. Required.
:type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ExpressRouteAuthorization or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ExpressRouteAuthorization]:
"""Create or update an ExpressRoute Circuit Authorization in a private cloud.
Create or update an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:param authorization: An ExpressRoute Circuit Authorization. Required.
:type authorization: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ExpressRouteAuthorization or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
authorization_name: str,
authorization: Union[_models.ExpressRouteAuthorization, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.ExpressRouteAuthorization]:
"""Create or update an ExpressRoute Circuit Authorization in a private cloud.
Create or update an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:param authorization: An ExpressRoute Circuit Authorization. Is either a
ExpressRouteAuthorization type or a IO type. Required.
:type authorization: ~azure.mgmt.avs.models.ExpressRouteAuthorization or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ExpressRouteAuthorization or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ExpressRouteAuthorization] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
authorization=authorization,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ExpressRouteAuthorization", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, authorization_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete an ExpressRoute Circuit Authorization in a private cloud.
Delete an ExpressRoute Circuit Authorization in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param authorization_name: Name of the ExpressRoute Circuit Authorization in the private cloud.
Required.
:type authorization_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
authorization_name=authorization_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/authorizations/{authorizationName}"
}
| 0.891315 | 0.084758 |
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._private_clouds_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_admin_credentials_request,
build_list_in_subscription_request,
build_list_request,
build_rotate_nsxt_password_request,
build_rotate_vcenter_password_request,
build_update_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class PrivateCloudsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`private_clouds` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.PrivateCloud"]:
"""List private clouds in a resource group.
List private clouds in a resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateCloud or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateCloudList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateCloudList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
}
@distributed_trace
def list_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PrivateCloud"]:
"""List private clouds in a subscription.
List private clouds in a subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateCloud or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateCloudList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_in_subscription_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_in_subscription.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateCloudList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds"}
@distributed_trace_async
async def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> _models.PrivateCloud:
"""Get a private cloud.
Get a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateCloud or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.PrivateCloud
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: Union[_models.PrivateCloud, IO],
**kwargs: Any
) -> _models.PrivateCloud:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(private_cloud, (IOBase, bytes)):
_content = private_cloud
else:
_json = self._serialize.body(private_cloud, "PrivateCloud")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: _models.PrivateCloud,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateCloud]:
"""Create or update a private cloud.
Create or update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud: The private cloud. Required.
:type private_cloud: ~azure.mgmt.avs.models.PrivateCloud
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateCloud]:
"""Create or update a private cloud.
Create or update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud: The private cloud. Required.
:type private_cloud: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: Union[_models.PrivateCloud, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateCloud]:
"""Create or update a private cloud.
Create or update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud: The private cloud. Is either a PrivateCloud type or a IO type. Required.
:type private_cloud: ~azure.mgmt.avs.models.PrivateCloud or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
private_cloud=private_cloud,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
async def _update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: Union[_models.PrivateCloudUpdate, IO],
**kwargs: Any
) -> _models.PrivateCloud:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(private_cloud_update, (IOBase, bytes)):
_content = private_cloud_update
else:
_json = self._serialize.body(private_cloud_update, "PrivateCloudUpdate")
request = build_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
@overload
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: _models.PrivateCloudUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateCloud]:
"""Update a private cloud.
Update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud_update: The private cloud properties to be updated. Required.
:type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateCloud]:
"""Update a private cloud.
Update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud_update: The private cloud properties to be updated. Required.
:type private_cloud_update: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: Union[_models.PrivateCloudUpdate, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateCloud]:
"""Update a private cloud.
Update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud_update: The private cloud properties to be updated. Is either a
PrivateCloudUpdate type or a IO type. Required.
:type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
private_cloud_update=private_cloud_update,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a private cloud.
Delete a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
async def _rotate_vcenter_password_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_rotate_vcenter_password_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._rotate_vcenter_password_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_rotate_vcenter_password_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword"
}
@distributed_trace_async
async def begin_rotate_vcenter_password(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Rotate the vCenter password.
Rotate the vCenter password.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._rotate_vcenter_password_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_rotate_vcenter_password.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword"
}
async def _rotate_nsxt_password_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_rotate_nsxt_password_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._rotate_nsxt_password_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_rotate_nsxt_password_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword"
}
@distributed_trace_async
async def begin_rotate_nsxt_password(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Rotate the NSX-T Manager password.
Rotate the NSX-T Manager password.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._rotate_nsxt_password_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_rotate_nsxt_password.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword"
}
@distributed_trace_async
async def list_admin_credentials(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> _models.AdminCredentials:
"""List the admin credentials for the private cloud.
List the admin credentials for the private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AdminCredentials or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.AdminCredentials
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AdminCredentials] = kwargs.pop("cls", None)
request = build_list_admin_credentials_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_admin_credentials.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("AdminCredentials", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list_admin_credentials.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_private_clouds_operations.py
|
_private_clouds_operations.py
|
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._private_clouds_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_admin_credentials_request,
build_list_in_subscription_request,
build_list_request,
build_rotate_nsxt_password_request,
build_rotate_vcenter_password_request,
build_update_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class PrivateCloudsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`private_clouds` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.PrivateCloud"]:
"""List private clouds in a resource group.
List private clouds in a resource group.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateCloud or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateCloudList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateCloudList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds"
}
@distributed_trace
def list_in_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PrivateCloud"]:
"""List private clouds in a subscription.
List private clouds in a subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PrivateCloud or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateCloudList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_in_subscription_request(
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_in_subscription.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PrivateCloudList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_in_subscription.metadata = {"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/privateClouds"}
@distributed_trace_async
async def get(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> _models.PrivateCloud:
"""Get a private cloud.
Get a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PrivateCloud or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.PrivateCloud
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: Union[_models.PrivateCloud, IO],
**kwargs: Any
) -> _models.PrivateCloud:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(private_cloud, (IOBase, bytes)):
_content = private_cloud
else:
_json = self._serialize.body(private_cloud, "PrivateCloud")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: _models.PrivateCloud,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateCloud]:
"""Create or update a private cloud.
Create or update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud: The private cloud. Required.
:type private_cloud: ~azure.mgmt.avs.models.PrivateCloud
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateCloud]:
"""Create or update a private cloud.
Create or update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud: The private cloud. Required.
:type private_cloud: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud: Union[_models.PrivateCloud, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateCloud]:
"""Create or update a private cloud.
Create or update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud: The private cloud. Is either a PrivateCloud type or a IO type. Required.
:type private_cloud: ~azure.mgmt.avs.models.PrivateCloud or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
private_cloud=private_cloud,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
async def _update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: Union[_models.PrivateCloudUpdate, IO],
**kwargs: Any
) -> _models.PrivateCloud:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(private_cloud_update, (IOBase, bytes)):
_content = private_cloud_update
else:
_json = self._serialize.body(private_cloud_update, "PrivateCloudUpdate")
request = build_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
@overload
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: _models.PrivateCloudUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateCloud]:
"""Update a private cloud.
Update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud_update: The private cloud properties to be updated. Required.
:type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateCloud]:
"""Update a private cloud.
Update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud_update: The private cloud properties to be updated. Required.
:type private_cloud_update: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
private_cloud_update: Union[_models.PrivateCloudUpdate, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.PrivateCloud]:
"""Update a private cloud.
Update a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param private_cloud_update: The private cloud properties to be updated. Is either a
PrivateCloudUpdate type or a IO type. Required.
:type private_cloud_update: ~azure.mgmt.avs.models.PrivateCloudUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PrivateCloud or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PrivateCloud]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PrivateCloud] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
private_cloud_update=private_cloud_update,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PrivateCloud", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a private cloud.
Delete a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}"
}
async def _rotate_vcenter_password_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_rotate_vcenter_password_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._rotate_vcenter_password_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_rotate_vcenter_password_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword"
}
@distributed_trace_async
async def begin_rotate_vcenter_password(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Rotate the vCenter password.
Rotate the vCenter password.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._rotate_vcenter_password_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_rotate_vcenter_password.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateVcenterPassword"
}
async def _rotate_nsxt_password_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_rotate_nsxt_password_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._rotate_nsxt_password_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_rotate_nsxt_password_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword"
}
@distributed_trace_async
async def begin_rotate_nsxt_password(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Rotate the NSX-T Manager password.
Rotate the NSX-T Manager password.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._rotate_nsxt_password_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_rotate_nsxt_password.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/rotateNsxtPassword"
}
@distributed_trace_async
async def list_admin_credentials(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> _models.AdminCredentials:
"""List the admin credentials for the private cloud.
List the admin credentials for the private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AdminCredentials or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.AdminCredentials
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AdminCredentials] = kwargs.pop("cls", None)
request = build_list_admin_credentials_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_admin_credentials.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("AdminCredentials", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list_admin_credentials.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/listAdminCredentials"
}
| 0.882035 | 0.07603 |
from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._locations_operations import (
build_check_quota_availability_request,
build_check_trial_availability_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class LocationsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`locations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@overload
async def check_trial_availability(
self, location: str, sku: Optional[_models.Sku] = None, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Trial:
"""Return trial status for subscription by region.
:param location: Azure region. Required.
:type location: str
:param sku: The sku to check for trial availability. Default value is None.
:type sku: ~azure.mgmt.avs.models.Sku
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Trial or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Trial
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def check_trial_availability(
self, location: str, sku: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Trial:
"""Return trial status for subscription by region.
:param location: Azure region. Required.
:type location: str
:param sku: The sku to check for trial availability. Default value is None.
:type sku: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Trial or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Trial
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def check_trial_availability(
self, location: str, sku: Optional[Union[_models.Sku, IO]] = None, **kwargs: Any
) -> _models.Trial:
"""Return trial status for subscription by region.
:param location: Azure region. Required.
:type location: str
:param sku: The sku to check for trial availability. Is either a Sku type or a IO type. Default
value is None.
:type sku: ~azure.mgmt.avs.models.Sku or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Trial or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Trial
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Trial] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(sku, (IOBase, bytes)):
_content = sku
else:
if sku is not None:
_json = self._serialize.body(sku, "Sku")
else:
_json = None
request = build_check_trial_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.check_trial_availability.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Trial", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
check_trial_availability.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability"
}
@distributed_trace_async
async def check_quota_availability(self, location: str, **kwargs: Any) -> _models.Quota:
"""Return quota for subscription by region.
:param location: Azure region. Required.
:type location: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Quota or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Quota
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Quota] = kwargs.pop("cls", None)
request = build_check_quota_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.check_quota_availability.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Quota", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
check_quota_availability.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_locations_operations.py
|
_locations_operations.py
|
from io import IOBase
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, overload
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._locations_operations import (
build_check_quota_availability_request,
build_check_trial_availability_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class LocationsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`locations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@overload
async def check_trial_availability(
self, location: str, sku: Optional[_models.Sku] = None, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Trial:
"""Return trial status for subscription by region.
:param location: Azure region. Required.
:type location: str
:param sku: The sku to check for trial availability. Default value is None.
:type sku: ~azure.mgmt.avs.models.Sku
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Trial or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Trial
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def check_trial_availability(
self, location: str, sku: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Trial:
"""Return trial status for subscription by region.
:param location: Azure region. Required.
:type location: str
:param sku: The sku to check for trial availability. Default value is None.
:type sku: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Trial or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Trial
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def check_trial_availability(
self, location: str, sku: Optional[Union[_models.Sku, IO]] = None, **kwargs: Any
) -> _models.Trial:
"""Return trial status for subscription by region.
:param location: Azure region. Required.
:type location: str
:param sku: The sku to check for trial availability. Is either a Sku type or a IO type. Default
value is None.
:type sku: ~azure.mgmt.avs.models.Sku or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Trial or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Trial
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Trial] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(sku, (IOBase, bytes)):
_content = sku
else:
if sku is not None:
_json = self._serialize.body(sku, "Sku")
else:
_json = None
request = build_check_trial_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.check_trial_availability.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Trial", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
check_trial_availability.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkTrialAvailability"
}
@distributed_trace_async
async def check_quota_availability(self, location: str, **kwargs: Any) -> _models.Quota:
"""Return quota for subscription by region.
:param location: Azure region. Required.
:type location: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Quota or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Quota
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Quota] = kwargs.pop("cls", None)
request = build_check_quota_availability_request(
location=location,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.check_quota_availability.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Quota", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
check_quota_availability.metadata = {
"url": "/subscriptions/{subscriptionId}/providers/Microsoft.AVS/locations/{location}/checkQuotaAvailability"
}
| 0.917441 | 0.093802 |
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._cloud_links_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class CloudLinksOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`cloud_links` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.CloudLink"]:
"""List cloud link in a private cloud.
List cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either CloudLink or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CloudLinkList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("CloudLinkList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any
) -> _models.CloudLink:
"""Get an cloud link by name in a private cloud.
Get an cloud link by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: CloudLink or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.CloudLink
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("CloudLink", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: Union[_models.CloudLink, IO],
**kwargs: Any
) -> _models.CloudLink:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cloud_link, (IOBase, bytes)):
_content = cloud_link
else:
_json = self._serialize.body(cloud_link, "CloudLink")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("CloudLink", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("CloudLink", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: _models.CloudLink,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.CloudLink]:
"""Create or update a cloud link in a private cloud.
Create or update a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:param cloud_link: A cloud link in the private cloud. Required.
:type cloud_link: ~azure.mgmt.avs.models.CloudLink
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either CloudLink or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.CloudLink]:
"""Create or update a cloud link in a private cloud.
Create or update a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:param cloud_link: A cloud link in the private cloud. Required.
:type cloud_link: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either CloudLink or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: Union[_models.CloudLink, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.CloudLink]:
"""Create or update a cloud link in a private cloud.
Create or update a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:param cloud_link: A cloud link in the private cloud. Is either a CloudLink type or a IO type.
Required.
:type cloud_link: ~azure.mgmt.avs.models.CloudLink or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either CloudLink or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
cloud_link=cloud_link,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CloudLink", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a cloud link in a private cloud.
Delete a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_cloud_links_operations.py
|
_cloud_links_operations.py
|
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._cloud_links_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class CloudLinksOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`cloud_links` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.CloudLink"]:
"""List cloud link in a private cloud.
List cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either CloudLink or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CloudLinkList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("CloudLinkList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any
) -> _models.CloudLink:
"""Get an cloud link by name in a private cloud.
Get an cloud link by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: CloudLink or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.CloudLink
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("CloudLink", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: Union[_models.CloudLink, IO],
**kwargs: Any
) -> _models.CloudLink:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cloud_link, (IOBase, bytes)):
_content = cloud_link
else:
_json = self._serialize.body(cloud_link, "CloudLink")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("CloudLink", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("CloudLink", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: _models.CloudLink,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.CloudLink]:
"""Create or update a cloud link in a private cloud.
Create or update a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:param cloud_link: A cloud link in the private cloud. Required.
:type cloud_link: ~azure.mgmt.avs.models.CloudLink
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either CloudLink or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.CloudLink]:
"""Create or update a cloud link in a private cloud.
Create or update a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:param cloud_link: A cloud link in the private cloud. Required.
:type cloud_link: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either CloudLink or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cloud_link_name: str,
cloud_link: Union[_models.CloudLink, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.CloudLink]:
"""Create or update a cloud link in a private cloud.
Create or update a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:param cloud_link: A cloud link in the private cloud. Is either a CloudLink type or a IO type.
Required.
:type cloud_link: ~azure.mgmt.avs.models.CloudLink or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either CloudLink or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.CloudLink]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.CloudLink] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
cloud_link=cloud_link,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("CloudLink", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, cloud_link_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a cloud link in a private cloud.
Delete a cloud link in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cloud_link_name: Name of the cloud link resource. Required.
:type cloud_link_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cloud_link_name=cloud_link_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/cloudLinks/{cloudLinkName}"
}
| 0.901894 | 0.08548 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._script_cmdlets_operations import build_get_request, build_list_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ScriptCmdletsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`script_cmdlets` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, script_package_name: str, **kwargs: Any
) -> AsyncIterable["_models.ScriptCmdlet"]:
"""List script cmdlet resources available for a private cloud to create a script execution
resource on a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_package_name: Name of the script package in the private cloud. Required.
:type script_package_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScriptCmdlet or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ScriptCmdlet]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptCmdletsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_package_name=script_package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ScriptCmdletsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets"
}
@distributed_trace_async
async def get(
self,
resource_group_name: str,
private_cloud_name: str,
script_package_name: str,
script_cmdlet_name: str,
**kwargs: Any
) -> _models.ScriptCmdlet:
"""Return information about a script cmdlet resource in a specific package on a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_package_name: Name of the script package in the private cloud. Required.
:type script_package_name: str
:param script_cmdlet_name: Name of the script cmdlet resource in the script package in the
private cloud. Required.
:type script_cmdlet_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptCmdlet or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptCmdlet
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptCmdlet] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_package_name=script_package_name,
script_cmdlet_name=script_cmdlet_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptCmdlet", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_script_cmdlets_operations.py
|
_script_cmdlets_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._script_cmdlets_operations import build_get_request, build_list_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ScriptCmdletsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`script_cmdlets` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, script_package_name: str, **kwargs: Any
) -> AsyncIterable["_models.ScriptCmdlet"]:
"""List script cmdlet resources available for a private cloud to create a script execution
resource on a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_package_name: Name of the script package in the private cloud. Required.
:type script_package_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScriptCmdlet or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ScriptCmdlet]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptCmdletsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_package_name=script_package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ScriptCmdletsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets"
}
@distributed_trace_async
async def get(
self,
resource_group_name: str,
private_cloud_name: str,
script_package_name: str,
script_cmdlet_name: str,
**kwargs: Any
) -> _models.ScriptCmdlet:
"""Return information about a script cmdlet resource in a specific package on a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_package_name: Name of the script package in the private cloud. Required.
:type script_package_name: str
:param script_cmdlet_name: Name of the script cmdlet resource in the script package in the
private cloud. Required.
:type script_cmdlet_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptCmdlet or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptCmdlet
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptCmdlet] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_package_name=script_package_name,
script_cmdlet_name=script_cmdlet_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptCmdlet", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}/scriptCmdlets/{scriptCmdletName}"
}
| 0.872931 | 0.108945 |
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._script_executions_operations import (
build_create_or_update_request,
build_delete_request,
build_get_execution_logs_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ScriptExecutionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`script_executions` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.ScriptExecution"]:
"""List script executions in a private cloud.
List script executions in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScriptExecution or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptExecutionsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ScriptExecutionsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any
) -> _models.ScriptExecution:
"""Get an script execution by name in a private cloud.
Get an script execution by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: Union[_models.ScriptExecution, IO],
**kwargs: Any
) -> _models.ScriptExecution:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(script_execution, (IOBase, bytes)):
_content = script_execution
else:
_json = self._serialize.body(script_execution, "ScriptExecution")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: _models.ScriptExecution,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ScriptExecution]:
"""Create or update a script execution in a private cloud.
Create or update a script execution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_execution: A script running in the private cloud. Required.
:type script_execution: ~azure.mgmt.avs.models.ScriptExecution
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ScriptExecution or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ScriptExecution]:
"""Create or update a script execution in a private cloud.
Create or update a script execution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_execution: A script running in the private cloud. Required.
:type script_execution: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ScriptExecution or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: Union[_models.ScriptExecution, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.ScriptExecution]:
"""Create or update a script execution in a private cloud.
Create or update a script execution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_execution: A script running in the private cloud. Is either a ScriptExecution
type or a IO type. Required.
:type script_execution: ~azure.mgmt.avs.models.ScriptExecution or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ScriptExecution or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
script_execution=script_execution,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Cancel a ScriptExecution in a private cloud.
Cancel a ScriptExecution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
@overload
async def get_execution_logs(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_output_stream_type: Optional[List[Union[str, _models.ScriptOutputStreamType]]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.ScriptExecution:
"""Return the logs for a script execution resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_output_stream_type: Name of the desired output stream to return. If not provided,
will return all. An empty array will return nothing. Default value is None.
:type script_output_stream_type: list[str or ~azure.mgmt.avs.models.ScriptOutputStreamType]
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def get_execution_logs(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_output_stream_type: Optional[IO] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.ScriptExecution:
"""Return the logs for a script execution resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_output_stream_type: Name of the desired output stream to return. If not provided,
will return all. An empty array will return nothing. Default value is None.
:type script_output_stream_type: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def get_execution_logs(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_output_stream_type: Optional[Union[List[Union[str, _models.ScriptOutputStreamType]], IO]] = None,
**kwargs: Any
) -> _models.ScriptExecution:
"""Return the logs for a script execution resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_output_stream_type: Name of the desired output stream to return. If not provided,
will return all. An empty array will return nothing. Is either a [Union[str,
"_models.ScriptOutputStreamType"]] type or a IO type. Default value is None.
:type script_output_stream_type: list[str or ~azure.mgmt.avs.models.ScriptOutputStreamType] or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(script_output_stream_type, (IOBase, bytes)):
_content = script_output_stream_type
else:
if script_output_stream_type is not None:
_json = self._serialize.body(script_output_stream_type, "[str]")
else:
_json = None
request = build_get_execution_logs_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.get_execution_logs.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_execution_logs.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_script_executions_operations.py
|
_script_executions_operations.py
|
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._script_executions_operations import (
build_create_or_update_request,
build_delete_request,
build_get_execution_logs_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ScriptExecutionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`script_executions` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.ScriptExecution"]:
"""List script executions in a private cloud.
List script executions in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScriptExecution or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptExecutionsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ScriptExecutionsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any
) -> _models.ScriptExecution:
"""Get an script execution by name in a private cloud.
Get an script execution by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: Union[_models.ScriptExecution, IO],
**kwargs: Any
) -> _models.ScriptExecution:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(script_execution, (IOBase, bytes)):
_content = script_execution
else:
_json = self._serialize.body(script_execution, "ScriptExecution")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: _models.ScriptExecution,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ScriptExecution]:
"""Create or update a script execution in a private cloud.
Create or update a script execution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_execution: A script running in the private cloud. Required.
:type script_execution: ~azure.mgmt.avs.models.ScriptExecution
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ScriptExecution or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.ScriptExecution]:
"""Create or update a script execution in a private cloud.
Create or update a script execution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_execution: A script running in the private cloud. Required.
:type script_execution: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ScriptExecution or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_execution: Union[_models.ScriptExecution, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.ScriptExecution]:
"""Create or update a script execution in a private cloud.
Create or update a script execution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_execution: A script running in the private cloud. Is either a ScriptExecution
type or a IO type. Required.
:type script_execution: ~azure.mgmt.avs.models.ScriptExecution or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either ScriptExecution or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.ScriptExecution]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
script_execution=script_execution,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, script_execution_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Cancel a ScriptExecution in a private cloud.
Cancel a ScriptExecution in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}"
}
@overload
async def get_execution_logs(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_output_stream_type: Optional[List[Union[str, _models.ScriptOutputStreamType]]] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.ScriptExecution:
"""Return the logs for a script execution resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_output_stream_type: Name of the desired output stream to return. If not provided,
will return all. An empty array will return nothing. Default value is None.
:type script_output_stream_type: list[str or ~azure.mgmt.avs.models.ScriptOutputStreamType]
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def get_execution_logs(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_output_stream_type: Optional[IO] = None,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.ScriptExecution:
"""Return the logs for a script execution resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_output_stream_type: Name of the desired output stream to return. If not provided,
will return all. An empty array will return nothing. Default value is None.
:type script_output_stream_type: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def get_execution_logs(
self,
resource_group_name: str,
private_cloud_name: str,
script_execution_name: str,
script_output_stream_type: Optional[Union[List[Union[str, _models.ScriptOutputStreamType]], IO]] = None,
**kwargs: Any
) -> _models.ScriptExecution:
"""Return the logs for a script execution resource.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_execution_name: Name of the user-invoked script execution resource. Required.
:type script_execution_name: str
:param script_output_stream_type: Name of the desired output stream to return. If not provided,
will return all. An empty array will return nothing. Is either a [Union[str,
"_models.ScriptOutputStreamType"]] type or a IO type. Default value is None.
:type script_output_stream_type: list[str or ~azure.mgmt.avs.models.ScriptOutputStreamType] or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptExecution or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptExecution
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.ScriptExecution] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(script_output_stream_type, (IOBase, bytes)):
_content = script_output_stream_type
else:
if script_output_stream_type is not None:
_json = self._serialize.body(script_output_stream_type, "[str]")
else:
_json = None
request = build_get_execution_logs_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_execution_name=script_execution_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.get_execution_logs.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptExecution", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_execution_logs.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptExecutions/{scriptExecutionName}/getExecutionLogs"
}
| 0.886008 | 0.077903 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._script_packages_operations import build_get_request, build_list_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ScriptPackagesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`script_packages` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.ScriptPackage"]:
"""List script packages available to run on the private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScriptPackage or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ScriptPackage]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptPackagesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ScriptPackagesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, script_package_name: str, **kwargs: Any
) -> _models.ScriptPackage:
"""Get a script package available to run on a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_package_name: Name of the script package in the private cloud. Required.
:type script_package_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptPackage or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptPackage
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptPackage] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_package_name=script_package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptPackage", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_script_packages_operations.py
|
_script_packages_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._script_packages_operations import build_get_request, build_list_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ScriptPackagesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`script_packages` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.ScriptPackage"]:
"""List script packages available to run on the private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ScriptPackage or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.ScriptPackage]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptPackagesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ScriptPackagesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, script_package_name: str, **kwargs: Any
) -> _models.ScriptPackage:
"""Get a script package available to run on a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param script_package_name: Name of the script package in the private cloud. Required.
:type script_package_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ScriptPackage or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ScriptPackage
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ScriptPackage] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
script_package_name=script_package_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ScriptPackage", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/scriptPackages/{scriptPackageName}"
}
| 0.876555 | 0.081046 |
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._workload_networks_operations import (
build_create_dhcp_request,
build_create_dns_service_request,
build_create_dns_zone_request,
build_create_port_mirroring_request,
build_create_public_ip_request,
build_create_segments_request,
build_create_vm_group_request,
build_delete_dhcp_request,
build_delete_dns_service_request,
build_delete_dns_zone_request,
build_delete_port_mirroring_request,
build_delete_public_ip_request,
build_delete_segment_request,
build_delete_vm_group_request,
build_get_dhcp_request,
build_get_dns_service_request,
build_get_dns_zone_request,
build_get_gateway_request,
build_get_port_mirroring_request,
build_get_public_ip_request,
build_get_request,
build_get_segment_request,
build_get_virtual_machine_request,
build_get_vm_group_request,
build_list_dhcp_request,
build_list_dns_services_request,
build_list_dns_zones_request,
build_list_gateways_request,
build_list_port_mirroring_request,
build_list_public_i_ps_request,
build_list_request,
build_list_segments_request,
build_list_virtual_machines_request,
build_list_vm_groups_request,
build_update_dhcp_request,
build_update_dns_service_request,
build_update_dns_zone_request,
build_update_port_mirroring_request,
build_update_segments_request,
build_update_vm_group_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class WorkloadNetworksOperations: # pylint: disable=too-many-public-methods
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`workload_networks` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get(
self,
resource_group_name: str,
private_cloud_name: str,
workload_network_name: Union[str, _models.WorkloadNetworkName],
**kwargs: Any
) -> _models.WorkloadNetwork:
"""Get a private cloud workload network.
Get a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param workload_network_name: Name for the workload network in the private cloud. "default"
Required.
:type workload_network_name: str or ~azure.mgmt.avs.models.WorkloadNetworkName
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetwork or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetwork
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetwork] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
workload_network_name=workload_network_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetwork", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/{workloadNetworkName}"
}
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetwork"]:
"""List of workload networks in a private cloud.
List of workload networks in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetwork or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetwork]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks"
}
@distributed_trace
def list_segments(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkSegment"]:
"""List of segments in a private cloud workload network.
List of segments in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkSegmentsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_segments_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_segments.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkSegmentsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_segments.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments"
}
@distributed_trace_async
async def get_segment(
self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any
) -> _models.WorkloadNetworkSegment:
"""Get a segment by id in a private cloud workload network.
Get a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkSegment or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkSegment
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
request = build_get_segment_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_segment.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_segment.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
async def _create_segments_initial(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> _models.WorkloadNetworkSegment:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_segment, (IOBase, bytes)):
_content = workload_network_segment
else:
_json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment")
request = build_create_segments_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_segments_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_segments_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@overload
async def begin_create_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: _models.WorkloadNetworkSegment,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkSegment]:
"""Create a segment by id in a private cloud workload network.
Create a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkSegment]:
"""Create a segment by id in a private cloud workload network.
Create a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkSegment]:
"""Create a segment by id in a private cloud workload network.
Create a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Is either a WorkloadNetworkSegment type or a IO
type. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_segments_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
workload_network_segment=workload_network_segment,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_segments.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
async def _update_segments_initial(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkSegment]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkSegment]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_segment, (IOBase, bytes)):
_content = workload_network_segment
else:
_json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment")
request = build_update_segments_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_segments_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_segments_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@overload
async def begin_update_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: _models.WorkloadNetworkSegment,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkSegment]:
"""Create or update a segment by id in a private cloud workload network.
Create or update a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkSegment]:
"""Create or update a segment by id in a private cloud workload network.
Create or update a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkSegment]:
"""Create or update a segment by id in a private cloud workload network.
Create or update a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Is either a WorkloadNetworkSegment type or a IO
type. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_segments_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
workload_network_segment=workload_network_segment,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_segments.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
async def _delete_segment_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_segment_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_segment_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_segment_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@distributed_trace_async
async def begin_delete_segment(
self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a segment by id in a private cloud workload network.
Delete a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_segment_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_segment.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@distributed_trace
def list_dhcp(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkDhcp"]:
"""List dhcp in a private cloud workload network.
List dhcp in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkDhcp or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDhcpList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_dhcp.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDhcpList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations"
}
@distributed_trace_async
async def get_dhcp(
self, resource_group_name: str, dhcp_id: str, private_cloud_name: str, **kwargs: Any
) -> _models.WorkloadNetworkDhcp:
"""Get dhcp by id in a private cloud workload network.
Get dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkDhcp or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkDhcp
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
request = build_get_dhcp_request(
resource_group_name=resource_group_name,
dhcp_id=dhcp_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_dhcp.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
async def _create_dhcp_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> _models.WorkloadNetworkDhcp:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dhcp, (IOBase, bytes)):
_content = workload_network_dhcp
else:
_json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp")
request = build_create_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_dhcp_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_dhcp_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@overload
async def begin_create_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: _models.WorkloadNetworkDhcp,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]:
"""Create dhcp by id in a private cloud workload network.
Create dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]:
"""Create dhcp by id in a private cloud workload network.
Create dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]:
"""Create dhcp by id in a private cloud workload network.
Create dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Is either a WorkloadNetworkDhcp type or a IO type.
Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_dhcp_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
workload_network_dhcp=workload_network_dhcp,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
async def _update_dhcp_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkDhcp]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkDhcp]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dhcp, (IOBase, bytes)):
_content = workload_network_dhcp
else:
_json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp")
request = build_update_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_dhcp_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_dhcp_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@overload
async def begin_update_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: _models.WorkloadNetworkDhcp,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]:
"""Create or update dhcp by id in a private cloud workload network.
Create or update dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]:
"""Create or update dhcp by id in a private cloud workload network.
Create or update dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]:
"""Create or update dhcp by id in a private cloud workload network.
Create or update dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Is either a WorkloadNetworkDhcp type or a IO type.
Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_dhcp_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
workload_network_dhcp=workload_network_dhcp,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
async def _delete_dhcp_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_dhcp_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_dhcp_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@distributed_trace_async
async def begin_delete_dhcp(
self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete dhcp by id in a private cloud workload network.
Delete dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_dhcp_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@distributed_trace
def list_gateways(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkGateway"]:
"""List of gateways in a private cloud workload network.
List of gateways in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkGateway or the result of
cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkGateway]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkGatewayList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_gateways_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_gateways.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkGatewayList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_gateways.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways"
}
@distributed_trace_async
async def get_gateway(
self, resource_group_name: str, private_cloud_name: str, gateway_id: str, **kwargs: Any
) -> _models.WorkloadNetworkGateway:
"""Get a gateway by id in a private cloud workload network.
Get a gateway by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param gateway_id: NSX Gateway identifier. Generally the same as the Gateway's display name.
Required.
:type gateway_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkGateway or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkGateway
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkGateway] = kwargs.pop("cls", None)
request = build_get_gateway_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
gateway_id=gateway_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_gateway.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkGateway", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_gateway.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}"
}
@distributed_trace
def list_port_mirroring(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkPortMirroring"]:
"""List of port mirroring profiles in a private cloud workload network.
List of port mirroring profiles in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkPortMirroring or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPortMirroringList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_port_mirroring.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPortMirroringList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles"
}
@distributed_trace_async
async def get_port_mirroring(
self, resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, **kwargs: Any
) -> _models.WorkloadNetworkPortMirroring:
"""Get a port mirroring profile by id in a private cloud workload network.
Get a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkPortMirroring or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
request = build_get_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_port_mirroring.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
async def _create_port_mirroring_initial(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> _models.WorkloadNetworkPortMirroring:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_port_mirroring, (IOBase, bytes)):
_content = workload_network_port_mirroring
else:
_json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring")
request = build_create_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_port_mirroring_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_port_mirroring_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@overload
async def begin_create_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create a port mirroring profile by id in a private cloud workload network.
Create a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create a port mirroring profile by id in a private cloud workload network.
Create a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create a port mirroring profile by id in a private cloud workload network.
Create a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Is either a
WorkloadNetworkPortMirroring type or a IO type. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_port_mirroring_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
workload_network_port_mirroring=workload_network_port_mirroring,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
async def _update_port_mirroring_initial(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkPortMirroring]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkPortMirroring]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_port_mirroring, (IOBase, bytes)):
_content = workload_network_port_mirroring
else:
_json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring")
request = build_update_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_port_mirroring_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_port_mirroring_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@overload
async def begin_update_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create or update a port mirroring profile by id in a private cloud workload network.
Create or update a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create or update a port mirroring profile by id in a private cloud workload network.
Create or update a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create or update a port mirroring profile by id in a private cloud workload network.
Create or update a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Is either a
WorkloadNetworkPortMirroring type or a IO type. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_port_mirroring_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
workload_network_port_mirroring=workload_network_port_mirroring,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
async def _delete_port_mirroring_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_port_mirroring_request(
resource_group_name=resource_group_name,
port_mirroring_id=port_mirroring_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_port_mirroring_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_port_mirroring_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@distributed_trace_async
async def begin_delete_port_mirroring(
self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a port mirroring profile by id in a private cloud workload network.
Delete a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_port_mirroring_initial( # type: ignore
resource_group_name=resource_group_name,
port_mirroring_id=port_mirroring_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@distributed_trace
def list_vm_groups(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkVMGroup"]:
"""List of vm groups in a private cloud workload network.
List of vm groups in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVMGroupsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_vm_groups_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_vm_groups.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVMGroupsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_vm_groups.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups"
}
@distributed_trace_async
async def get_vm_group(
self, resource_group_name: str, private_cloud_name: str, vm_group_id: str, **kwargs: Any
) -> _models.WorkloadNetworkVMGroup:
"""Get a vm group by id in a private cloud workload network.
Get a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkVMGroup or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
request = build_get_vm_group_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_vm_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
async def _create_vm_group_initial(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> _models.WorkloadNetworkVMGroup:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_vm_group, (IOBase, bytes)):
_content = workload_network_vm_group
else:
_json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup")
request = build_create_vm_group_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_vm_group_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_vm_group_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@overload
async def begin_create_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: _models.WorkloadNetworkVMGroup,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]:
"""Create a vm group by id in a private cloud workload network.
Create a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]:
"""Create a vm group by id in a private cloud workload network.
Create a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]:
"""Create a vm group by id in a private cloud workload network.
Create a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Is either a WorkloadNetworkVMGroup type or a IO
type. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_vm_group_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
workload_network_vm_group=workload_network_vm_group,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
async def _update_vm_group_initial(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkVMGroup]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkVMGroup]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_vm_group, (IOBase, bytes)):
_content = workload_network_vm_group
else:
_json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup")
request = build_update_vm_group_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_vm_group_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_vm_group_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@overload
async def begin_update_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: _models.WorkloadNetworkVMGroup,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]:
"""Create or update a vm group by id in a private cloud workload network.
Create or update a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]:
"""Create or update a vm group by id in a private cloud workload network.
Create or update a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]:
"""Create or update a vm group by id in a private cloud workload network.
Create or update a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Is either a WorkloadNetworkVMGroup type or a IO
type. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_vm_group_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
workload_network_vm_group=workload_network_vm_group,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
async def _delete_vm_group_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_vm_group_request(
resource_group_name=resource_group_name,
vm_group_id=vm_group_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_vm_group_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_vm_group_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@distributed_trace_async
async def begin_delete_vm_group(
self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a vm group by id in a private cloud workload network.
Delete a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_vm_group_initial( # type: ignore
resource_group_name=resource_group_name,
vm_group_id=vm_group_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@distributed_trace
def list_virtual_machines(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkVirtualMachine"]:
"""List of virtual machines in a private cloud workload network.
List of virtual machines in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkVirtualMachine or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVirtualMachinesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_virtual_machines_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_virtual_machines.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVirtualMachinesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_virtual_machines.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines"
}
@distributed_trace_async
async def get_virtual_machine(
self, resource_group_name: str, private_cloud_name: str, virtual_machine_id: str, **kwargs: Any
) -> _models.WorkloadNetworkVirtualMachine:
"""Get a virtual machine by id in a private cloud workload network.
Get a virtual machine by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkVirtualMachine or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVirtualMachine] = kwargs.pop("cls", None)
request = build_get_virtual_machine_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
virtual_machine_id=virtual_machine_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_virtual_machine.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkVirtualMachine", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_virtual_machine.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}"
}
@distributed_trace
def list_dns_services(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkDnsService"]:
"""List of DNS services in a private cloud workload network.
List of DNS services in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkDnsService or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsServicesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_dns_services_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_dns_services.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsServicesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_dns_services.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices"
}
@distributed_trace_async
async def get_dns_service(
self, resource_group_name: str, private_cloud_name: str, dns_service_id: str, **kwargs: Any
) -> _models.WorkloadNetworkDnsService:
"""Get a DNS service by id in a private cloud workload network.
Get a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkDnsService or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsService
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
request = build_get_dns_service_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_dns_service.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
async def _create_dns_service_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> _models.WorkloadNetworkDnsService:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_service, (IOBase, bytes)):
_content = workload_network_dns_service
else:
_json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService")
request = build_create_dns_service_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_dns_service_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_dns_service_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@overload
async def begin_create_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: _models.WorkloadNetworkDnsService,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]:
"""Create a DNS service by id in a private cloud workload network.
Create a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]:
"""Create a DNS service by id in a private cloud workload network.
Create a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]:
"""Create a DNS service by id in a private cloud workload network.
Create a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Is either a WorkloadNetworkDnsService
type or a IO type. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_dns_service_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
workload_network_dns_service=workload_network_dns_service,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
async def _update_dns_service_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkDnsService]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkDnsService]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_service, (IOBase, bytes)):
_content = workload_network_dns_service
else:
_json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService")
request = build_update_dns_service_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_dns_service_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_dns_service_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@overload
async def begin_update_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: _models.WorkloadNetworkDnsService,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]:
"""Create or update a DNS service by id in a private cloud workload network.
Create or update a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]:
"""Create or update a DNS service by id in a private cloud workload network.
Create or update a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]:
"""Create or update a DNS service by id in a private cloud workload network.
Create or update a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Is either a WorkloadNetworkDnsService
type or a IO type. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_dns_service_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
workload_network_dns_service=workload_network_dns_service,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
async def _delete_dns_service_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_dns_service_request(
resource_group_name=resource_group_name,
dns_service_id=dns_service_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_dns_service_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_dns_service_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@distributed_trace_async
async def begin_delete_dns_service(
self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a DNS service by id in a private cloud workload network.
Delete a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_dns_service_initial( # type: ignore
resource_group_name=resource_group_name,
dns_service_id=dns_service_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@distributed_trace
def list_dns_zones(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkDnsZone"]:
"""List of DNS zones in a private cloud workload network.
List of DNS zones in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsZonesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_dns_zones_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_dns_zones.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsZonesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_dns_zones.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones"
}
@distributed_trace_async
async def get_dns_zone(
self, resource_group_name: str, private_cloud_name: str, dns_zone_id: str, **kwargs: Any
) -> _models.WorkloadNetworkDnsZone:
"""Get a DNS zone by id in a private cloud workload network.
Get a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkDnsZone or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
request = build_get_dns_zone_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_dns_zone.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
async def _create_dns_zone_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> _models.WorkloadNetworkDnsZone:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_zone, (IOBase, bytes)):
_content = workload_network_dns_zone
else:
_json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone")
request = build_create_dns_zone_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_dns_zone_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_dns_zone_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@overload
async def begin_create_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: _models.WorkloadNetworkDnsZone,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]:
"""Create a DNS zone by id in a private cloud workload network.
Create a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]:
"""Create a DNS zone by id in a private cloud workload network.
Create a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]:
"""Create a DNS zone by id in a private cloud workload network.
Create a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Is either a WorkloadNetworkDnsZone type or a IO
type. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_dns_zone_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
workload_network_dns_zone=workload_network_dns_zone,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
async def _update_dns_zone_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkDnsZone]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkDnsZone]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_zone, (IOBase, bytes)):
_content = workload_network_dns_zone
else:
_json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone")
request = build_update_dns_zone_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_dns_zone_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_dns_zone_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@overload
async def begin_update_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: _models.WorkloadNetworkDnsZone,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]:
"""Create or update a DNS zone by id in a private cloud workload network.
Create or update a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]:
"""Create or update a DNS zone by id in a private cloud workload network.
Create or update a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]:
"""Create or update a DNS zone by id in a private cloud workload network.
Create or update a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Is either a WorkloadNetworkDnsZone type or a IO
type. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_dns_zone_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
workload_network_dns_zone=workload_network_dns_zone,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
async def _delete_dns_zone_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_dns_zone_request(
resource_group_name=resource_group_name,
dns_zone_id=dns_zone_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_dns_zone_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_dns_zone_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@distributed_trace_async
async def begin_delete_dns_zone(
self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a DNS zone by id in a private cloud workload network.
Delete a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_dns_zone_initial( # type: ignore
resource_group_name=resource_group_name,
dns_zone_id=dns_zone_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@distributed_trace
def list_public_i_ps(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkPublicIP"]:
"""List of Public IP Blocks in a private cloud workload network.
List of Public IP Blocks in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkPublicIP or the result of
cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPublicIPsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_public_i_ps_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_public_i_ps.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPublicIPsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_public_i_ps.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs"
}
@distributed_trace_async
async def get_public_ip(
self, resource_group_name: str, private_cloud_name: str, public_ip_id: str, **kwargs: Any
) -> _models.WorkloadNetworkPublicIP:
"""Get a Public IP Block by id in a private cloud workload network.
Get a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkPublicIP or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None)
request = build_get_public_ip_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
public_ip_id=public_ip_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_public_ip.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_public_ip.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
async def _create_public_ip_initial(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO],
**kwargs: Any
) -> _models.WorkloadNetworkPublicIP:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_public_ip, (IOBase, bytes)):
_content = workload_network_public_ip
else:
_json = self._serialize.body(workload_network_public_ip, "WorkloadNetworkPublicIP")
request = build_create_public_ip_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
public_ip_id=public_ip_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_public_ip_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_public_ip_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
@overload
async def begin_create_public_ip(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: _models.WorkloadNetworkPublicIP,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPublicIP]:
"""Create a Public IP Block by id in a private cloud workload network.
Create a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param workload_network_public_ip: NSX Public IP Block. Required.
:type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPublicIP or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_public_ip(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPublicIP]:
"""Create a Public IP Block by id in a private cloud workload network.
Create a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param workload_network_public_ip: NSX Public IP Block. Required.
:type workload_network_public_ip: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPublicIP or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_public_ip(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPublicIP]:
"""Create a Public IP Block by id in a private cloud workload network.
Create a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param workload_network_public_ip: NSX Public IP Block. Is either a WorkloadNetworkPublicIP
type or a IO type. Required.
:type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPublicIP or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_public_ip_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
public_ip_id=public_ip_id,
workload_network_public_ip=workload_network_public_ip,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_public_ip.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
async def _delete_public_ip_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_public_ip_request(
resource_group_name=resource_group_name,
public_ip_id=public_ip_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_public_ip_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_public_ip_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
@distributed_trace_async
async def begin_delete_public_ip(
self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a Public IP Block by id in a private cloud workload network.
Delete a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_public_ip_initial( # type: ignore
resource_group_name=resource_group_name,
public_ip_id=public_ip_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_public_ip.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_workload_networks_operations.py
|
_workload_networks_operations.py
|
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._workload_networks_operations import (
build_create_dhcp_request,
build_create_dns_service_request,
build_create_dns_zone_request,
build_create_port_mirroring_request,
build_create_public_ip_request,
build_create_segments_request,
build_create_vm_group_request,
build_delete_dhcp_request,
build_delete_dns_service_request,
build_delete_dns_zone_request,
build_delete_port_mirroring_request,
build_delete_public_ip_request,
build_delete_segment_request,
build_delete_vm_group_request,
build_get_dhcp_request,
build_get_dns_service_request,
build_get_dns_zone_request,
build_get_gateway_request,
build_get_port_mirroring_request,
build_get_public_ip_request,
build_get_request,
build_get_segment_request,
build_get_virtual_machine_request,
build_get_vm_group_request,
build_list_dhcp_request,
build_list_dns_services_request,
build_list_dns_zones_request,
build_list_gateways_request,
build_list_port_mirroring_request,
build_list_public_i_ps_request,
build_list_request,
build_list_segments_request,
build_list_virtual_machines_request,
build_list_vm_groups_request,
build_update_dhcp_request,
build_update_dns_service_request,
build_update_dns_zone_request,
build_update_port_mirroring_request,
build_update_segments_request,
build_update_vm_group_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class WorkloadNetworksOperations: # pylint: disable=too-many-public-methods
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`workload_networks` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace_async
async def get(
self,
resource_group_name: str,
private_cloud_name: str,
workload_network_name: Union[str, _models.WorkloadNetworkName],
**kwargs: Any
) -> _models.WorkloadNetwork:
"""Get a private cloud workload network.
Get a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param workload_network_name: Name for the workload network in the private cloud. "default"
Required.
:type workload_network_name: str or ~azure.mgmt.avs.models.WorkloadNetworkName
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetwork or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetwork
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetwork] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
workload_network_name=workload_network_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetwork", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/{workloadNetworkName}"
}
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetwork"]:
"""List of workload networks in a private cloud.
List of workload networks in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetwork or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetwork]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks"
}
@distributed_trace
def list_segments(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkSegment"]:
"""List of segments in a private cloud workload network.
List of segments in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkSegment or the result of
cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkSegmentsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_segments_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_segments.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkSegmentsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_segments.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments"
}
@distributed_trace_async
async def get_segment(
self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any
) -> _models.WorkloadNetworkSegment:
"""Get a segment by id in a private cloud workload network.
Get a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkSegment or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkSegment
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
request = build_get_segment_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_segment.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_segment.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
async def _create_segments_initial(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> _models.WorkloadNetworkSegment:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_segment, (IOBase, bytes)):
_content = workload_network_segment
else:
_json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment")
request = build_create_segments_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_segments_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_segments_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@overload
async def begin_create_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: _models.WorkloadNetworkSegment,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkSegment]:
"""Create a segment by id in a private cloud workload network.
Create a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkSegment]:
"""Create a segment by id in a private cloud workload network.
Create a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkSegment]:
"""Create a segment by id in a private cloud workload network.
Create a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Is either a WorkloadNetworkSegment type or a IO
type. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_segments_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
workload_network_segment=workload_network_segment,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_segments.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
async def _update_segments_initial(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkSegment]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkSegment]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_segment, (IOBase, bytes)):
_content = workload_network_segment
else:
_json = self._serialize.body(workload_network_segment, "WorkloadNetworkSegment")
request = build_update_segments_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_segments_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_segments_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@overload
async def begin_update_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: _models.WorkloadNetworkSegment,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkSegment]:
"""Create or update a segment by id in a private cloud workload network.
Create or update a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkSegment]:
"""Create or update a segment by id in a private cloud workload network.
Create or update a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Required.
:type workload_network_segment: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_segments(
self,
resource_group_name: str,
private_cloud_name: str,
segment_id: str,
workload_network_segment: Union[_models.WorkloadNetworkSegment, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkSegment]:
"""Create or update a segment by id in a private cloud workload network.
Create or update a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:param workload_network_segment: NSX Segment. Is either a WorkloadNetworkSegment type or a IO
type. Required.
:type workload_network_segment: ~azure.mgmt.avs.models.WorkloadNetworkSegment or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkSegment or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkSegment] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_segments_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
workload_network_segment=workload_network_segment,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkSegment", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_segments.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
async def _delete_segment_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_segment_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_segment_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_segment_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@distributed_trace_async
async def begin_delete_segment(
self, resource_group_name: str, private_cloud_name: str, segment_id: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a segment by id in a private cloud workload network.
Delete a segment by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param segment_id: NSX Segment identifier. Generally the same as the Segment's display name.
Required.
:type segment_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_segment_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
segment_id=segment_id,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_segment.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/segments/{segmentId}"
}
@distributed_trace
def list_dhcp(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkDhcp"]:
"""List dhcp in a private cloud workload network.
List dhcp in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkDhcp or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDhcpList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_dhcp.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDhcpList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations"
}
@distributed_trace_async
async def get_dhcp(
self, resource_group_name: str, dhcp_id: str, private_cloud_name: str, **kwargs: Any
) -> _models.WorkloadNetworkDhcp:
"""Get dhcp by id in a private cloud workload network.
Get dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkDhcp or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkDhcp
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
request = build_get_dhcp_request(
resource_group_name=resource_group_name,
dhcp_id=dhcp_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_dhcp.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
async def _create_dhcp_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> _models.WorkloadNetworkDhcp:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dhcp, (IOBase, bytes)):
_content = workload_network_dhcp
else:
_json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp")
request = build_create_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_dhcp_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_dhcp_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@overload
async def begin_create_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: _models.WorkloadNetworkDhcp,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]:
"""Create dhcp by id in a private cloud workload network.
Create dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]:
"""Create dhcp by id in a private cloud workload network.
Create dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]:
"""Create dhcp by id in a private cloud workload network.
Create dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Is either a WorkloadNetworkDhcp type or a IO type.
Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_dhcp_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
workload_network_dhcp=workload_network_dhcp,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
async def _update_dhcp_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkDhcp]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkDhcp]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dhcp, (IOBase, bytes)):
_content = workload_network_dhcp
else:
_json = self._serialize.body(workload_network_dhcp, "WorkloadNetworkDhcp")
request = build_update_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_dhcp_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_dhcp_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@overload
async def begin_update_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: _models.WorkloadNetworkDhcp,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]:
"""Create or update dhcp by id in a private cloud workload network.
Create or update dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]:
"""Create or update dhcp by id in a private cloud workload network.
Create or update dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Required.
:type workload_network_dhcp: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_dhcp(
self,
resource_group_name: str,
private_cloud_name: str,
dhcp_id: str,
workload_network_dhcp: Union[_models.WorkloadNetworkDhcp, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDhcp]:
"""Create or update dhcp by id in a private cloud workload network.
Create or update dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:param workload_network_dhcp: NSX DHCP. Is either a WorkloadNetworkDhcp type or a IO type.
Required.
:type workload_network_dhcp: ~azure.mgmt.avs.models.WorkloadNetworkDhcp or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDhcp or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDhcp] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_dhcp_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
workload_network_dhcp=workload_network_dhcp,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDhcp", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
async def _delete_dhcp_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_dhcp_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_dhcp_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_dhcp_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@distributed_trace_async
async def begin_delete_dhcp(
self, resource_group_name: str, private_cloud_name: str, dhcp_id: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete dhcp by id in a private cloud workload network.
Delete dhcp by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dhcp_id: NSX DHCP identifier. Generally the same as the DHCP display name. Required.
:type dhcp_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_dhcp_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dhcp_id=dhcp_id,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_dhcp.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dhcpConfigurations/{dhcpId}"
}
@distributed_trace
def list_gateways(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkGateway"]:
"""List of gateways in a private cloud workload network.
List of gateways in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkGateway or the result of
cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkGateway]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkGatewayList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_gateways_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_gateways.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkGatewayList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_gateways.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways"
}
@distributed_trace_async
async def get_gateway(
self, resource_group_name: str, private_cloud_name: str, gateway_id: str, **kwargs: Any
) -> _models.WorkloadNetworkGateway:
"""Get a gateway by id in a private cloud workload network.
Get a gateway by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param gateway_id: NSX Gateway identifier. Generally the same as the Gateway's display name.
Required.
:type gateway_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkGateway or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkGateway
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkGateway] = kwargs.pop("cls", None)
request = build_get_gateway_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
gateway_id=gateway_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_gateway.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkGateway", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_gateway.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/gateways/{gatewayId}"
}
@distributed_trace
def list_port_mirroring(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkPortMirroring"]:
"""List of port mirroring profiles in a private cloud workload network.
List of port mirroring profiles in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkPortMirroring or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPortMirroringList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_port_mirroring.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPortMirroringList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles"
}
@distributed_trace_async
async def get_port_mirroring(
self, resource_group_name: str, private_cloud_name: str, port_mirroring_id: str, **kwargs: Any
) -> _models.WorkloadNetworkPortMirroring:
"""Get a port mirroring profile by id in a private cloud workload network.
Get a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkPortMirroring or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
request = build_get_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_port_mirroring.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
async def _create_port_mirroring_initial(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> _models.WorkloadNetworkPortMirroring:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_port_mirroring, (IOBase, bytes)):
_content = workload_network_port_mirroring
else:
_json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring")
request = build_create_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_port_mirroring_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_port_mirroring_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@overload
async def begin_create_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create a port mirroring profile by id in a private cloud workload network.
Create a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create a port mirroring profile by id in a private cloud workload network.
Create a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create a port mirroring profile by id in a private cloud workload network.
Create a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Is either a
WorkloadNetworkPortMirroring type or a IO type. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_port_mirroring_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
workload_network_port_mirroring=workload_network_port_mirroring,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
async def _update_port_mirroring_initial(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkPortMirroring]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkPortMirroring]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_port_mirroring, (IOBase, bytes)):
_content = workload_network_port_mirroring
else:
_json = self._serialize.body(workload_network_port_mirroring, "WorkloadNetworkPortMirroring")
request = build_update_port_mirroring_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_port_mirroring_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_port_mirroring_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@overload
async def begin_update_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: _models.WorkloadNetworkPortMirroring,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create or update a port mirroring profile by id in a private cloud workload network.
Create or update a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create or update a port mirroring profile by id in a private cloud workload network.
Create or update a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Required.
:type workload_network_port_mirroring: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_port_mirroring(
self,
resource_group_name: str,
private_cloud_name: str,
port_mirroring_id: str,
workload_network_port_mirroring: Union[_models.WorkloadNetworkPortMirroring, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPortMirroring]:
"""Create or update a port mirroring profile by id in a private cloud workload network.
Create or update a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param workload_network_port_mirroring: NSX port mirroring. Is either a
WorkloadNetworkPortMirroring type or a IO type. Required.
:type workload_network_port_mirroring: ~azure.mgmt.avs.models.WorkloadNetworkPortMirroring or
IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPortMirroring or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPortMirroring] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_port_mirroring_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
port_mirroring_id=port_mirroring_id,
workload_network_port_mirroring=workload_network_port_mirroring,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPortMirroring", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
async def _delete_port_mirroring_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_port_mirroring_request(
resource_group_name=resource_group_name,
port_mirroring_id=port_mirroring_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_port_mirroring_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_port_mirroring_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@distributed_trace_async
async def begin_delete_port_mirroring(
self, resource_group_name: str, port_mirroring_id: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a port mirroring profile by id in a private cloud workload network.
Delete a port mirroring profile by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param port_mirroring_id: NSX Port Mirroring identifier. Generally the same as the Port
Mirroring display name. Required.
:type port_mirroring_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_port_mirroring_initial( # type: ignore
resource_group_name=resource_group_name,
port_mirroring_id=port_mirroring_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_port_mirroring.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/portMirroringProfiles/{portMirroringId}"
}
@distributed_trace
def list_vm_groups(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkVMGroup"]:
"""List of vm groups in a private cloud workload network.
List of vm groups in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkVMGroup or the result of
cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVMGroupsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_vm_groups_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_vm_groups.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVMGroupsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_vm_groups.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups"
}
@distributed_trace_async
async def get_vm_group(
self, resource_group_name: str, private_cloud_name: str, vm_group_id: str, **kwargs: Any
) -> _models.WorkloadNetworkVMGroup:
"""Get a vm group by id in a private cloud workload network.
Get a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkVMGroup or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
request = build_get_vm_group_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_vm_group.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
async def _create_vm_group_initial(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> _models.WorkloadNetworkVMGroup:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_vm_group, (IOBase, bytes)):
_content = workload_network_vm_group
else:
_json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup")
request = build_create_vm_group_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_vm_group_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_vm_group_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@overload
async def begin_create_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: _models.WorkloadNetworkVMGroup,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]:
"""Create a vm group by id in a private cloud workload network.
Create a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]:
"""Create a vm group by id in a private cloud workload network.
Create a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]:
"""Create a vm group by id in a private cloud workload network.
Create a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Is either a WorkloadNetworkVMGroup type or a IO
type. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_vm_group_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
workload_network_vm_group=workload_network_vm_group,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
async def _update_vm_group_initial(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkVMGroup]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkVMGroup]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_vm_group, (IOBase, bytes)):
_content = workload_network_vm_group
else:
_json = self._serialize.body(workload_network_vm_group, "WorkloadNetworkVMGroup")
request = build_update_vm_group_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_vm_group_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_vm_group_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@overload
async def begin_update_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: _models.WorkloadNetworkVMGroup,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]:
"""Create or update a vm group by id in a private cloud workload network.
Create or update a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]:
"""Create or update a vm group by id in a private cloud workload network.
Create or update a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Required.
:type workload_network_vm_group: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_vm_group(
self,
resource_group_name: str,
private_cloud_name: str,
vm_group_id: str,
workload_network_vm_group: Union[_models.WorkloadNetworkVMGroup, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkVMGroup]:
"""Create or update a vm group by id in a private cloud workload network.
Create or update a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param workload_network_vm_group: NSX VM Group. Is either a WorkloadNetworkVMGroup type or a IO
type. Required.
:type workload_network_vm_group: ~azure.mgmt.avs.models.WorkloadNetworkVMGroup or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkVMGroup or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkVMGroup] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_vm_group_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
vm_group_id=vm_group_id,
workload_network_vm_group=workload_network_vm_group,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVMGroup", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
async def _delete_vm_group_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_vm_group_request(
resource_group_name=resource_group_name,
vm_group_id=vm_group_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_vm_group_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_vm_group_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@distributed_trace_async
async def begin_delete_vm_group(
self, resource_group_name: str, vm_group_id: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a vm group by id in a private cloud workload network.
Delete a vm group by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param vm_group_id: NSX VM Group identifier. Generally the same as the VM Group's display name.
Required.
:type vm_group_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_vm_group_initial( # type: ignore
resource_group_name=resource_group_name,
vm_group_id=vm_group_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_vm_group.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/vmGroups/{vmGroupId}"
}
@distributed_trace
def list_virtual_machines(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkVirtualMachine"]:
"""List of virtual machines in a private cloud workload network.
List of virtual machines in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkVirtualMachine or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVirtualMachinesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_virtual_machines_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_virtual_machines.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkVirtualMachinesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_virtual_machines.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines"
}
@distributed_trace_async
async def get_virtual_machine(
self, resource_group_name: str, private_cloud_name: str, virtual_machine_id: str, **kwargs: Any
) -> _models.WorkloadNetworkVirtualMachine:
"""Get a virtual machine by id in a private cloud workload network.
Get a virtual machine by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkVirtualMachine or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkVirtualMachine] = kwargs.pop("cls", None)
request = build_get_virtual_machine_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
virtual_machine_id=virtual_machine_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_virtual_machine.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkVirtualMachine", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_virtual_machine.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/virtualMachines/{virtualMachineId}"
}
@distributed_trace
def list_dns_services(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkDnsService"]:
"""List of DNS services in a private cloud workload network.
List of DNS services in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkDnsService or the result of
cls(response)
:rtype:
~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsServicesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_dns_services_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_dns_services.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsServicesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_dns_services.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices"
}
@distributed_trace_async
async def get_dns_service(
self, resource_group_name: str, private_cloud_name: str, dns_service_id: str, **kwargs: Any
) -> _models.WorkloadNetworkDnsService:
"""Get a DNS service by id in a private cloud workload network.
Get a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkDnsService or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsService
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
request = build_get_dns_service_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_dns_service.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
async def _create_dns_service_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> _models.WorkloadNetworkDnsService:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_service, (IOBase, bytes)):
_content = workload_network_dns_service
else:
_json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService")
request = build_create_dns_service_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_dns_service_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_dns_service_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@overload
async def begin_create_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: _models.WorkloadNetworkDnsService,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]:
"""Create a DNS service by id in a private cloud workload network.
Create a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]:
"""Create a DNS service by id in a private cloud workload network.
Create a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]:
"""Create a DNS service by id in a private cloud workload network.
Create a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Is either a WorkloadNetworkDnsService
type or a IO type. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_dns_service_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
workload_network_dns_service=workload_network_dns_service,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
async def _update_dns_service_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkDnsService]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkDnsService]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_service, (IOBase, bytes)):
_content = workload_network_dns_service
else:
_json = self._serialize.body(workload_network_dns_service, "WorkloadNetworkDnsService")
request = build_update_dns_service_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_dns_service_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_dns_service_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@overload
async def begin_update_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: _models.WorkloadNetworkDnsService,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]:
"""Create or update a DNS service by id in a private cloud workload network.
Create or update a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]:
"""Create or update a DNS service by id in a private cloud workload network.
Create or update a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Required.
:type workload_network_dns_service: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_dns_service(
self,
resource_group_name: str,
private_cloud_name: str,
dns_service_id: str,
workload_network_dns_service: Union[_models.WorkloadNetworkDnsService, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsService]:
"""Create or update a DNS service by id in a private cloud workload network.
Create or update a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param workload_network_dns_service: NSX DNS Service. Is either a WorkloadNetworkDnsService
type or a IO type. Required.
:type workload_network_dns_service: ~azure.mgmt.avs.models.WorkloadNetworkDnsService or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsService or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsService] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_dns_service_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_service_id=dns_service_id,
workload_network_dns_service=workload_network_dns_service,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsService", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
async def _delete_dns_service_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_dns_service_request(
resource_group_name=resource_group_name,
dns_service_id=dns_service_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_dns_service_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_dns_service_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@distributed_trace_async
async def begin_delete_dns_service(
self, resource_group_name: str, dns_service_id: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a DNS service by id in a private cloud workload network.
Delete a DNS service by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param dns_service_id: NSX DNS Service identifier. Generally the same as the DNS Service's
display name. Required.
:type dns_service_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_dns_service_initial( # type: ignore
resource_group_name=resource_group_name,
dns_service_id=dns_service_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_dns_service.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsServices/{dnsServiceId}"
}
@distributed_trace
def list_dns_zones(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkDnsZone"]:
"""List of DNS zones in a private cloud workload network.
List of DNS zones in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkDnsZone or the result of
cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsZonesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_dns_zones_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_dns_zones.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsZonesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_dns_zones.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones"
}
@distributed_trace_async
async def get_dns_zone(
self, resource_group_name: str, private_cloud_name: str, dns_zone_id: str, **kwargs: Any
) -> _models.WorkloadNetworkDnsZone:
"""Get a DNS zone by id in a private cloud workload network.
Get a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkDnsZone or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
request = build_get_dns_zone_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_dns_zone.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
async def _create_dns_zone_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> _models.WorkloadNetworkDnsZone:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_zone, (IOBase, bytes)):
_content = workload_network_dns_zone
else:
_json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone")
request = build_create_dns_zone_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_dns_zone_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_dns_zone_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@overload
async def begin_create_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: _models.WorkloadNetworkDnsZone,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]:
"""Create a DNS zone by id in a private cloud workload network.
Create a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]:
"""Create a DNS zone by id in a private cloud workload network.
Create a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]:
"""Create a DNS zone by id in a private cloud workload network.
Create a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Is either a WorkloadNetworkDnsZone type or a IO
type. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_dns_zone_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
workload_network_dns_zone=workload_network_dns_zone,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
async def _update_dns_zone_initial(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> Optional[_models.WorkloadNetworkDnsZone]:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[Optional[_models.WorkloadNetworkDnsZone]] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_dns_zone, (IOBase, bytes)):
_content = workload_network_dns_zone
else:
_json = self._serialize.body(workload_network_dns_zone, "WorkloadNetworkDnsZone")
request = build_update_dns_zone_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_dns_zone_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
_update_dns_zone_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@overload
async def begin_update_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: _models.WorkloadNetworkDnsZone,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]:
"""Create or update a DNS zone by id in a private cloud workload network.
Create or update a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]:
"""Create or update a DNS zone by id in a private cloud workload network.
Create or update a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Required.
:type workload_network_dns_zone: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update_dns_zone(
self,
resource_group_name: str,
private_cloud_name: str,
dns_zone_id: str,
workload_network_dns_zone: Union[_models.WorkloadNetworkDnsZone, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkDnsZone]:
"""Create or update a DNS zone by id in a private cloud workload network.
Create or update a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param workload_network_dns_zone: NSX DNS Zone. Is either a WorkloadNetworkDnsZone type or a IO
type. Required.
:type workload_network_dns_zone: ~azure.mgmt.avs.models.WorkloadNetworkDnsZone or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkDnsZone or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkDnsZone] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_dns_zone_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
dns_zone_id=dns_zone_id,
workload_network_dns_zone=workload_network_dns_zone,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkDnsZone", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
async def _delete_dns_zone_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_dns_zone_request(
resource_group_name=resource_group_name,
dns_zone_id=dns_zone_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_dns_zone_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_dns_zone_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@distributed_trace_async
async def begin_delete_dns_zone(
self, resource_group_name: str, dns_zone_id: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a DNS zone by id in a private cloud workload network.
Delete a DNS zone by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param dns_zone_id: NSX DNS Zone identifier. Generally the same as the DNS Zone's display name.
Required.
:type dns_zone_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_dns_zone_initial( # type: ignore
resource_group_name=resource_group_name,
dns_zone_id=dns_zone_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_dns_zone.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/dnsZones/{dnsZoneId}"
}
@distributed_trace
def list_public_i_ps(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.WorkloadNetworkPublicIP"]:
"""List of Public IP Blocks in a private cloud workload network.
List of Public IP Blocks in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either WorkloadNetworkPublicIP or the result of
cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPublicIPsList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_public_i_ps_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_public_i_ps.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPublicIPsList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list_public_i_ps.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs"
}
@distributed_trace_async
async def get_public_ip(
self, resource_group_name: str, private_cloud_name: str, public_ip_id: str, **kwargs: Any
) -> _models.WorkloadNetworkPublicIP:
"""Get a Public IP Block by id in a private cloud workload network.
Get a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: WorkloadNetworkPublicIP or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None)
request = build_get_public_ip_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
public_ip_id=public_ip_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get_public_ip.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_public_ip.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
async def _create_public_ip_initial(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO],
**kwargs: Any
) -> _models.WorkloadNetworkPublicIP:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(workload_network_public_ip, (IOBase, bytes)):
_content = workload_network_public_ip
else:
_json = self._serialize.body(workload_network_public_ip, "WorkloadNetworkPublicIP")
request = build_create_public_ip_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
public_ip_id=public_ip_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_public_ip_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_public_ip_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
@overload
async def begin_create_public_ip(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: _models.WorkloadNetworkPublicIP,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPublicIP]:
"""Create a Public IP Block by id in a private cloud workload network.
Create a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param workload_network_public_ip: NSX Public IP Block. Required.
:type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPublicIP or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_public_ip(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPublicIP]:
"""Create a Public IP Block by id in a private cloud workload network.
Create a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param workload_network_public_ip: NSX Public IP Block. Required.
:type workload_network_public_ip: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPublicIP or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_public_ip(
self,
resource_group_name: str,
private_cloud_name: str,
public_ip_id: str,
workload_network_public_ip: Union[_models.WorkloadNetworkPublicIP, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.WorkloadNetworkPublicIP]:
"""Create a Public IP Block by id in a private cloud workload network.
Create a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param workload_network_public_ip: NSX Public IP Block. Is either a WorkloadNetworkPublicIP
type or a IO type. Required.
:type workload_network_public_ip: ~azure.mgmt.avs.models.WorkloadNetworkPublicIP or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either WorkloadNetworkPublicIP or the
result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.WorkloadNetworkPublicIP] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_public_ip_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
public_ip_id=public_ip_id,
workload_network_public_ip=workload_network_public_ip,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("WorkloadNetworkPublicIP", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_public_ip.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
async def _delete_public_ip_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_public_ip_request(
resource_group_name=resource_group_name,
public_ip_id=public_ip_id,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_public_ip_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_public_ip_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
@distributed_trace_async
async def begin_delete_public_ip(
self, resource_group_name: str, public_ip_id: str, private_cloud_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a Public IP Block by id in a private cloud workload network.
Delete a Public IP Block by id in a private cloud workload network.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param public_ip_id: NSX Public IP Block identifier. Generally the same as the Public IP
Block's display name. Required.
:type public_ip_id: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_public_ip_initial( # type: ignore
resource_group_name=resource_group_name,
public_ip_id=public_ip_id,
private_cloud_name=private_cloud_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete_public_ip.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/workloadNetworks/default/publicIPs/{publicIPId}"
}
| 0.871748 | 0.060529 |
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._clusters_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
build_list_zones_request,
build_update_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ClustersOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`clusters` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.Cluster"]:
"""List clusters in a private cloud.
List clusters in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Cluster or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> _models.Cluster:
"""Get a cluster by name in a private cloud.
Get a cluster by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Cluster or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: Union[_models.Cluster, IO],
**kwargs: Any
) -> _models.Cluster:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cluster, (IOBase, bytes)):
_content = cluster
else:
_json = self._serialize.body(cluster, "Cluster")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: _models.Cluster,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Create or update a cluster in a private cloud.
Create or update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster: A cluster in the private cloud. Required.
:type cluster: ~azure.mgmt.avs.models.Cluster
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Create or update a cluster in a private cloud.
Create or update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster: A cluster in the private cloud. Required.
:type cluster: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: Union[_models.Cluster, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Create or update a cluster in a private cloud.
Create or update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster: A cluster in the private cloud. Is either a Cluster type or a IO type.
Required.
:type cluster: ~azure.mgmt.avs.models.Cluster or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
cluster=cluster,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
async def _update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: Union[_models.ClusterUpdate, IO],
**kwargs: Any
) -> _models.Cluster:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cluster_update, (IOBase, bytes)):
_content = cluster_update
else:
_json = self._serialize.body(cluster_update, "ClusterUpdate")
request = build_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@overload
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: _models.ClusterUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Update a cluster in a private cloud.
Update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster_update: The cluster properties to be updated. Required.
:type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Update a cluster in a private cloud.
Update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster_update: The cluster properties to be updated. Required.
:type cluster_update: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: Union[_models.ClusterUpdate, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Update a cluster in a private cloud.
Update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster_update: The cluster properties to be updated. Is either a ClusterUpdate type or
a IO type. Required.
:type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
cluster_update=cluster_update,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a cluster in a private cloud.
Delete a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@distributed_trace_async
async def list_zones(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> _models.ClusterZoneList:
"""List hosts by zone in a cluster.
List hosts by zone in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ClusterZoneList or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ClusterZoneList
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterZoneList] = kwargs.pop("cls", None)
request = build_list_zones_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_zones.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ClusterZoneList", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list_zones.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/listZones"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_clusters_operations.py
|
_clusters_operations.py
|
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._clusters_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
build_list_zones_request,
build_update_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class ClustersOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`clusters` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.Cluster"]:
"""List clusters in a private cloud.
List clusters in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Cluster or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("ClusterList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> _models.Cluster:
"""Get a cluster by name in a private cloud.
Get a cluster by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Cluster or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Cluster
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: Union[_models.Cluster, IO],
**kwargs: Any
) -> _models.Cluster:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cluster, (IOBase, bytes)):
_content = cluster
else:
_json = self._serialize.body(cluster, "Cluster")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: _models.Cluster,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Create or update a cluster in a private cloud.
Create or update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster: A cluster in the private cloud. Required.
:type cluster: ~azure.mgmt.avs.models.Cluster
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Create or update a cluster in a private cloud.
Create or update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster: A cluster in the private cloud. Required.
:type cluster: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster: Union[_models.Cluster, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Create or update a cluster in a private cloud.
Create or update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster: A cluster in the private cloud. Is either a Cluster type or a IO type.
Required.
:type cluster: ~azure.mgmt.avs.models.Cluster or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
cluster=cluster,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
async def _update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: Union[_models.ClusterUpdate, IO],
**kwargs: Any
) -> _models.Cluster:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(cluster_update, (IOBase, bytes)):
_content = cluster_update
else:
_json = self._serialize.body(cluster_update, "ClusterUpdate")
request = build_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Cluster", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@overload
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: _models.ClusterUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Update a cluster in a private cloud.
Update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster_update: The cluster properties to be updated. Required.
:type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Update a cluster in a private cloud.
Update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster_update: The cluster properties to be updated. Required.
:type cluster_update: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
cluster_update: Union[_models.ClusterUpdate, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.Cluster]:
"""Update a cluster in a private cloud.
Update a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param cluster_update: The cluster properties to be updated. Is either a ClusterUpdate type or
a IO type. Required.
:type cluster_update: ~azure.mgmt.avs.models.ClusterUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Cluster or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Cluster]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Cluster] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
cluster_update=cluster_update,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Cluster", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a cluster in a private cloud.
Delete a cluster in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}"
}
@distributed_trace_async
async def list_zones(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> _models.ClusterZoneList:
"""List hosts by zone in a cluster.
List hosts by zone in a cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: ClusterZoneList or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.ClusterZoneList
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.ClusterZoneList] = kwargs.pop("cls", None)
request = build_list_zones_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list_zones.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("ClusterZoneList", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
list_zones.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/listZones"
}
| 0.881168 | 0.089933 |
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._virtual_machines_operations import (
build_get_request,
build_list_request,
build_restrict_movement_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class VirtualMachinesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`virtual_machines` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.VirtualMachine"]:
"""List of virtual machines in a private cloud cluster.
List of virtual machines in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either VirtualMachine or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.VirtualMachine]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("VirtualMachinesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines"
}
@distributed_trace_async
async def get(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
**kwargs: Any
) -> _models.VirtualMachine:
"""Get a virtual machine by id in a private cloud cluster.
Get a virtual machine by id in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: VirtualMachine or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.VirtualMachine
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
virtual_machine_id=virtual_machine_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("VirtualMachine", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}"
}
async def _restrict_movement_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO],
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(restrict_movement, (IOBase, bytes)):
_content = restrict_movement
else:
_json = self._serialize.body(restrict_movement, "VirtualMachineRestrictMovement")
request = build_restrict_movement_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
virtual_machine_id=virtual_machine_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._restrict_movement_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_restrict_movement_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement"
}
@overload
async def begin_restrict_movement(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: _models.VirtualMachineRestrictMovement,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Enable or disable DRS-driven VM movement restriction.
Enable or disable DRS-driven VM movement restriction.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not
(Disabled). Required.
:type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_restrict_movement(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Enable or disable DRS-driven VM movement restriction.
Enable or disable DRS-driven VM movement restriction.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not
(Disabled). Required.
:type restrict_movement: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_restrict_movement(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO],
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Enable or disable DRS-driven VM movement restriction.
Enable or disable DRS-driven VM movement restriction.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not
(Disabled). Is either a VirtualMachineRestrictMovement type or a IO type. Required.
:type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._restrict_movement_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
virtual_machine_id=virtual_machine_id,
restrict_movement=restrict_movement,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_restrict_movement.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_virtual_machines_operations.py
|
_virtual_machines_operations.py
|
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._virtual_machines_operations import (
build_get_request,
build_list_request,
build_restrict_movement_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class VirtualMachinesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`virtual_machines` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.VirtualMachine"]:
"""List of virtual machines in a private cloud cluster.
List of virtual machines in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either VirtualMachine or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.VirtualMachine]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.VirtualMachinesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("VirtualMachinesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines"
}
@distributed_trace_async
async def get(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
**kwargs: Any
) -> _models.VirtualMachine:
"""Get a virtual machine by id in a private cloud cluster.
Get a virtual machine by id in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: VirtualMachine or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.VirtualMachine
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.VirtualMachine] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
virtual_machine_id=virtual_machine_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("VirtualMachine", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}"
}
async def _restrict_movement_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO],
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(restrict_movement, (IOBase, bytes)):
_content = restrict_movement
else:
_json = self._serialize.body(restrict_movement, "VirtualMachineRestrictMovement")
request = build_restrict_movement_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
virtual_machine_id=virtual_machine_id,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._restrict_movement_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_restrict_movement_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement"
}
@overload
async def begin_restrict_movement(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: _models.VirtualMachineRestrictMovement,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Enable or disable DRS-driven VM movement restriction.
Enable or disable DRS-driven VM movement restriction.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not
(Disabled). Required.
:type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_restrict_movement(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Enable or disable DRS-driven VM movement restriction.
Enable or disable DRS-driven VM movement restriction.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not
(Disabled). Required.
:type restrict_movement: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_restrict_movement(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
virtual_machine_id: str,
restrict_movement: Union[_models.VirtualMachineRestrictMovement, IO],
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Enable or disable DRS-driven VM movement restriction.
Enable or disable DRS-driven VM movement restriction.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param virtual_machine_id: Virtual Machine identifier. Required.
:type virtual_machine_id: str
:param restrict_movement: Whether VM DRS-driven movement is restricted (Enabled) or not
(Disabled). Is either a VirtualMachineRestrictMovement type or a IO type. Required.
:type restrict_movement: ~azure.mgmt.avs.models.VirtualMachineRestrictMovement or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._restrict_movement_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
virtual_machine_id=virtual_machine_id,
restrict_movement=restrict_movement,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_restrict_movement.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/virtualMachines/{virtualMachineId}/restrictMovement"
}
| 0.890927 | 0.097005 |
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._hcx_enterprise_sites_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class HcxEnterpriseSitesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`hcx_enterprise_sites` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.HcxEnterpriseSite"]:
"""List HCX on-premises key in a private cloud.
List HCX on-premises key in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.HcxEnterpriseSite]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.HcxEnterpriseSiteList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("HcxEnterpriseSiteList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, **kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Get an HCX on-premises key by name in a private cloud.
Get an HCX on-premises key by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.HcxEnterpriseSite] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
hcx_enterprise_site_name=hcx_enterprise_site_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"
}
@overload
async def create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
hcx_enterprise_site: _models.HcxEnterpriseSite,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Create or update an activation key for on-premises HCX site.
Create or update an activation key for on-premises HCX site.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:param hcx_enterprise_site: The HCX Enterprise Site. Required.
:type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
hcx_enterprise_site: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Create or update an activation key for on-premises HCX site.
Create or update an activation key for on-premises HCX site.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:param hcx_enterprise_site: The HCX Enterprise Site. Required.
:type hcx_enterprise_site: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
hcx_enterprise_site: Union[_models.HcxEnterpriseSite, IO],
**kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Create or update an activation key for on-premises HCX site.
Create or update an activation key for on-premises HCX site.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:param hcx_enterprise_site: The HCX Enterprise Site. Is either a HcxEnterpriseSite type or a IO
type. Required.
:type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.HcxEnterpriseSite] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(hcx_enterprise_site, (IOBase, bytes)):
_content = hcx_enterprise_site
else:
_json = self._serialize.body(hcx_enterprise_site, "HcxEnterpriseSite")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
hcx_enterprise_site_name=hcx_enterprise_site_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"
}
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, **kwargs: Any
) -> None:
"""Delete HCX on-premises key in a private cloud.
Delete HCX on-premises key in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
hcx_enterprise_site_name=hcx_enterprise_site_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_hcx_enterprise_sites_operations.py
|
_hcx_enterprise_sites_operations.py
|
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._hcx_enterprise_sites_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class HcxEnterpriseSitesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`hcx_enterprise_sites` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.HcxEnterpriseSite"]:
"""List HCX on-premises key in a private cloud.
List HCX on-premises key in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.HcxEnterpriseSite]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.HcxEnterpriseSiteList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("HcxEnterpriseSiteList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, **kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Get an HCX on-premises key by name in a private cloud.
Get an HCX on-premises key by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.HcxEnterpriseSite] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
hcx_enterprise_site_name=hcx_enterprise_site_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"
}
@overload
async def create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
hcx_enterprise_site: _models.HcxEnterpriseSite,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Create or update an activation key for on-premises HCX site.
Create or update an activation key for on-premises HCX site.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:param hcx_enterprise_site: The HCX Enterprise Site. Required.
:type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
hcx_enterprise_site: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Create or update an activation key for on-premises HCX site.
Create or update an activation key for on-premises HCX site.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:param hcx_enterprise_site: The HCX Enterprise Site. Required.
:type hcx_enterprise_site: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
hcx_enterprise_site_name: str,
hcx_enterprise_site: Union[_models.HcxEnterpriseSite, IO],
**kwargs: Any
) -> _models.HcxEnterpriseSite:
"""Create or update an activation key for on-premises HCX site.
Create or update an activation key for on-premises HCX site.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:param hcx_enterprise_site: The HCX Enterprise Site. Is either a HcxEnterpriseSite type or a IO
type. Required.
:type hcx_enterprise_site: ~azure.mgmt.avs.models.HcxEnterpriseSite or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: HcxEnterpriseSite or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.HcxEnterpriseSite
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.HcxEnterpriseSite] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(hcx_enterprise_site, (IOBase, bytes)):
_content = hcx_enterprise_site
else:
_json = self._serialize.body(hcx_enterprise_site, "HcxEnterpriseSite")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
hcx_enterprise_site_name=hcx_enterprise_site_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self.create_or_update.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("HcxEnterpriseSite", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"
}
@distributed_trace_async
async def delete( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, hcx_enterprise_site_name: str, **kwargs: Any
) -> None:
"""Delete HCX on-premises key in a private cloud.
Delete HCX on-premises key in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param hcx_enterprise_site_name: Name of the HCX Enterprise Site in the private cloud.
Required.
:type hcx_enterprise_site_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None or the result of cls(response)
:rtype: None
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
hcx_enterprise_site_name=hcx_enterprise_site_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.delete.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/hcxEnterpriseSites/{hcxEnterpriseSiteName}"
}
| 0.879497 | 0.085099 |
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._addons_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class AddonsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`addons` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> AsyncIterable["_models.Addon"]:
"""List addons in a private cloud.
List addons in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Addon or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AddonList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("AddonList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any
) -> _models.Addon:
"""Get an addon by name in a private cloud.
Get an addon by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Addon or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Addon
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Addon] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Addon", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: Union[_models.Addon, IO],
**kwargs: Any
) -> _models.Addon:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Addon] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(addon, (IOBase, bytes)):
_content = addon
else:
_json = self._serialize.body(addon, "Addon")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Addon", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Addon", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: _models.Addon,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Addon]:
"""Create or update a addon in a private cloud.
Create or update a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:param addon: A addon in the private cloud. Required.
:type addon: ~azure.mgmt.avs.models.Addon
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Addon]:
"""Create or update a addon in a private cloud.
Create or update a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:param addon: A addon in the private cloud. Required.
:type addon: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: Union[_models.Addon, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.Addon]:
"""Create or update a addon in a private cloud.
Create or update a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:param addon: A addon in the private cloud. Is either a Addon type or a IO type. Required.
:type addon: ~azure.mgmt.avs.models.Addon or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Addon] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
addon=addon,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Addon", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a addon in a private cloud.
Delete a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_addons_operations.py
|
_addons_operations.py
|
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._addons_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class AddonsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`addons` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, resource_group_name: str, private_cloud_name: str, **kwargs: Any) -> AsyncIterable["_models.Addon"]:
"""List addons in a private cloud.
List addons in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Addon or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.AddonList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("AddonList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any
) -> _models.Addon:
"""Get an addon by name in a private cloud.
Get an addon by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Addon or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Addon
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Addon] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Addon", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: Union[_models.Addon, IO],
**kwargs: Any
) -> _models.Addon:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Addon] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(addon, (IOBase, bytes)):
_content = addon
else:
_json = self._serialize.body(addon, "Addon")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Addon", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Addon", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: _models.Addon,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Addon]:
"""Create or update a addon in a private cloud.
Create or update a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:param addon: A addon in the private cloud. Required.
:type addon: ~azure.mgmt.avs.models.Addon
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Addon]:
"""Create or update a addon in a private cloud.
Create or update a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:param addon: A addon in the private cloud. Required.
:type addon: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
addon_name: str,
addon: Union[_models.Addon, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.Addon]:
"""Create or update a addon in a private cloud.
Create or update a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:param addon: A addon in the private cloud. Is either a Addon type or a IO type. Required.
:type addon: ~azure.mgmt.avs.models.Addon or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Addon or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Addon]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Addon] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
addon=addon,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Addon", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, addon_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a addon in a private cloud.
Delete a addon in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param addon_name: Name of the addon for the private cloud. Required.
:type addon_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
addon_name=addon_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/addons/{addonName}"
}
| 0.890247 | 0.078395 |
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._datastores_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class DatastoresOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`datastores` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.Datastore"]:
"""List datastores in a private cloud cluster.
List datastores in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Datastore or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DatastoreList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DatastoreList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any
) -> _models.Datastore:
"""Get a datastore in a private cloud cluster.
Get a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Datastore or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Datastore
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Datastore] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Datastore", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: Union[_models.Datastore, IO],
**kwargs: Any
) -> _models.Datastore:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Datastore] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(datastore, (IOBase, bytes)):
_content = datastore
else:
_json = self._serialize.body(datastore, "Datastore")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Datastore", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Datastore", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: _models.Datastore,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Datastore]:
"""Create or update a datastore in a private cloud cluster.
Create or update a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:param datastore: A datastore in a private cloud cluster. Required.
:type datastore: ~azure.mgmt.avs.models.Datastore
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Datastore or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Datastore]:
"""Create or update a datastore in a private cloud cluster.
Create or update a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:param datastore: A datastore in a private cloud cluster. Required.
:type datastore: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Datastore or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: Union[_models.Datastore, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.Datastore]:
"""Create or update a datastore in a private cloud cluster.
Create or update a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:param datastore: A datastore in a private cloud cluster. Is either a Datastore type or a IO
type. Required.
:type datastore: ~azure.mgmt.avs.models.Datastore or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Datastore or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Datastore] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
datastore=datastore,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Datastore", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a datastore in a private cloud cluster.
Delete a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_datastores_operations.py
|
_datastores_operations.py
|
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._datastores_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class DatastoresOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`datastores` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.Datastore"]:
"""List datastores in a private cloud cluster.
List datastores in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Datastore or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.DatastoreList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("DatastoreList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any
) -> _models.Datastore:
"""Get a datastore in a private cloud cluster.
Get a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: Datastore or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.Datastore
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.Datastore] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("Datastore", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: Union[_models.Datastore, IO],
**kwargs: Any
) -> _models.Datastore:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Datastore] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(datastore, (IOBase, bytes)):
_content = datastore
else:
_json = self._serialize.body(datastore, "Datastore")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("Datastore", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("Datastore", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: _models.Datastore,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Datastore]:
"""Create or update a datastore in a private cloud cluster.
Create or update a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:param datastore: A datastore in a private cloud cluster. Required.
:type datastore: ~azure.mgmt.avs.models.Datastore
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Datastore or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.Datastore]:
"""Create or update a datastore in a private cloud cluster.
Create or update a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:param datastore: A datastore in a private cloud cluster. Required.
:type datastore: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Datastore or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
datastore_name: str,
datastore: Union[_models.Datastore, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.Datastore]:
"""Create or update a datastore in a private cloud cluster.
Create or update a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:param datastore: A datastore in a private cloud cluster. Is either a Datastore type or a IO
type. Required.
:type datastore: ~azure.mgmt.avs.models.Datastore or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either Datastore or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.Datastore]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.Datastore] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
datastore=datastore,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("Datastore", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, datastore_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a datastore in a private cloud cluster.
Delete a datastore in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param datastore_name: Name of the datastore in the private cloud cluster. Required.
:type datastore_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
datastore_name=datastore_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/datastores/{datastoreName}"
}
| 0.883995 | 0.117724 |
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._operations import build_list_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class Operations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`operations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists all of the available operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {"url": "/providers/Microsoft.AVS/operations"}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_operations.py
|
_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._operations import build_list_request
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class Operations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`operations` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]:
"""Lists all of the available operations.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either Operation or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.Operation]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.OperationList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("OperationList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {"url": "/providers/Microsoft.AVS/operations"}
| 0.859516 | 0.094052 |
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._placement_policies_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
build_update_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class PlacementPoliciesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`placement_policies` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.PlacementPolicy"]:
"""List placement policies in a private cloud cluster.
List placement policies in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PlacementPolicy or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PlacementPoliciesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PlacementPoliciesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies"
}
@distributed_trace_async
async def get(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
**kwargs: Any
) -> _models.PlacementPolicy:
"""Get a placement policy by name in a private cloud cluster.
Get a placement policy by name in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PlacementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.PlacementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: Union[_models.PlacementPolicy, IO],
**kwargs: Any
) -> _models.PlacementPolicy:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(placement_policy, (IOBase, bytes)):
_content = placement_policy
else:
_json = self._serialize.body(placement_policy, "PlacementPolicy")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: _models.PlacementPolicy,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PlacementPolicy]:
"""Create or update a placement policy in a private cloud cluster.
Create or update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy: A placement policy in the private cloud cluster. Required.
:type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PlacementPolicy]:
"""Create or update a placement policy in a private cloud cluster.
Create or update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy: A placement policy in the private cloud cluster. Required.
:type placement_policy: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: Union[_models.PlacementPolicy, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.PlacementPolicy]:
"""Create or update a placement policy in a private cloud cluster.
Create or update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy: A placement policy in the private cloud cluster. Is either a
PlacementPolicy type or a IO type. Required.
:type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
placement_policy=placement_policy,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
async def _update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: Union[_models.PlacementPolicyUpdate, IO],
**kwargs: Any
) -> _models.PlacementPolicy:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(placement_policy_update, (IOBase, bytes)):
_content = placement_policy_update
else:
_json = self._serialize.body(placement_policy_update, "PlacementPolicyUpdate")
request = build_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
@overload
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: _models.PlacementPolicyUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PlacementPolicy]:
"""Update a placement policy in a private cloud cluster.
Update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy_update: The placement policy properties that may be updated. Required.
:type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PlacementPolicy]:
"""Update a placement policy in a private cloud cluster.
Update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy_update: The placement policy properties that may be updated. Required.
:type placement_policy_update: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: Union[_models.PlacementPolicyUpdate, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.PlacementPolicy]:
"""Update a placement policy in a private cloud cluster.
Update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy_update: The placement policy properties that may be updated. Is either
a PlacementPolicyUpdate type or a IO type. Required.
:type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
placement_policy_update=placement_policy_update,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
@distributed_trace_async
async def begin_delete(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a placement policy in a private cloud cluster.
Delete a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_placement_policies_operations.py
|
_placement_policies_operations.py
|
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._placement_policies_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
build_update_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class PlacementPoliciesOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`placement_policies` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, cluster_name: str, **kwargs: Any
) -> AsyncIterable["_models.PlacementPolicy"]:
"""List placement policies in a private cloud cluster.
List placement policies in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either PlacementPolicy or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PlacementPoliciesList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("PlacementPoliciesList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies"
}
@distributed_trace_async
async def get(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
**kwargs: Any
) -> _models.PlacementPolicy:
"""Get a placement policy by name in a private cloud cluster.
Get a placement policy by name in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: PlacementPolicy or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.PlacementPolicy
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: Union[_models.PlacementPolicy, IO],
**kwargs: Any
) -> _models.PlacementPolicy:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(placement_policy, (IOBase, bytes)):
_content = placement_policy
else:
_json = self._serialize.body(placement_policy, "PlacementPolicy")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: _models.PlacementPolicy,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PlacementPolicy]:
"""Create or update a placement policy in a private cloud cluster.
Create or update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy: A placement policy in the private cloud cluster. Required.
:type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PlacementPolicy]:
"""Create or update a placement policy in a private cloud cluster.
Create or update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy: A placement policy in the private cloud cluster. Required.
:type placement_policy: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy: Union[_models.PlacementPolicy, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.PlacementPolicy]:
"""Create or update a placement policy in a private cloud cluster.
Create or update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy: A placement policy in the private cloud cluster. Is either a
PlacementPolicy type or a IO type. Required.
:type placement_policy: ~azure.mgmt.avs.models.PlacementPolicy or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
placement_policy=placement_policy,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
async def _update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: Union[_models.PlacementPolicyUpdate, IO],
**kwargs: Any
) -> _models.PlacementPolicy:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(placement_policy_update, (IOBase, bytes)):
_content = placement_policy_update
else:
_json = self._serialize.body(placement_policy_update, "PlacementPolicyUpdate")
request = build_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if response.status_code == 202:
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
@overload
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: _models.PlacementPolicyUpdate,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PlacementPolicy]:
"""Update a placement policy in a private cloud cluster.
Update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy_update: The placement policy properties that may be updated. Required.
:type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.PlacementPolicy]:
"""Update a placement policy in a private cloud cluster.
Update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy_update: The placement policy properties that may be updated. Required.
:type placement_policy_update: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_update(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
placement_policy_update: Union[_models.PlacementPolicyUpdate, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.PlacementPolicy]:
"""Update a placement policy in a private cloud cluster.
Update a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:param placement_policy_update: The placement policy properties that may be updated. Is either
a PlacementPolicyUpdate type or a IO type. Required.
:type placement_policy_update: ~azure.mgmt.avs.models.PlacementPolicyUpdate or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either PlacementPolicy or the result of
cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.PlacementPolicy]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.PlacementPolicy] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
placement_policy_update=placement_policy_update,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("PlacementPolicy", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
@distributed_trace_async
async def begin_delete(
self,
resource_group_name: str,
private_cloud_name: str,
cluster_name: str,
placement_policy_name: str,
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a placement policy in a private cloud cluster.
Delete a placement policy in a private cloud cluster.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param cluster_name: Name of the cluster in the private cloud. Required.
:type cluster_name: str
:param placement_policy_name: Name of the VMware vSphere Distributed Resource Scheduler (DRS)
placement policy. Required.
:type placement_policy_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
cluster_name=cluster_name,
placement_policy_name=placement_policy_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/clusters/{clusterName}/placementPolicies/{placementPolicyName}"
}
| 0.890061 | 0.086903 |
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._global_reach_connections_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class GlobalReachConnectionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`global_reach_connections` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.GlobalReachConnection"]:
"""List global reach connections in a private cloud.
List global reach connections in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either GlobalReachConnection or the result of
cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GlobalReachConnectionList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("GlobalReachConnectionList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any
) -> _models.GlobalReachConnection:
"""Get a global reach connection by name in a private cloud.
Get a global reach connection by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: GlobalReachConnection or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.GlobalReachConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: Union[_models.GlobalReachConnection, IO],
**kwargs: Any
) -> _models.GlobalReachConnection:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(global_reach_connection, (IOBase, bytes)):
_content = global_reach_connection
else:
_json = self._serialize.body(global_reach_connection, "GlobalReachConnection")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: _models.GlobalReachConnection,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.GlobalReachConnection]:
"""Create or update a global reach connection in a private cloud.
Create or update a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:param global_reach_connection: A global reach connection in the private cloud. Required.
:type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either GlobalReachConnection or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.GlobalReachConnection]:
"""Create or update a global reach connection in a private cloud.
Create or update a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:param global_reach_connection: A global reach connection in the private cloud. Required.
:type global_reach_connection: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either GlobalReachConnection or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: Union[_models.GlobalReachConnection, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.GlobalReachConnection]:
"""Create or update a global reach connection in a private cloud.
Create or update a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:param global_reach_connection: A global reach connection in the private cloud. Is either a
GlobalReachConnection type or a IO type. Required.
:type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either GlobalReachConnection or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
global_reach_connection=global_reach_connection,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a global reach connection in a private cloud.
Delete a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/aio/operations/_global_reach_connections_operations.py
|
_global_reach_connections_operations.py
|
from io import IOBase
from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
import urllib.parse
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator import distributed_trace
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._global_reach_connections_operations import (
build_create_or_update_request,
build_delete_request,
build_get_request,
build_list_request,
)
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class GlobalReachConnectionsOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.avs.aio.AVSClient`'s
:attr:`global_reach_connections` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
@distributed_trace
def list(
self, resource_group_name: str, private_cloud_name: str, **kwargs: Any
) -> AsyncIterable["_models.GlobalReachConnection"]:
"""List global reach connections in a private cloud.
List global reach connections in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either GlobalReachConnection or the result of
cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GlobalReachConnectionList] = kwargs.pop("cls", None)
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
def prepare_request(next_link=None):
if not next_link:
request = build_list_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.list.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
else:
# make call to next link with the client's api-version
_parsed_next_link = urllib.parse.urlparse(next_link)
_next_request_params = case_insensitive_dict(
{
key: [urllib.parse.quote(v) for v in value]
for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items()
}
)
_next_request_params["api-version"] = self._config.api_version
request = HttpRequest(
"GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
request.method = "GET"
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize("GlobalReachConnectionList", pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.next_link or None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(get_next, extract_data)
list.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections"
}
@distributed_trace_async
async def get(
self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any
) -> _models.GlobalReachConnection:
"""Get a global reach connection by name in a private cloud.
Get a global reach connection by name in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: GlobalReachConnection or the result of cls(response)
:rtype: ~azure.mgmt.avs.models.GlobalReachConnection
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None)
request = build_get_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self.get.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
async def _create_or_update_initial(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: Union[_models.GlobalReachConnection, IO],
**kwargs: Any
) -> _models.GlobalReachConnection:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(global_reach_connection, (IOBase, bytes)):
_content = global_reach_connection
else:
_json = self._serialize.body(global_reach_connection, "GlobalReachConnection")
request = build_create_or_update_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._create_or_update_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 201]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if response.status_code == 200:
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
return deserialized # type: ignore
_create_or_update_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: _models.GlobalReachConnection,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.GlobalReachConnection]:
"""Create or update a global reach connection in a private cloud.
Create or update a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:param global_reach_connection: A global reach connection in the private cloud. Required.
:type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either GlobalReachConnection or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[_models.GlobalReachConnection]:
"""Create or update a global reach connection in a private cloud.
Create or update a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:param global_reach_connection: A global reach connection in the private cloud. Required.
:type global_reach_connection: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either GlobalReachConnection or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_create_or_update(
self,
resource_group_name: str,
private_cloud_name: str,
global_reach_connection_name: str,
global_reach_connection: Union[_models.GlobalReachConnection, IO],
**kwargs: Any
) -> AsyncLROPoller[_models.GlobalReachConnection]:
"""Create or update a global reach connection in a private cloud.
Create or update a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: The name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:param global_reach_connection: A global reach connection in the private cloud. Is either a
GlobalReachConnection type or a IO type. Required.
:type global_reach_connection: ~azure.mgmt.avs.models.GlobalReachConnection or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either GlobalReachConnection or the result
of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.avs.models.GlobalReachConnection]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.GlobalReachConnection] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._create_or_update_initial(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
global_reach_connection=global_reach_connection,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize("GlobalReachConnection", pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_create_or_update.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
async def _delete_initial( # pylint: disable=inconsistent-return-statements
self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
request = build_delete_request(
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
template_url=self._delete_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
_stream = False
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=_stream, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_delete_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
@distributed_trace_async
async def begin_delete(
self, resource_group_name: str, private_cloud_name: str, global_reach_connection_name: str, **kwargs: Any
) -> AsyncLROPoller[None]:
"""Delete a global reach connection in a private cloud.
Delete a global reach connection in a private cloud.
:param resource_group_name: The name of the resource group. The name is case insensitive.
Required.
:type resource_group_name: str
:param private_cloud_name: Name of the private cloud. Required.
:type private_cloud_name: str
:param global_reach_connection_name: Name of the global reach connection in the private cloud.
Required.
:type global_reach_connection_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = kwargs.pop("headers", {}) or {}
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._delete_initial( # type: ignore
resource_group_name=resource_group_name,
private_cloud_name=private_cloud_name,
global_reach_connection_name=global_reach_connection_name,
api_version=api_version,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_delete.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AVS/privateClouds/{privateCloudName}/globalReachConnections/{globalReachConnectionName}"
}
| 0.897125 | 0.08374 |
import sys
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
from .. import _serialization
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
class Resource(_serialization.Model):
"""The core properties of ARM resources.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: 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"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.id = None
self.name = None
self.type = None
class Addon(Resource):
"""An addon resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar properties: The properties of an addon resource.
:vartype properties: ~azure.mgmt.avs.models.AddonProperties
"""
_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"},
"properties": {"key": "properties", "type": "AddonProperties"},
}
def __init__(self, *, properties: Optional["_models.AddonProperties"] = None, **kwargs: Any) -> None:
"""
:keyword properties: The properties of an addon resource.
:paramtype properties: ~azure.mgmt.avs.models.AddonProperties
"""
super().__init__(**kwargs)
self.properties = properties
class AddonProperties(_serialization.Model):
"""The properties of an addon.
You probably want to use the sub-classes and not this class directly. Known sub-classes are:
AddonArcProperties, AddonHcxProperties, AddonSrmProperties, AddonVrProperties
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR",
"HCX", and "Arc".
:vartype addon_type: str or ~azure.mgmt.avs.models.AddonType
:ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState
"""
_validation = {
"addon_type": {"required": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"addon_type": {"key": "addonType", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
}
_subtype_map = {
"addon_type": {
"Arc": "AddonArcProperties",
"HCX": "AddonHcxProperties",
"SRM": "AddonSrmProperties",
"VR": "AddonVrProperties",
}
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.addon_type: Optional[str] = None
self.provisioning_state = None
class AddonArcProperties(AddonProperties):
"""The properties of an Arc addon.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR",
"HCX", and "Arc".
:vartype addon_type: str or ~azure.mgmt.avs.models.AddonType
:ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState
:ivar v_center: The VMware vCenter resource ID.
:vartype v_center: str
"""
_validation = {
"addon_type": {"required": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"addon_type": {"key": "addonType", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"v_center": {"key": "vCenter", "type": "str"},
}
def __init__(self, *, v_center: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword v_center: The VMware vCenter resource ID.
:paramtype v_center: str
"""
super().__init__(**kwargs)
self.addon_type: str = "Arc"
self.v_center = v_center
class AddonHcxProperties(AddonProperties):
"""The properties of an HCX addon.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR",
"HCX", and "Arc".
:vartype addon_type: str or ~azure.mgmt.avs.models.AddonType
:ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState
:ivar offer: The HCX offer, example VMware MaaS Cloud Provider (Enterprise). Required.
:vartype offer: str
"""
_validation = {
"addon_type": {"required": True},
"provisioning_state": {"readonly": True},
"offer": {"required": True},
}
_attribute_map = {
"addon_type": {"key": "addonType", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"offer": {"key": "offer", "type": "str"},
}
def __init__(self, *, offer: str, **kwargs: Any) -> None:
"""
:keyword offer: The HCX offer, example VMware MaaS Cloud Provider (Enterprise). Required.
:paramtype offer: str
"""
super().__init__(**kwargs)
self.addon_type: str = "HCX"
self.offer = offer
class AddonList(_serialization.Model):
"""A paged list of addons.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.Addon]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[Addon]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class AddonSrmProperties(AddonProperties):
"""The properties of a Site Recovery Manager (SRM) addon.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR",
"HCX", and "Arc".
:vartype addon_type: str or ~azure.mgmt.avs.models.AddonType
:ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState
:ivar license_key: The Site Recovery Manager (SRM) license.
:vartype license_key: str
"""
_validation = {
"addon_type": {"required": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"addon_type": {"key": "addonType", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"license_key": {"key": "licenseKey", "type": "str"},
}
def __init__(self, *, license_key: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword license_key: The Site Recovery Manager (SRM) license.
:paramtype license_key: str
"""
super().__init__(**kwargs)
self.addon_type: str = "SRM"
self.license_key = license_key
class AddonVrProperties(AddonProperties):
"""The properties of a vSphere Replication (VR) addon.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR",
"HCX", and "Arc".
:vartype addon_type: str or ~azure.mgmt.avs.models.AddonType
:ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState
:ivar vrs_count: The vSphere Replication Server (VRS) count. Required.
:vartype vrs_count: int
"""
_validation = {
"addon_type": {"required": True},
"provisioning_state": {"readonly": True},
"vrs_count": {"required": True},
}
_attribute_map = {
"addon_type": {"key": "addonType", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"vrs_count": {"key": "vrsCount", "type": "int"},
}
def __init__(self, *, vrs_count: int, **kwargs: Any) -> None:
"""
:keyword vrs_count: The vSphere Replication Server (VRS) count. Required.
:paramtype vrs_count: int
"""
super().__init__(**kwargs)
self.addon_type: str = "VR"
self.vrs_count = vrs_count
class AdminCredentials(_serialization.Model):
"""Administrative credentials for accessing vCenter and NSX-T.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar nsxt_username: NSX-T Manager username.
:vartype nsxt_username: str
:ivar nsxt_password: NSX-T Manager password.
:vartype nsxt_password: str
:ivar vcenter_username: vCenter admin username.
:vartype vcenter_username: str
:ivar vcenter_password: vCenter admin password.
:vartype vcenter_password: str
"""
_validation = {
"nsxt_username": {"readonly": True},
"nsxt_password": {"readonly": True},
"vcenter_username": {"readonly": True},
"vcenter_password": {"readonly": True},
}
_attribute_map = {
"nsxt_username": {"key": "nsxtUsername", "type": "str"},
"nsxt_password": {"key": "nsxtPassword", "type": "str"},
"vcenter_username": {"key": "vcenterUsername", "type": "str"},
"vcenter_password": {"key": "vcenterPassword", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.nsxt_username = None
self.nsxt_password = None
self.vcenter_username = None
self.vcenter_password = None
class AvailabilityProperties(_serialization.Model):
"""The properties describing private cloud availability zone distribution.
:ivar strategy: The availability strategy for the private cloud. Known values are: "SingleZone"
and "DualZone".
:vartype strategy: str or ~azure.mgmt.avs.models.AvailabilityStrategy
:ivar zone: The primary availability zone for the private cloud.
:vartype zone: int
:ivar secondary_zone: The secondary availability zone for the private cloud.
:vartype secondary_zone: int
"""
_attribute_map = {
"strategy": {"key": "strategy", "type": "str"},
"zone": {"key": "zone", "type": "int"},
"secondary_zone": {"key": "secondaryZone", "type": "int"},
}
def __init__(
self,
*,
strategy: Optional[Union[str, "_models.AvailabilityStrategy"]] = None,
zone: Optional[int] = None,
secondary_zone: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword strategy: The availability strategy for the private cloud. Known values are:
"SingleZone" and "DualZone".
:paramtype strategy: str or ~azure.mgmt.avs.models.AvailabilityStrategy
:keyword zone: The primary availability zone for the private cloud.
:paramtype zone: int
:keyword secondary_zone: The secondary availability zone for the private cloud.
:paramtype secondary_zone: int
"""
super().__init__(**kwargs)
self.strategy = strategy
self.zone = zone
self.secondary_zone = secondary_zone
class Circuit(_serialization.Model):
"""An ExpressRoute Circuit.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar primary_subnet: CIDR of primary subnet.
:vartype primary_subnet: str
:ivar secondary_subnet: CIDR of secondary subnet.
:vartype secondary_subnet: str
:ivar express_route_id: Identifier of the ExpressRoute Circuit (Microsoft Colo only).
:vartype express_route_id: str
:ivar express_route_private_peering_id: ExpressRoute Circuit private peering identifier.
:vartype express_route_private_peering_id: str
"""
_validation = {
"primary_subnet": {"readonly": True},
"secondary_subnet": {"readonly": True},
"express_route_id": {"readonly": True},
"express_route_private_peering_id": {"readonly": True},
}
_attribute_map = {
"primary_subnet": {"key": "primarySubnet", "type": "str"},
"secondary_subnet": {"key": "secondarySubnet", "type": "str"},
"express_route_id": {"key": "expressRouteID", "type": "str"},
"express_route_private_peering_id": {"key": "expressRoutePrivatePeeringID", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.primary_subnet = None
self.secondary_subnet = None
self.express_route_id = None
self.express_route_private_peering_id = None
class CloudLink(Resource):
"""A cloud link resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar status: The state of the cloud link. Known values are: "Active", "Building", "Deleting",
"Failed", and "Disconnected".
:vartype status: str or ~azure.mgmt.avs.models.CloudLinkStatus
:ivar linked_cloud: Identifier of the other private cloud participating in the link.
:vartype linked_cloud: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"status": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"status": {"key": "properties.status", "type": "str"},
"linked_cloud": {"key": "properties.linkedCloud", "type": "str"},
}
def __init__(self, *, linked_cloud: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword linked_cloud: Identifier of the other private cloud participating in the link.
:paramtype linked_cloud: str
"""
super().__init__(**kwargs)
self.status = None
self.linked_cloud = linked_cloud
class CloudLinkList(_serialization.Model):
"""A paged list of cloud links.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.CloudLink]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[CloudLink]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class Cluster(Resource):
"""A cluster resource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar sku: The cluster SKU. Required.
:vartype sku: ~azure.mgmt.avs.models.Sku
:ivar cluster_size: The cluster size.
:vartype cluster_size: int
:ivar provisioning_state: The state of the cluster provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState
:ivar cluster_id: The identity.
:vartype cluster_id: int
:ivar hosts: The hosts.
:vartype hosts: list[str]
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"sku": {"required": True},
"provisioning_state": {"readonly": True},
"cluster_id": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"sku": {"key": "sku", "type": "Sku"},
"cluster_size": {"key": "properties.clusterSize", "type": "int"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"cluster_id": {"key": "properties.clusterId", "type": "int"},
"hosts": {"key": "properties.hosts", "type": "[str]"},
}
def __init__(
self,
*,
sku: "_models.Sku",
cluster_size: Optional[int] = None,
hosts: Optional[List[str]] = None,
**kwargs: Any
) -> None:
"""
:keyword sku: The cluster SKU. Required.
:paramtype sku: ~azure.mgmt.avs.models.Sku
:keyword cluster_size: The cluster size.
:paramtype cluster_size: int
:keyword hosts: The hosts.
:paramtype hosts: list[str]
"""
super().__init__(**kwargs)
self.sku = sku
self.cluster_size = cluster_size
self.provisioning_state = None
self.cluster_id = None
self.hosts = hosts
class ClusterList(_serialization.Model):
"""A paged list of clusters.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.Cluster]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[Cluster]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class CommonClusterProperties(_serialization.Model):
"""The common properties of a cluster.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar cluster_size: The cluster size.
:vartype cluster_size: int
:ivar provisioning_state: The state of the cluster provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState
:ivar cluster_id: The identity.
:vartype cluster_id: int
:ivar hosts: The hosts.
:vartype hosts: list[str]
"""
_validation = {
"provisioning_state": {"readonly": True},
"cluster_id": {"readonly": True},
}
_attribute_map = {
"cluster_size": {"key": "clusterSize", "type": "int"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"cluster_id": {"key": "clusterId", "type": "int"},
"hosts": {"key": "hosts", "type": "[str]"},
}
def __init__(self, *, cluster_size: Optional[int] = None, hosts: Optional[List[str]] = None, **kwargs: Any) -> None:
"""
:keyword cluster_size: The cluster size.
:paramtype cluster_size: int
:keyword hosts: The hosts.
:paramtype hosts: list[str]
"""
super().__init__(**kwargs)
self.cluster_size = cluster_size
self.provisioning_state = None
self.cluster_id = None
self.hosts = hosts
class ClusterProperties(CommonClusterProperties):
"""The properties of a cluster.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar cluster_size: The cluster size.
:vartype cluster_size: int
:ivar provisioning_state: The state of the cluster provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState
:ivar cluster_id: The identity.
:vartype cluster_id: int
:ivar hosts: The hosts.
:vartype hosts: list[str]
"""
_validation = {
"provisioning_state": {"readonly": True},
"cluster_id": {"readonly": True},
}
_attribute_map = {
"cluster_size": {"key": "clusterSize", "type": "int"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"cluster_id": {"key": "clusterId", "type": "int"},
"hosts": {"key": "hosts", "type": "[str]"},
}
def __init__(self, *, cluster_size: Optional[int] = None, hosts: Optional[List[str]] = None, **kwargs: Any) -> None:
"""
:keyword cluster_size: The cluster size.
:paramtype cluster_size: int
:keyword hosts: The hosts.
:paramtype hosts: list[str]
"""
super().__init__(cluster_size=cluster_size, hosts=hosts, **kwargs)
class ClusterUpdate(_serialization.Model):
"""An update of a cluster resource.
:ivar cluster_size: The cluster size.
:vartype cluster_size: int
:ivar hosts: The hosts.
:vartype hosts: list[str]
"""
_attribute_map = {
"cluster_size": {"key": "properties.clusterSize", "type": "int"},
"hosts": {"key": "properties.hosts", "type": "[str]"},
}
def __init__(self, *, cluster_size: Optional[int] = None, hosts: Optional[List[str]] = None, **kwargs: Any) -> None:
"""
:keyword cluster_size: The cluster size.
:paramtype cluster_size: int
:keyword hosts: The hosts.
:paramtype hosts: list[str]
"""
super().__init__(**kwargs)
self.cluster_size = cluster_size
self.hosts = hosts
class ClusterZone(_serialization.Model):
"""Zone and associated hosts info.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar hosts: List of hosts belonging to the availability zone in a cluster.
:vartype hosts: list[str]
:ivar zone: Availability zone identifier.
:vartype zone: str
"""
_validation = {
"hosts": {"readonly": True},
"zone": {"readonly": True},
}
_attribute_map = {
"hosts": {"key": "hosts", "type": "[str]"},
"zone": {"key": "zone", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.hosts = None
self.zone = None
class ClusterZoneList(_serialization.Model):
"""List of all zones and associated hosts for a cluster.
:ivar zones: Zone and associated hosts info.
:vartype zones: list[~azure.mgmt.avs.models.ClusterZone]
"""
_attribute_map = {
"zones": {"key": "zones", "type": "[ClusterZone]"},
}
def __init__(self, *, zones: Optional[List["_models.ClusterZone"]] = None, **kwargs: Any) -> None:
"""
:keyword zones: Zone and associated hosts info.
:paramtype zones: list[~azure.mgmt.avs.models.ClusterZone]
"""
super().__init__(**kwargs)
self.zones = zones
class Datastore(Resource):
"""A datastore resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar provisioning_state: The state of the datastore provisioning. Known values are:
"Succeeded", "Failed", "Cancelled", "Pending", "Creating", "Updating", "Deleting", and
"Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.DatastoreProvisioningState
:ivar net_app_volume: An Azure NetApp Files volume.
:vartype net_app_volume: ~azure.mgmt.avs.models.NetAppVolume
:ivar disk_pool_volume: An iSCSI volume.
:vartype disk_pool_volume: ~azure.mgmt.avs.models.DiskPoolVolume
:ivar status: The operational status of the datastore. Known values are: "Unknown",
"Accessible", "Inaccessible", "Attached", "Detached", "LostCommunication", and "DeadOrError".
:vartype status: str or ~azure.mgmt.avs.models.DatastoreStatus
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"provisioning_state": {"readonly": True},
"status": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"net_app_volume": {"key": "properties.netAppVolume", "type": "NetAppVolume"},
"disk_pool_volume": {"key": "properties.diskPoolVolume", "type": "DiskPoolVolume"},
"status": {"key": "properties.status", "type": "str"},
}
def __init__(
self,
*,
net_app_volume: Optional["_models.NetAppVolume"] = None,
disk_pool_volume: Optional["_models.DiskPoolVolume"] = None,
**kwargs: Any
) -> None:
"""
:keyword net_app_volume: An Azure NetApp Files volume.
:paramtype net_app_volume: ~azure.mgmt.avs.models.NetAppVolume
:keyword disk_pool_volume: An iSCSI volume.
:paramtype disk_pool_volume: ~azure.mgmt.avs.models.DiskPoolVolume
"""
super().__init__(**kwargs)
self.provisioning_state = None
self.net_app_volume = net_app_volume
self.disk_pool_volume = disk_pool_volume
self.status = None
class DatastoreList(_serialization.Model):
"""A paged list of datastores.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.Datastore]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[Datastore]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class DiskPoolVolume(_serialization.Model):
"""An iSCSI volume from Microsoft.StoragePool provider.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar target_id: Azure resource ID of the iSCSI target. Required.
:vartype target_id: str
:ivar lun_name: Name of the LUN to be used for datastore. Required.
:vartype lun_name: str
:ivar mount_option: Mode that describes whether the LUN has to be mounted as a datastore or
attached as a LUN. Known values are: "MOUNT" and "ATTACH".
:vartype mount_option: str or ~azure.mgmt.avs.models.MountOptionEnum
:ivar path: Device path.
:vartype path: str
"""
_validation = {
"target_id": {"required": True},
"lun_name": {"required": True},
"path": {"readonly": True},
}
_attribute_map = {
"target_id": {"key": "targetId", "type": "str"},
"lun_name": {"key": "lunName", "type": "str"},
"mount_option": {"key": "mountOption", "type": "str"},
"path": {"key": "path", "type": "str"},
}
def __init__(
self,
*,
target_id: str,
lun_name: str,
mount_option: Union[str, "_models.MountOptionEnum"] = "MOUNT",
**kwargs: Any
) -> None:
"""
:keyword target_id: Azure resource ID of the iSCSI target. Required.
:paramtype target_id: str
:keyword lun_name: Name of the LUN to be used for datastore. Required.
:paramtype lun_name: str
:keyword mount_option: Mode that describes whether the LUN has to be mounted as a datastore or
attached as a LUN. Known values are: "MOUNT" and "ATTACH".
:paramtype mount_option: str or ~azure.mgmt.avs.models.MountOptionEnum
"""
super().__init__(**kwargs)
self.target_id = target_id
self.lun_name = lun_name
self.mount_option = mount_option
self.path = None
class Encryption(_serialization.Model):
"""The properties of customer managed encryption key.
:ivar status: Status of customer managed encryption key. Known values are: "Enabled" and
"Disabled".
:vartype status: str or ~azure.mgmt.avs.models.EncryptionState
:ivar key_vault_properties: The key vault where the encryption key is stored.
:vartype key_vault_properties: ~azure.mgmt.avs.models.EncryptionKeyVaultProperties
"""
_attribute_map = {
"status": {"key": "status", "type": "str"},
"key_vault_properties": {"key": "keyVaultProperties", "type": "EncryptionKeyVaultProperties"},
}
def __init__(
self,
*,
status: Optional[Union[str, "_models.EncryptionState"]] = None,
key_vault_properties: Optional["_models.EncryptionKeyVaultProperties"] = None,
**kwargs: Any
) -> None:
"""
:keyword status: Status of customer managed encryption key. Known values are: "Enabled" and
"Disabled".
:paramtype status: str or ~azure.mgmt.avs.models.EncryptionState
:keyword key_vault_properties: The key vault where the encryption key is stored.
:paramtype key_vault_properties: ~azure.mgmt.avs.models.EncryptionKeyVaultProperties
"""
super().__init__(**kwargs)
self.status = status
self.key_vault_properties = key_vault_properties
class EncryptionKeyVaultProperties(_serialization.Model):
"""An Encryption Key.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar key_name: The name of the key.
:vartype key_name: str
:ivar key_version: The version of the key.
:vartype key_version: str
:ivar auto_detected_key_version: The auto-detected version of the key if versionType is
auto-detected.
:vartype auto_detected_key_version: str
:ivar key_vault_url: The URL of the vault.
:vartype key_vault_url: str
:ivar key_state: The state of key provided. Known values are: "Connected" and "AccessDenied".
:vartype key_state: str or ~azure.mgmt.avs.models.EncryptionKeyStatus
:ivar version_type: Property of the key if user provided or auto detected. Known values are:
"Fixed" and "AutoDetected".
:vartype version_type: str or ~azure.mgmt.avs.models.EncryptionVersionType
"""
_validation = {
"auto_detected_key_version": {"readonly": True},
"key_state": {"readonly": True},
"version_type": {"readonly": True},
}
_attribute_map = {
"key_name": {"key": "keyName", "type": "str"},
"key_version": {"key": "keyVersion", "type": "str"},
"auto_detected_key_version": {"key": "autoDetectedKeyVersion", "type": "str"},
"key_vault_url": {"key": "keyVaultUrl", "type": "str"},
"key_state": {"key": "keyState", "type": "str"},
"version_type": {"key": "versionType", "type": "str"},
}
def __init__(
self,
*,
key_name: Optional[str] = None,
key_version: Optional[str] = None,
key_vault_url: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword key_name: The name of the key.
:paramtype key_name: str
:keyword key_version: The version of the key.
:paramtype key_version: str
:keyword key_vault_url: The URL of the vault.
:paramtype key_vault_url: str
"""
super().__init__(**kwargs)
self.key_name = key_name
self.key_version = key_version
self.auto_detected_key_version = None
self.key_vault_url = key_vault_url
self.key_state = None
self.version_type = None
class Endpoints(_serialization.Model):
"""Endpoint addresses.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar nsxt_manager: Endpoint for the NSX-T Data Center manager.
:vartype nsxt_manager: str
:ivar vcsa: Endpoint for Virtual Center Server Appliance.
:vartype vcsa: str
:ivar hcx_cloud_manager: Endpoint for the HCX Cloud Manager.
:vartype hcx_cloud_manager: str
"""
_validation = {
"nsxt_manager": {"readonly": True},
"vcsa": {"readonly": True},
"hcx_cloud_manager": {"readonly": True},
}
_attribute_map = {
"nsxt_manager": {"key": "nsxtManager", "type": "str"},
"vcsa": {"key": "vcsa", "type": "str"},
"hcx_cloud_manager": {"key": "hcxCloudManager", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.nsxt_manager = None
self.vcsa = None
self.hcx_cloud_manager = None
class ErrorAdditionalInfo(_serialization.Model):
"""The resource management error additional info.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar type: The additional info type.
:vartype type: str
:ivar info: The additional info.
:vartype info: JSON
"""
_validation = {
"type": {"readonly": True},
"info": {"readonly": True},
}
_attribute_map = {
"type": {"key": "type", "type": "str"},
"info": {"key": "info", "type": "object"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.type = None
self.info = None
class ErrorDetail(_serialization.Model):
"""The error detail.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar code: The error code.
:vartype code: str
:ivar message: The error message.
:vartype message: str
:ivar target: The error target.
:vartype target: str
:ivar details: The error details.
:vartype details: list[~azure.mgmt.avs.models.ErrorDetail]
:ivar additional_info: The error additional info.
:vartype additional_info: list[~azure.mgmt.avs.models.ErrorAdditionalInfo]
"""
_validation = {
"code": {"readonly": True},
"message": {"readonly": True},
"target": {"readonly": True},
"details": {"readonly": True},
"additional_info": {"readonly": True},
}
_attribute_map = {
"code": {"key": "code", "type": "str"},
"message": {"key": "message", "type": "str"},
"target": {"key": "target", "type": "str"},
"details": {"key": "details", "type": "[ErrorDetail]"},
"additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.code = None
self.message = None
self.target = None
self.details = None
self.additional_info = None
class ErrorResponse(_serialization.Model):
"""Common error response for all Azure Resource Manager APIs to return error details for failed
operations. (This also follows the OData error response format.).
:ivar error: The error object.
:vartype error: ~azure.mgmt.avs.models.ErrorDetail
"""
_attribute_map = {
"error": {"key": "error", "type": "ErrorDetail"},
}
def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None:
"""
:keyword error: The error object.
:paramtype error: ~azure.mgmt.avs.models.ErrorDetail
"""
super().__init__(**kwargs)
self.error = error
class ExpressRouteAuthorization(Resource):
"""ExpressRoute Circuit Authorization.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar provisioning_state: The state of the ExpressRoute Circuit Authorization provisioning.
Known values are: "Succeeded", "Failed", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.ExpressRouteAuthorizationProvisioningState
:ivar express_route_authorization_id: The ID of the ExpressRoute Circuit Authorization.
:vartype express_route_authorization_id: str
:ivar express_route_authorization_key: The key of the ExpressRoute Circuit Authorization.
:vartype express_route_authorization_key: str
:ivar express_route_id: The ID of the ExpressRoute Circuit.
:vartype express_route_id: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"provisioning_state": {"readonly": True},
"express_route_authorization_id": {"readonly": True},
"express_route_authorization_key": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"express_route_authorization_id": {"key": "properties.expressRouteAuthorizationId", "type": "str"},
"express_route_authorization_key": {"key": "properties.expressRouteAuthorizationKey", "type": "str"},
"express_route_id": {"key": "properties.expressRouteId", "type": "str"},
}
def __init__(self, *, express_route_id: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword express_route_id: The ID of the ExpressRoute Circuit.
:paramtype express_route_id: str
"""
super().__init__(**kwargs)
self.provisioning_state = None
self.express_route_authorization_id = None
self.express_route_authorization_key = None
self.express_route_id = express_route_id
class ExpressRouteAuthorizationList(_serialization.Model):
"""A paged list of ExpressRoute Circuit Authorizations.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[ExpressRouteAuthorization]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class GlobalReachConnection(Resource):
"""A global reach connection resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar provisioning_state: The state of the ExpressRoute Circuit Authorization provisioning.
Known values are: "Succeeded", "Failed", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.GlobalReachConnectionProvisioningState
:ivar address_prefix: The network used for global reach carved out from the original network
block provided for the private cloud.
:vartype address_prefix: str
:ivar authorization_key: Authorization key from the peer express route used for the global
reach connection.
:vartype authorization_key: str
:ivar circuit_connection_status: The connection status of the global reach connection. Known
values are: "Connected", "Connecting", and "Disconnected".
:vartype circuit_connection_status: str or ~azure.mgmt.avs.models.GlobalReachConnectionStatus
:ivar peer_express_route_circuit: Identifier of the ExpressRoute Circuit to peer with in the
global reach connection.
:vartype peer_express_route_circuit: str
:ivar express_route_id: The ID of the Private Cloud's ExpressRoute Circuit that is
participating in the global reach connection.
:vartype express_route_id: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"provisioning_state": {"readonly": True},
"address_prefix": {"readonly": True},
"circuit_connection_status": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"address_prefix": {"key": "properties.addressPrefix", "type": "str"},
"authorization_key": {"key": "properties.authorizationKey", "type": "str"},
"circuit_connection_status": {"key": "properties.circuitConnectionStatus", "type": "str"},
"peer_express_route_circuit": {"key": "properties.peerExpressRouteCircuit", "type": "str"},
"express_route_id": {"key": "properties.expressRouteId", "type": "str"},
}
def __init__(
self,
*,
authorization_key: Optional[str] = None,
peer_express_route_circuit: Optional[str] = None,
express_route_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword authorization_key: Authorization key from the peer express route used for the global
reach connection.
:paramtype authorization_key: str
:keyword peer_express_route_circuit: Identifier of the ExpressRoute Circuit to peer with in the
global reach connection.
:paramtype peer_express_route_circuit: str
:keyword express_route_id: The ID of the Private Cloud's ExpressRoute Circuit that is
participating in the global reach connection.
:paramtype express_route_id: str
"""
super().__init__(**kwargs)
self.provisioning_state = None
self.address_prefix = None
self.authorization_key = authorization_key
self.circuit_connection_status = None
self.peer_express_route_circuit = peer_express_route_circuit
self.express_route_id = express_route_id
class GlobalReachConnectionList(_serialization.Model):
"""A paged list of global reach connections.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.GlobalReachConnection]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[GlobalReachConnection]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class HcxEnterpriseSite(Resource):
"""An HCX Enterprise Site resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar activation_key: The activation key.
:vartype activation_key: str
:ivar status: The status of the HCX Enterprise Site. Known values are: "Available", "Consumed",
"Deactivated", and "Deleted".
:vartype status: str or ~azure.mgmt.avs.models.HcxEnterpriseSiteStatus
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"activation_key": {"readonly": True},
"status": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"activation_key": {"key": "properties.activationKey", "type": "str"},
"status": {"key": "properties.status", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.activation_key = None
self.status = None
class HcxEnterpriseSiteList(_serialization.Model):
"""A paged list of HCX Enterprise Sites.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.HcxEnterpriseSite]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[HcxEnterpriseSite]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class IdentitySource(_serialization.Model):
"""vCenter Single Sign On Identity Source.
:ivar name: The name of the identity source.
:vartype name: str
:ivar alias: The domain's NetBIOS name.
:vartype alias: str
:ivar domain: The domain's dns name.
:vartype domain: str
:ivar base_user_dn: The base distinguished name for users.
:vartype base_user_dn: str
:ivar base_group_dn: The base distinguished name for groups.
:vartype base_group_dn: str
:ivar primary_server: Primary server URL.
:vartype primary_server: str
:ivar secondary_server: Secondary server URL.
:vartype secondary_server: str
:ivar ssl: Protect LDAP communication using SSL certificate (LDAPS). Known values are:
"Enabled" and "Disabled".
:vartype ssl: str or ~azure.mgmt.avs.models.SslEnum
:ivar username: The ID of an Active Directory user with a minimum of read-only access to Base
DN for users and group.
:vartype username: str
:ivar password: The password of the Active Directory user with a minimum of read-only access to
Base DN for users and groups.
:vartype password: str
"""
_attribute_map = {
"name": {"key": "name", "type": "str"},
"alias": {"key": "alias", "type": "str"},
"domain": {"key": "domain", "type": "str"},
"base_user_dn": {"key": "baseUserDN", "type": "str"},
"base_group_dn": {"key": "baseGroupDN", "type": "str"},
"primary_server": {"key": "primaryServer", "type": "str"},
"secondary_server": {"key": "secondaryServer", "type": "str"},
"ssl": {"key": "ssl", "type": "str"},
"username": {"key": "username", "type": "str"},
"password": {"key": "password", "type": "str"},
}
def __init__(
self,
*,
name: Optional[str] = None,
alias: Optional[str] = None,
domain: Optional[str] = None,
base_user_dn: Optional[str] = None,
base_group_dn: Optional[str] = None,
primary_server: Optional[str] = None,
secondary_server: Optional[str] = None,
ssl: Optional[Union[str, "_models.SslEnum"]] = None,
username: Optional[str] = None,
password: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword name: The name of the identity source.
:paramtype name: str
:keyword alias: The domain's NetBIOS name.
:paramtype alias: str
:keyword domain: The domain's dns name.
:paramtype domain: str
:keyword base_user_dn: The base distinguished name for users.
:paramtype base_user_dn: str
:keyword base_group_dn: The base distinguished name for groups.
:paramtype base_group_dn: str
:keyword primary_server: Primary server URL.
:paramtype primary_server: str
:keyword secondary_server: Secondary server URL.
:paramtype secondary_server: str
:keyword ssl: Protect LDAP communication using SSL certificate (LDAPS). Known values are:
"Enabled" and "Disabled".
:paramtype ssl: str or ~azure.mgmt.avs.models.SslEnum
:keyword username: The ID of an Active Directory user with a minimum of read-only access to
Base DN for users and group.
:paramtype username: str
:keyword password: The password of the Active Directory user with a minimum of read-only access
to Base DN for users and groups.
:paramtype password: str
"""
super().__init__(**kwargs)
self.name = name
self.alias = alias
self.domain = domain
self.base_user_dn = base_user_dn
self.base_group_dn = base_group_dn
self.primary_server = primary_server
self.secondary_server = secondary_server
self.ssl = ssl
self.username = username
self.password = password
class LogSpecification(_serialization.Model):
"""Specifications of the Log for Azure Monitoring.
:ivar name: Name of the log.
:vartype name: str
:ivar display_name: Localized friendly display name of the log.
:vartype display_name: str
:ivar blob_duration: Blob duration of the log.
:vartype blob_duration: str
"""
_attribute_map = {
"name": {"key": "name", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"blob_duration": {"key": "blobDuration", "type": "str"},
}
def __init__(
self,
*,
name: Optional[str] = None,
display_name: Optional[str] = None,
blob_duration: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword name: Name of the log.
:paramtype name: str
:keyword display_name: Localized friendly display name of the log.
:paramtype display_name: str
:keyword blob_duration: Blob duration of the log.
:paramtype blob_duration: str
"""
super().__init__(**kwargs)
self.name = name
self.display_name = display_name
self.blob_duration = blob_duration
class ManagementCluster(CommonClusterProperties):
"""The properties of a management cluster.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar cluster_size: The cluster size.
:vartype cluster_size: int
:ivar provisioning_state: The state of the cluster provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState
:ivar cluster_id: The identity.
:vartype cluster_id: int
:ivar hosts: The hosts.
:vartype hosts: list[str]
"""
_validation = {
"provisioning_state": {"readonly": True},
"cluster_id": {"readonly": True},
}
_attribute_map = {
"cluster_size": {"key": "clusterSize", "type": "int"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"cluster_id": {"key": "clusterId", "type": "int"},
"hosts": {"key": "hosts", "type": "[str]"},
}
def __init__(self, *, cluster_size: Optional[int] = None, hosts: Optional[List[str]] = None, **kwargs: Any) -> None:
"""
:keyword cluster_size: The cluster size.
:paramtype cluster_size: int
:keyword hosts: The hosts.
:paramtype hosts: list[str]
"""
super().__init__(cluster_size=cluster_size, hosts=hosts, **kwargs)
class MetricDimension(_serialization.Model):
"""Specifications of the Dimension of metrics.
:ivar name: Name of the dimension.
:vartype name: str
:ivar display_name: Localized friendly display name of the dimension.
:vartype display_name: str
:ivar internal_name: Name of the dimension as it appears in MDM.
:vartype internal_name: str
:ivar to_be_exported_for_shoebox: A boolean flag indicating whether this dimension should be
included for the shoebox export scenario.
:vartype to_be_exported_for_shoebox: bool
"""
_attribute_map = {
"name": {"key": "name", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"internal_name": {"key": "internalName", "type": "str"},
"to_be_exported_for_shoebox": {"key": "toBeExportedForShoebox", "type": "bool"},
}
def __init__(
self,
*,
name: Optional[str] = None,
display_name: Optional[str] = None,
internal_name: Optional[str] = None,
to_be_exported_for_shoebox: Optional[bool] = None,
**kwargs: Any
) -> None:
"""
:keyword name: Name of the dimension.
:paramtype name: str
:keyword display_name: Localized friendly display name of the dimension.
:paramtype display_name: str
:keyword internal_name: Name of the dimension as it appears in MDM.
:paramtype internal_name: str
:keyword to_be_exported_for_shoebox: A boolean flag indicating whether this dimension should be
included for the shoebox export scenario.
:paramtype to_be_exported_for_shoebox: bool
"""
super().__init__(**kwargs)
self.name = name
self.display_name = display_name
self.internal_name = internal_name
self.to_be_exported_for_shoebox = to_be_exported_for_shoebox
class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes
"""Specifications of the Metrics for Azure Monitoring.
:ivar name: Name of the metric.
:vartype name: str
:ivar display_name: Localized friendly display name of the metric.
:vartype display_name: str
:ivar display_description: Localized friendly description of the metric.
:vartype display_description: str
:ivar unit: Unit that makes sense for the metric.
:vartype unit: str
:ivar category: Name of the metric category that the metric belongs to. A metric can only
belong to a single category.
:vartype category: str
:ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum,
Maximum, Total, Count.
:vartype aggregation_type: str
:ivar supported_aggregation_types: Supported aggregation types.
:vartype supported_aggregation_types: list[str]
:ivar supported_time_grain_types: Supported time grain types.
:vartype supported_time_grain_types: list[str]
:ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time
duration where no metric is emitted/published.
:vartype fill_gap_with_zero: bool
:ivar dimensions: Dimensions of the metric.
:vartype dimensions: list[~azure.mgmt.avs.models.MetricDimension]
:ivar enable_regional_mdm_account: Whether or not the service is using regional MDM accounts.
:vartype enable_regional_mdm_account: str
:ivar source_mdm_account: The name of the MDM account.
:vartype source_mdm_account: str
:ivar source_mdm_namespace: The name of the MDM namespace.
:vartype source_mdm_namespace: str
"""
_attribute_map = {
"name": {"key": "name", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"display_description": {"key": "displayDescription", "type": "str"},
"unit": {"key": "unit", "type": "str"},
"category": {"key": "category", "type": "str"},
"aggregation_type": {"key": "aggregationType", "type": "str"},
"supported_aggregation_types": {"key": "supportedAggregationTypes", "type": "[str]"},
"supported_time_grain_types": {"key": "supportedTimeGrainTypes", "type": "[str]"},
"fill_gap_with_zero": {"key": "fillGapWithZero", "type": "bool"},
"dimensions": {"key": "dimensions", "type": "[MetricDimension]"},
"enable_regional_mdm_account": {"key": "enableRegionalMdmAccount", "type": "str"},
"source_mdm_account": {"key": "sourceMdmAccount", "type": "str"},
"source_mdm_namespace": {"key": "sourceMdmNamespace", "type": "str"},
}
def __init__(
self,
*,
name: Optional[str] = None,
display_name: Optional[str] = None,
display_description: Optional[str] = None,
unit: Optional[str] = None,
category: Optional[str] = None,
aggregation_type: Optional[str] = None,
supported_aggregation_types: Optional[List[str]] = None,
supported_time_grain_types: Optional[List[str]] = None,
fill_gap_with_zero: Optional[bool] = None,
dimensions: Optional[List["_models.MetricDimension"]] = None,
enable_regional_mdm_account: Optional[str] = None,
source_mdm_account: Optional[str] = None,
source_mdm_namespace: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword name: Name of the metric.
:paramtype name: str
:keyword display_name: Localized friendly display name of the metric.
:paramtype display_name: str
:keyword display_description: Localized friendly description of the metric.
:paramtype display_description: str
:keyword unit: Unit that makes sense for the metric.
:paramtype unit: str
:keyword category: Name of the metric category that the metric belongs to. A metric can only
belong to a single category.
:paramtype category: str
:keyword aggregation_type: Only provide one value for this field. Valid values: Average,
Minimum, Maximum, Total, Count.
:paramtype aggregation_type: str
:keyword supported_aggregation_types: Supported aggregation types.
:paramtype supported_aggregation_types: list[str]
:keyword supported_time_grain_types: Supported time grain types.
:paramtype supported_time_grain_types: list[str]
:keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time
duration where no metric is emitted/published.
:paramtype fill_gap_with_zero: bool
:keyword dimensions: Dimensions of the metric.
:paramtype dimensions: list[~azure.mgmt.avs.models.MetricDimension]
:keyword enable_regional_mdm_account: Whether or not the service is using regional MDM
accounts.
:paramtype enable_regional_mdm_account: str
:keyword source_mdm_account: The name of the MDM account.
:paramtype source_mdm_account: str
:keyword source_mdm_namespace: The name of the MDM namespace.
:paramtype source_mdm_namespace: str
"""
super().__init__(**kwargs)
self.name = name
self.display_name = display_name
self.display_description = display_description
self.unit = unit
self.category = category
self.aggregation_type = aggregation_type
self.supported_aggregation_types = supported_aggregation_types
self.supported_time_grain_types = supported_time_grain_types
self.fill_gap_with_zero = fill_gap_with_zero
self.dimensions = dimensions
self.enable_regional_mdm_account = enable_regional_mdm_account
self.source_mdm_account = source_mdm_account
self.source_mdm_namespace = source_mdm_namespace
class NetAppVolume(_serialization.Model):
"""An Azure NetApp Files volume from Microsoft.NetApp provider.
All required parameters must be populated in order to send to Azure.
:ivar id: Azure resource ID of the NetApp volume. Required.
:vartype id: str
"""
_validation = {
"id": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
}
def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin
"""
:keyword id: Azure resource ID of the NetApp volume. Required.
:paramtype id: str
"""
super().__init__(**kwargs)
self.id = id
class Operation(_serialization.Model):
"""A REST API operation.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: Name of the operation being performed on this object.
:vartype name: str
:ivar display: Contains the localized display information for this operation.
:vartype display: ~azure.mgmt.avs.models.OperationDisplay
:ivar is_data_action: Gets or sets a value indicating whether the operation is a data action or
not.
:vartype is_data_action: bool
:ivar origin: Origin of the operation.
:vartype origin: str
:ivar properties: Properties of the operation.
:vartype properties: ~azure.mgmt.avs.models.OperationProperties
"""
_validation = {
"name": {"readonly": True},
"display": {"readonly": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
"display": {"key": "display", "type": "OperationDisplay"},
"is_data_action": {"key": "isDataAction", "type": "bool"},
"origin": {"key": "origin", "type": "str"},
"properties": {"key": "properties", "type": "OperationProperties"},
}
def __init__(
self,
*,
is_data_action: Optional[bool] = None,
origin: Optional[str] = None,
properties: Optional["_models.OperationProperties"] = None,
**kwargs: Any
) -> None:
"""
:keyword is_data_action: Gets or sets a value indicating whether the operation is a data action
or not.
:paramtype is_data_action: bool
:keyword origin: Origin of the operation.
:paramtype origin: str
:keyword properties: Properties of the operation.
:paramtype properties: ~azure.mgmt.avs.models.OperationProperties
"""
super().__init__(**kwargs)
self.name = None
self.display = None
self.is_data_action = is_data_action
self.origin = origin
self.properties = properties
class OperationDisplay(_serialization.Model):
"""Contains the localized display information for this operation.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar provider: Localized friendly form of the resource provider name.
:vartype provider: str
:ivar resource: Localized friendly form of the resource type related to this operation.
:vartype resource: str
:ivar operation: Localized friendly name for the operation.
:vartype operation: str
:ivar description: Localized friendly description for the operation.
:vartype description: str
"""
_validation = {
"provider": {"readonly": True},
"resource": {"readonly": True},
"operation": {"readonly": True},
"description": {"readonly": True},
}
_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: Any) -> None:
""" """
super().__init__(**kwargs)
self.provider = None
self.resource = None
self.operation = None
self.description = None
class OperationList(_serialization.Model):
"""Pageable list of operations.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of operations.
:vartype value: list[~azure.mgmt.avs.models.Operation]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[Operation]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class OperationProperties(_serialization.Model):
"""Extra Operation properties.
:ivar service_specification: Service specifications of the operation.
:vartype service_specification: ~azure.mgmt.avs.models.ServiceSpecification
"""
_attribute_map = {
"service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"},
}
def __init__(
self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any
) -> None:
"""
:keyword service_specification: Service specifications of the operation.
:paramtype service_specification: ~azure.mgmt.avs.models.ServiceSpecification
"""
super().__init__(**kwargs)
self.service_specification = service_specification
class PlacementPoliciesList(_serialization.Model):
"""Represents list of placement policies.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.PlacementPolicy]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[PlacementPolicy]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class PlacementPolicy(Resource):
"""A vSphere Distributed Resource Scheduler (DRS) placement policy.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar properties: placement policy properties.
:vartype properties: ~azure.mgmt.avs.models.PlacementPolicyProperties
"""
_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"},
"properties": {"key": "properties", "type": "PlacementPolicyProperties"},
}
def __init__(self, *, properties: Optional["_models.PlacementPolicyProperties"] = None, **kwargs: Any) -> None:
"""
:keyword properties: placement policy properties.
:paramtype properties: ~azure.mgmt.avs.models.PlacementPolicyProperties
"""
super().__init__(**kwargs)
self.properties = properties
class PlacementPolicyProperties(_serialization.Model):
"""Abstract placement policy properties.
You probably want to use the sub-classes and not this class directly. Known sub-classes are:
VmHostPlacementPolicyProperties, VmPlacementPolicyProperties
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar type: placement policy type. Required. Known values are: "VmVm" and "VmHost".
:vartype type: str or ~azure.mgmt.avs.models.PlacementPolicyType
:ivar state: Whether the placement policy is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:ivar display_name: Display name of the placement policy.
:vartype display_name: str
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState
"""
_validation = {
"type": {"required": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"type": {"key": "type", "type": "str"},
"state": {"key": "state", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
}
_subtype_map = {"type": {"VmHost": "VmHostPlacementPolicyProperties", "VmVm": "VmPlacementPolicyProperties"}}
def __init__(
self,
*,
state: Optional[Union[str, "_models.PlacementPolicyState"]] = None,
display_name: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword state: Whether the placement policy is enabled or disabled. Known values are:
"Enabled" and "Disabled".
:paramtype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:keyword display_name: Display name of the placement policy.
:paramtype display_name: str
"""
super().__init__(**kwargs)
self.type: Optional[str] = None
self.state = state
self.display_name = display_name
self.provisioning_state = None
class PlacementPolicyUpdate(_serialization.Model):
"""An update of a DRS placement policy resource.
:ivar state: Whether the placement policy is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:ivar vm_members: Virtual machine members list.
:vartype vm_members: list[str]
:ivar host_members: Host members list.
:vartype host_members: list[str]
:ivar affinity_strength: vm-host placement policy affinity strength (should/must). Known values
are: "Should" and "Must".
:vartype affinity_strength: str or ~azure.mgmt.avs.models.AffinityStrength
:ivar azure_hybrid_benefit_type: placement policy azure hybrid benefit opt-in type. Known
values are: "SqlHost" and "None".
:vartype azure_hybrid_benefit_type: str or ~azure.mgmt.avs.models.AzureHybridBenefitType
"""
_attribute_map = {
"state": {"key": "properties.state", "type": "str"},
"vm_members": {"key": "properties.vmMembers", "type": "[str]"},
"host_members": {"key": "properties.hostMembers", "type": "[str]"},
"affinity_strength": {"key": "properties.affinityStrength", "type": "str"},
"azure_hybrid_benefit_type": {"key": "properties.azureHybridBenefitType", "type": "str"},
}
def __init__(
self,
*,
state: Optional[Union[str, "_models.PlacementPolicyState"]] = None,
vm_members: Optional[List[str]] = None,
host_members: Optional[List[str]] = None,
affinity_strength: Optional[Union[str, "_models.AffinityStrength"]] = None,
azure_hybrid_benefit_type: Optional[Union[str, "_models.AzureHybridBenefitType"]] = None,
**kwargs: Any
) -> None:
"""
:keyword state: Whether the placement policy is enabled or disabled. Known values are:
"Enabled" and "Disabled".
:paramtype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:keyword vm_members: Virtual machine members list.
:paramtype vm_members: list[str]
:keyword host_members: Host members list.
:paramtype host_members: list[str]
:keyword affinity_strength: vm-host placement policy affinity strength (should/must). Known
values are: "Should" and "Must".
:paramtype affinity_strength: str or ~azure.mgmt.avs.models.AffinityStrength
:keyword azure_hybrid_benefit_type: placement policy azure hybrid benefit opt-in type. Known
values are: "SqlHost" and "None".
:paramtype azure_hybrid_benefit_type: str or ~azure.mgmt.avs.models.AzureHybridBenefitType
"""
super().__init__(**kwargs)
self.state = state
self.vm_members = vm_members
self.host_members = host_members
self.affinity_strength = affinity_strength
self.azure_hybrid_benefit_type = azure_hybrid_benefit_type
class TrackedResource(Resource):
"""The resource model definition for a ARM tracked top level resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar location: Resource location.
:vartype location: str
:ivar tags: Resource tags.
:vartype tags: dict[str, 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}"},
}
def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None:
"""
:keyword location: Resource location.
:paramtype location: str
:keyword tags: Resource tags.
:paramtype tags: dict[str, str]
"""
super().__init__(**kwargs)
self.location = location
self.tags = tags
class PrivateCloud(TrackedResource): # pylint: disable=too-many-instance-attributes
"""A private cloud resource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar location: Resource location.
:vartype location: str
:ivar tags: Resource tags.
:vartype tags: dict[str, str]
:ivar sku: The private cloud SKU. Required.
:vartype sku: ~azure.mgmt.avs.models.Sku
:ivar identity: The identity of the private cloud, if configured.
:vartype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity
:ivar management_cluster: The default cluster used for management.
:vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:ivar internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype internet: str or ~azure.mgmt.avs.models.InternetEnum
:ivar identity_sources: vCenter Single Sign On Identity Sources.
:vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:ivar availability: Properties describing how the cloud is distributed across availability
zones.
:vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:ivar encryption: Customer managed key encryption, can be enabled or disabled.
:vartype encryption: ~azure.mgmt.avs.models.Encryption
:ivar extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:vartype extended_network_blocks: list[str]
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Cancelled", "Pending", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState
:ivar circuit: An ExpressRoute Circuit.
:vartype circuit: ~azure.mgmt.avs.models.Circuit
:ivar endpoints: The endpoints.
:vartype endpoints: ~azure.mgmt.avs.models.Endpoints
:ivar network_block: The block of addresses should be unique across VNet in your subscription
as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are
between 0 and 255, and X is between 0 and 22.
:vartype network_block: str
:ivar management_network: Network used to access vCenter Server and NSX-T Manager.
:vartype management_network: str
:ivar provisioning_network: Used for virtual machine cold migration, cloning, and snapshot
migration.
:vartype provisioning_network: str
:ivar vmotion_network: Used for live migration of virtual machines.
:vartype vmotion_network: str
:ivar vcenter_password: Optionally, set the vCenter admin password when the private cloud is
created.
:vartype vcenter_password: str
:ivar nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is
created.
:vartype nsxt_password: str
:ivar vcenter_certificate_thumbprint: Thumbprint of the vCenter Server SSL certificate.
:vartype vcenter_certificate_thumbprint: str
:ivar nsxt_certificate_thumbprint: Thumbprint of the NSX-T Manager SSL certificate.
:vartype nsxt_certificate_thumbprint: str
:ivar external_cloud_links: Array of cloud link IDs from other clouds that connect to this one.
:vartype external_cloud_links: list[str]
:ivar secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present in a
stretched private cloud.
:vartype secondary_circuit: ~azure.mgmt.avs.models.Circuit
:ivar nsx_public_ip_quota_raised: Flag to indicate whether the private cloud has the quota for
provisioned NSX Public IP count raised from 64 to 1024. Known values are: "Enabled" and
"Disabled".
:vartype nsx_public_ip_quota_raised: str or ~azure.mgmt.avs.models.NsxPublicIpQuotaRaisedEnum
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"sku": {"required": True},
"provisioning_state": {"readonly": True},
"endpoints": {"readonly": True},
"management_network": {"readonly": True},
"provisioning_network": {"readonly": True},
"vmotion_network": {"readonly": True},
"vcenter_certificate_thumbprint": {"readonly": True},
"nsxt_certificate_thumbprint": {"readonly": True},
"external_cloud_links": {"readonly": True},
"nsx_public_ip_quota_raised": {"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}"},
"sku": {"key": "sku", "type": "Sku"},
"identity": {"key": "identity", "type": "PrivateCloudIdentity"},
"management_cluster": {"key": "properties.managementCluster", "type": "ManagementCluster"},
"internet": {"key": "properties.internet", "type": "str"},
"identity_sources": {"key": "properties.identitySources", "type": "[IdentitySource]"},
"availability": {"key": "properties.availability", "type": "AvailabilityProperties"},
"encryption": {"key": "properties.encryption", "type": "Encryption"},
"extended_network_blocks": {"key": "properties.extendedNetworkBlocks", "type": "[str]"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"circuit": {"key": "properties.circuit", "type": "Circuit"},
"endpoints": {"key": "properties.endpoints", "type": "Endpoints"},
"network_block": {"key": "properties.networkBlock", "type": "str"},
"management_network": {"key": "properties.managementNetwork", "type": "str"},
"provisioning_network": {"key": "properties.provisioningNetwork", "type": "str"},
"vmotion_network": {"key": "properties.vmotionNetwork", "type": "str"},
"vcenter_password": {"key": "properties.vcenterPassword", "type": "str"},
"nsxt_password": {"key": "properties.nsxtPassword", "type": "str"},
"vcenter_certificate_thumbprint": {"key": "properties.vcenterCertificateThumbprint", "type": "str"},
"nsxt_certificate_thumbprint": {"key": "properties.nsxtCertificateThumbprint", "type": "str"},
"external_cloud_links": {"key": "properties.externalCloudLinks", "type": "[str]"},
"secondary_circuit": {"key": "properties.secondaryCircuit", "type": "Circuit"},
"nsx_public_ip_quota_raised": {"key": "properties.nsxPublicIpQuotaRaised", "type": "str"},
}
def __init__( # pylint: disable=too-many-locals
self,
*,
sku: "_models.Sku",
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.PrivateCloudIdentity"] = None,
management_cluster: Optional["_models.ManagementCluster"] = None,
internet: Union[str, "_models.InternetEnum"] = "Disabled",
identity_sources: Optional[List["_models.IdentitySource"]] = None,
availability: Optional["_models.AvailabilityProperties"] = None,
encryption: Optional["_models.Encryption"] = None,
extended_network_blocks: Optional[List[str]] = None,
circuit: Optional["_models.Circuit"] = None,
network_block: Optional[str] = None,
vcenter_password: Optional[str] = None,
nsxt_password: Optional[str] = None,
secondary_circuit: Optional["_models.Circuit"] = None,
**kwargs: Any
) -> None:
"""
:keyword location: Resource location.
:paramtype location: str
:keyword tags: Resource tags.
:paramtype tags: dict[str, str]
:keyword sku: The private cloud SKU. Required.
:paramtype sku: ~azure.mgmt.avs.models.Sku
:keyword identity: The identity of the private cloud, if configured.
:paramtype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity
:keyword management_cluster: The default cluster used for management.
:paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:keyword internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum
:keyword identity_sources: vCenter Single Sign On Identity Sources.
:paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:keyword availability: Properties describing how the cloud is distributed across availability
zones.
:paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:keyword encryption: Customer managed key encryption, can be enabled or disabled.
:paramtype encryption: ~azure.mgmt.avs.models.Encryption
:keyword extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:paramtype extended_network_blocks: list[str]
:keyword circuit: An ExpressRoute Circuit.
:paramtype circuit: ~azure.mgmt.avs.models.Circuit
:keyword network_block: The block of addresses should be unique across VNet in your
subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where
A,B,C,D are between 0 and 255, and X is between 0 and 22.
:paramtype network_block: str
:keyword vcenter_password: Optionally, set the vCenter admin password when the private cloud is
created.
:paramtype vcenter_password: str
:keyword nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is
created.
:paramtype nsxt_password: str
:keyword secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present
in a stretched private cloud.
:paramtype secondary_circuit: ~azure.mgmt.avs.models.Circuit
"""
super().__init__(location=location, tags=tags, **kwargs)
self.sku = sku
self.identity = identity
self.management_cluster = management_cluster
self.internet = internet
self.identity_sources = identity_sources
self.availability = availability
self.encryption = encryption
self.extended_network_blocks = extended_network_blocks
self.provisioning_state = None
self.circuit = circuit
self.endpoints = None
self.network_block = network_block
self.management_network = None
self.provisioning_network = None
self.vmotion_network = None
self.vcenter_password = vcenter_password
self.nsxt_password = nsxt_password
self.vcenter_certificate_thumbprint = None
self.nsxt_certificate_thumbprint = None
self.external_cloud_links = None
self.secondary_circuit = secondary_circuit
self.nsx_public_ip_quota_raised = None
class PrivateCloudIdentity(_serialization.Model):
"""Identity for the virtual machine.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar principal_id: The principal ID of private cloud identity. This property will only be
provided for a system assigned identity.
:vartype principal_id: str
:ivar tenant_id: The tenant ID associated with the private cloud. This property will only be
provided for a system assigned identity.
:vartype tenant_id: str
:ivar type: The type of identity used for the private cloud. The type 'SystemAssigned' refers
to an implicitly created identity. The type 'None' will remove any identities from the Private
Cloud. Known values are: "SystemAssigned" and "None".
:vartype type: str or ~azure.mgmt.avs.models.ResourceIdentityType
"""
_validation = {
"principal_id": {"readonly": True},
"tenant_id": {"readonly": True},
}
_attribute_map = {
"principal_id": {"key": "principalId", "type": "str"},
"tenant_id": {"key": "tenantId", "type": "str"},
"type": {"key": "type", "type": "str"},
}
def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs: Any) -> None:
"""
:keyword type: The type of identity used for the private cloud. The type 'SystemAssigned'
refers to an implicitly created identity. The type 'None' will remove any identities from the
Private Cloud. Known values are: "SystemAssigned" and "None".
:paramtype type: str or ~azure.mgmt.avs.models.ResourceIdentityType
"""
super().__init__(**kwargs)
self.principal_id = None
self.tenant_id = None
self.type = type
class PrivateCloudList(_serialization.Model):
"""A paged list of private clouds.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.PrivateCloud]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[PrivateCloud]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class PrivateCloudUpdateProperties(_serialization.Model):
"""The properties of a private cloud resource that may be updated.
:ivar management_cluster: The default cluster used for management.
:vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:ivar internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype internet: str or ~azure.mgmt.avs.models.InternetEnum
:ivar identity_sources: vCenter Single Sign On Identity Sources.
:vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:ivar availability: Properties describing how the cloud is distributed across availability
zones.
:vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:ivar encryption: Customer managed key encryption, can be enabled or disabled.
:vartype encryption: ~azure.mgmt.avs.models.Encryption
:ivar extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:vartype extended_network_blocks: list[str]
"""
_attribute_map = {
"management_cluster": {"key": "managementCluster", "type": "ManagementCluster"},
"internet": {"key": "internet", "type": "str"},
"identity_sources": {"key": "identitySources", "type": "[IdentitySource]"},
"availability": {"key": "availability", "type": "AvailabilityProperties"},
"encryption": {"key": "encryption", "type": "Encryption"},
"extended_network_blocks": {"key": "extendedNetworkBlocks", "type": "[str]"},
}
def __init__(
self,
*,
management_cluster: Optional["_models.ManagementCluster"] = None,
internet: Union[str, "_models.InternetEnum"] = "Disabled",
identity_sources: Optional[List["_models.IdentitySource"]] = None,
availability: Optional["_models.AvailabilityProperties"] = None,
encryption: Optional["_models.Encryption"] = None,
extended_network_blocks: Optional[List[str]] = None,
**kwargs: Any
) -> None:
"""
:keyword management_cluster: The default cluster used for management.
:paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:keyword internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum
:keyword identity_sources: vCenter Single Sign On Identity Sources.
:paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:keyword availability: Properties describing how the cloud is distributed across availability
zones.
:paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:keyword encryption: Customer managed key encryption, can be enabled or disabled.
:paramtype encryption: ~azure.mgmt.avs.models.Encryption
:keyword extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:paramtype extended_network_blocks: list[str]
"""
super().__init__(**kwargs)
self.management_cluster = management_cluster
self.internet = internet
self.identity_sources = identity_sources
self.availability = availability
self.encryption = encryption
self.extended_network_blocks = extended_network_blocks
class PrivateCloudProperties(PrivateCloudUpdateProperties): # pylint: disable=too-many-instance-attributes
"""The properties of a private cloud resource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar management_cluster: The default cluster used for management.
:vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:ivar internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype internet: str or ~azure.mgmt.avs.models.InternetEnum
:ivar identity_sources: vCenter Single Sign On Identity Sources.
:vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:ivar availability: Properties describing how the cloud is distributed across availability
zones.
:vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:ivar encryption: Customer managed key encryption, can be enabled or disabled.
:vartype encryption: ~azure.mgmt.avs.models.Encryption
:ivar extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:vartype extended_network_blocks: list[str]
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Cancelled", "Pending", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState
:ivar circuit: An ExpressRoute Circuit.
:vartype circuit: ~azure.mgmt.avs.models.Circuit
:ivar endpoints: The endpoints.
:vartype endpoints: ~azure.mgmt.avs.models.Endpoints
:ivar network_block: The block of addresses should be unique across VNet in your subscription
as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are
between 0 and 255, and X is between 0 and 22. Required.
:vartype network_block: str
:ivar management_network: Network used to access vCenter Server and NSX-T Manager.
:vartype management_network: str
:ivar provisioning_network: Used for virtual machine cold migration, cloning, and snapshot
migration.
:vartype provisioning_network: str
:ivar vmotion_network: Used for live migration of virtual machines.
:vartype vmotion_network: str
:ivar vcenter_password: Optionally, set the vCenter admin password when the private cloud is
created.
:vartype vcenter_password: str
:ivar nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is
created.
:vartype nsxt_password: str
:ivar vcenter_certificate_thumbprint: Thumbprint of the vCenter Server SSL certificate.
:vartype vcenter_certificate_thumbprint: str
:ivar nsxt_certificate_thumbprint: Thumbprint of the NSX-T Manager SSL certificate.
:vartype nsxt_certificate_thumbprint: str
:ivar external_cloud_links: Array of cloud link IDs from other clouds that connect to this one.
:vartype external_cloud_links: list[str]
:ivar secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present in a
stretched private cloud.
:vartype secondary_circuit: ~azure.mgmt.avs.models.Circuit
:ivar nsx_public_ip_quota_raised: Flag to indicate whether the private cloud has the quota for
provisioned NSX Public IP count raised from 64 to 1024. Known values are: "Enabled" and
"Disabled".
:vartype nsx_public_ip_quota_raised: str or ~azure.mgmt.avs.models.NsxPublicIpQuotaRaisedEnum
"""
_validation = {
"provisioning_state": {"readonly": True},
"endpoints": {"readonly": True},
"network_block": {"required": True},
"management_network": {"readonly": True},
"provisioning_network": {"readonly": True},
"vmotion_network": {"readonly": True},
"vcenter_certificate_thumbprint": {"readonly": True},
"nsxt_certificate_thumbprint": {"readonly": True},
"external_cloud_links": {"readonly": True},
"nsx_public_ip_quota_raised": {"readonly": True},
}
_attribute_map = {
"management_cluster": {"key": "managementCluster", "type": "ManagementCluster"},
"internet": {"key": "internet", "type": "str"},
"identity_sources": {"key": "identitySources", "type": "[IdentitySource]"},
"availability": {"key": "availability", "type": "AvailabilityProperties"},
"encryption": {"key": "encryption", "type": "Encryption"},
"extended_network_blocks": {"key": "extendedNetworkBlocks", "type": "[str]"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"circuit": {"key": "circuit", "type": "Circuit"},
"endpoints": {"key": "endpoints", "type": "Endpoints"},
"network_block": {"key": "networkBlock", "type": "str"},
"management_network": {"key": "managementNetwork", "type": "str"},
"provisioning_network": {"key": "provisioningNetwork", "type": "str"},
"vmotion_network": {"key": "vmotionNetwork", "type": "str"},
"vcenter_password": {"key": "vcenterPassword", "type": "str"},
"nsxt_password": {"key": "nsxtPassword", "type": "str"},
"vcenter_certificate_thumbprint": {"key": "vcenterCertificateThumbprint", "type": "str"},
"nsxt_certificate_thumbprint": {"key": "nsxtCertificateThumbprint", "type": "str"},
"external_cloud_links": {"key": "externalCloudLinks", "type": "[str]"},
"secondary_circuit": {"key": "secondaryCircuit", "type": "Circuit"},
"nsx_public_ip_quota_raised": {"key": "nsxPublicIpQuotaRaised", "type": "str"},
}
def __init__(
self,
*,
network_block: str,
management_cluster: Optional["_models.ManagementCluster"] = None,
internet: Union[str, "_models.InternetEnum"] = "Disabled",
identity_sources: Optional[List["_models.IdentitySource"]] = None,
availability: Optional["_models.AvailabilityProperties"] = None,
encryption: Optional["_models.Encryption"] = None,
extended_network_blocks: Optional[List[str]] = None,
circuit: Optional["_models.Circuit"] = None,
vcenter_password: Optional[str] = None,
nsxt_password: Optional[str] = None,
secondary_circuit: Optional["_models.Circuit"] = None,
**kwargs: Any
) -> None:
"""
:keyword management_cluster: The default cluster used for management.
:paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:keyword internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum
:keyword identity_sources: vCenter Single Sign On Identity Sources.
:paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:keyword availability: Properties describing how the cloud is distributed across availability
zones.
:paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:keyword encryption: Customer managed key encryption, can be enabled or disabled.
:paramtype encryption: ~azure.mgmt.avs.models.Encryption
:keyword extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:paramtype extended_network_blocks: list[str]
:keyword circuit: An ExpressRoute Circuit.
:paramtype circuit: ~azure.mgmt.avs.models.Circuit
:keyword network_block: The block of addresses should be unique across VNet in your
subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where
A,B,C,D are between 0 and 255, and X is between 0 and 22. Required.
:paramtype network_block: str
:keyword vcenter_password: Optionally, set the vCenter admin password when the private cloud is
created.
:paramtype vcenter_password: str
:keyword nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is
created.
:paramtype nsxt_password: str
:keyword secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present
in a stretched private cloud.
:paramtype secondary_circuit: ~azure.mgmt.avs.models.Circuit
"""
super().__init__(
management_cluster=management_cluster,
internet=internet,
identity_sources=identity_sources,
availability=availability,
encryption=encryption,
extended_network_blocks=extended_network_blocks,
**kwargs
)
self.provisioning_state = None
self.circuit = circuit
self.endpoints = None
self.network_block = network_block
self.management_network = None
self.provisioning_network = None
self.vmotion_network = None
self.vcenter_password = vcenter_password
self.nsxt_password = nsxt_password
self.vcenter_certificate_thumbprint = None
self.nsxt_certificate_thumbprint = None
self.external_cloud_links = None
self.secondary_circuit = secondary_circuit
self.nsx_public_ip_quota_raised = None
class PrivateCloudUpdate(_serialization.Model):
"""An update to a private cloud resource.
:ivar tags: Resource tags.
:vartype tags: dict[str, str]
:ivar identity: The identity of the private cloud, if configured.
:vartype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity
:ivar management_cluster: The default cluster used for management.
:vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:ivar internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype internet: str or ~azure.mgmt.avs.models.InternetEnum
:ivar identity_sources: vCenter Single Sign On Identity Sources.
:vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:ivar availability: Properties describing how the cloud is distributed across availability
zones.
:vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:ivar encryption: Customer managed key encryption, can be enabled or disabled.
:vartype encryption: ~azure.mgmt.avs.models.Encryption
:ivar extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:vartype extended_network_blocks: list[str]
"""
_attribute_map = {
"tags": {"key": "tags", "type": "{str}"},
"identity": {"key": "identity", "type": "PrivateCloudIdentity"},
"management_cluster": {"key": "properties.managementCluster", "type": "ManagementCluster"},
"internet": {"key": "properties.internet", "type": "str"},
"identity_sources": {"key": "properties.identitySources", "type": "[IdentitySource]"},
"availability": {"key": "properties.availability", "type": "AvailabilityProperties"},
"encryption": {"key": "properties.encryption", "type": "Encryption"},
"extended_network_blocks": {"key": "properties.extendedNetworkBlocks", "type": "[str]"},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.PrivateCloudIdentity"] = None,
management_cluster: Optional["_models.ManagementCluster"] = None,
internet: Union[str, "_models.InternetEnum"] = "Disabled",
identity_sources: Optional[List["_models.IdentitySource"]] = None,
availability: Optional["_models.AvailabilityProperties"] = None,
encryption: Optional["_models.Encryption"] = None,
extended_network_blocks: Optional[List[str]] = None,
**kwargs: Any
) -> None:
"""
:keyword tags: Resource tags.
:paramtype tags: dict[str, str]
:keyword identity: The identity of the private cloud, if configured.
:paramtype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity
:keyword management_cluster: The default cluster used for management.
:paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:keyword internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum
:keyword identity_sources: vCenter Single Sign On Identity Sources.
:paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:keyword availability: Properties describing how the cloud is distributed across availability
zones.
:paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:keyword encryption: Customer managed key encryption, can be enabled or disabled.
:paramtype encryption: ~azure.mgmt.avs.models.Encryption
:keyword extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:paramtype extended_network_blocks: list[str]
"""
super().__init__(**kwargs)
self.tags = tags
self.identity = identity
self.management_cluster = management_cluster
self.internet = internet
self.identity_sources = identity_sources
self.availability = availability
self.encryption = encryption
self.extended_network_blocks = extended_network_blocks
class ProxyResource(Resource):
"""The resource model definition for a ARM proxy resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: 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"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
class ScriptExecutionParameter(_serialization.Model):
"""The arguments passed in to the execution.
You probably want to use the sub-classes and not this class directly. Known sub-classes are:
PSCredentialExecutionParameter, ScriptSecureStringExecutionParameter,
ScriptStringExecutionParameter
All required parameters must be populated in order to send to Azure.
:ivar name: The parameter name. Required.
:vartype name: str
:ivar type: The type of execution parameter. Required. Known values are: "Value",
"SecureValue", and "Credential".
:vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType
"""
_validation = {
"name": {"required": True},
"type": {"required": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
}
_subtype_map = {
"type": {
"Credential": "PSCredentialExecutionParameter",
"SecureValue": "ScriptSecureStringExecutionParameter",
"Value": "ScriptStringExecutionParameter",
}
}
def __init__(self, *, name: str, **kwargs: Any) -> None:
"""
:keyword name: The parameter name. Required.
:paramtype name: str
"""
super().__init__(**kwargs)
self.name = name
self.type: Optional[str] = None
class PSCredentialExecutionParameter(ScriptExecutionParameter):
"""a powershell credential object.
All required parameters must be populated in order to send to Azure.
:ivar name: The parameter name. Required.
:vartype name: str
:ivar type: The type of execution parameter. Required. Known values are: "Value",
"SecureValue", and "Credential".
:vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType
:ivar username: username for login.
:vartype username: str
:ivar password: password for login.
:vartype password: str
"""
_validation = {
"name": {"required": True},
"type": {"required": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"username": {"key": "username", "type": "str"},
"password": {"key": "password", "type": "str"},
}
def __init__(
self, *, name: str, username: Optional[str] = None, password: Optional[str] = None, **kwargs: Any
) -> None:
"""
:keyword name: The parameter name. Required.
:paramtype name: str
:keyword username: username for login.
:paramtype username: str
:keyword password: password for login.
:paramtype password: str
"""
super().__init__(name=name, **kwargs)
self.type: str = "Credential"
self.username = username
self.password = password
class Quota(_serialization.Model):
"""Subscription quotas.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar hosts_remaining: Remaining hosts quota by sku type.
:vartype hosts_remaining: dict[str, int]
:ivar quota_enabled: Host quota is active for current subscription. Known values are: "Enabled"
and "Disabled".
:vartype quota_enabled: str or ~azure.mgmt.avs.models.QuotaEnabled
"""
_validation = {
"hosts_remaining": {"readonly": True},
"quota_enabled": {"readonly": True},
}
_attribute_map = {
"hosts_remaining": {"key": "hostsRemaining", "type": "{int}"},
"quota_enabled": {"key": "quotaEnabled", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.hosts_remaining = None
self.quota_enabled = None
class ScriptCmdlet(ProxyResource):
"""A cmdlet available for script execution.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar description: Description of the scripts functionality.
:vartype description: str
:ivar timeout: Recommended time limit for execution.
:vartype timeout: str
:ivar parameters: Parameters the script will accept.
:vartype parameters: list[~azure.mgmt.avs.models.ScriptParameter]
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"description": {"readonly": True},
"timeout": {"readonly": True},
"parameters": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"description": {"key": "properties.description", "type": "str"},
"timeout": {"key": "properties.timeout", "type": "str"},
"parameters": {"key": "properties.parameters", "type": "[ScriptParameter]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.description = None
self.timeout = None
self.parameters = None
class ScriptCmdletsList(_serialization.Model):
"""Pageable list of scripts/cmdlets.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of scripts.
:vartype value: list[~azure.mgmt.avs.models.ScriptCmdlet]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[ScriptCmdlet]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class ScriptExecution(ProxyResource): # pylint: disable=too-many-instance-attributes
"""An instance of a script executed by a user - custom or AVS.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar script_cmdlet_id: A reference to the script cmdlet resource if user is running a AVS
script.
:vartype script_cmdlet_id: str
:ivar parameters: Parameters the script will accept.
:vartype parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter]
:ivar hidden_parameters: Parameters that will be hidden/not visible to ARM, such as passwords
and credentials.
:vartype hidden_parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter]
:ivar failure_reason: Error message if the script was able to run, but if the script itself had
errors or powershell threw an exception.
:vartype failure_reason: str
:ivar timeout: Time limit for execution.
:vartype timeout: str
:ivar retention: Time to live for the resource. If not provided, will be available for 60 days.
:vartype retention: str
:ivar submitted_at: Time the script execution was submitted.
:vartype submitted_at: ~datetime.datetime
:ivar started_at: Time the script execution was started.
:vartype started_at: ~datetime.datetime
:ivar finished_at: Time the script execution was finished.
:vartype finished_at: ~datetime.datetime
:ivar provisioning_state: The state of the script execution resource. Known values are:
"Pending", "Running", "Succeeded", "Failed", "Cancelling", "Cancelled", "Deleting", and
"Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.ScriptExecutionProvisioningState
:ivar output: Standard output stream from the powershell execution.
:vartype output: list[str]
:ivar named_outputs: User-defined dictionary.
:vartype named_outputs: dict[str, JSON]
:ivar information: Standard information out stream from the powershell execution.
:vartype information: list[str]
:ivar warnings: Standard warning out stream from the powershell execution.
:vartype warnings: list[str]
:ivar errors: Standard error output stream from the powershell execution.
:vartype errors: list[str]
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"submitted_at": {"readonly": True},
"started_at": {"readonly": True},
"finished_at": {"readonly": True},
"provisioning_state": {"readonly": True},
"information": {"readonly": True},
"warnings": {"readonly": True},
"errors": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"script_cmdlet_id": {"key": "properties.scriptCmdletId", "type": "str"},
"parameters": {"key": "properties.parameters", "type": "[ScriptExecutionParameter]"},
"hidden_parameters": {"key": "properties.hiddenParameters", "type": "[ScriptExecutionParameter]"},
"failure_reason": {"key": "properties.failureReason", "type": "str"},
"timeout": {"key": "properties.timeout", "type": "str"},
"retention": {"key": "properties.retention", "type": "str"},
"submitted_at": {"key": "properties.submittedAt", "type": "iso-8601"},
"started_at": {"key": "properties.startedAt", "type": "iso-8601"},
"finished_at": {"key": "properties.finishedAt", "type": "iso-8601"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"output": {"key": "properties.output", "type": "[str]"},
"named_outputs": {"key": "properties.namedOutputs", "type": "{object}"},
"information": {"key": "properties.information", "type": "[str]"},
"warnings": {"key": "properties.warnings", "type": "[str]"},
"errors": {"key": "properties.errors", "type": "[str]"},
}
def __init__(
self,
*,
script_cmdlet_id: Optional[str] = None,
parameters: Optional[List["_models.ScriptExecutionParameter"]] = None,
hidden_parameters: Optional[List["_models.ScriptExecutionParameter"]] = None,
failure_reason: Optional[str] = None,
timeout: Optional[str] = None,
retention: Optional[str] = None,
output: Optional[List[str]] = None,
named_outputs: Optional[Dict[str, JSON]] = None,
**kwargs: Any
) -> None:
"""
:keyword script_cmdlet_id: A reference to the script cmdlet resource if user is running a AVS
script.
:paramtype script_cmdlet_id: str
:keyword parameters: Parameters the script will accept.
:paramtype parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter]
:keyword hidden_parameters: Parameters that will be hidden/not visible to ARM, such as
passwords and credentials.
:paramtype hidden_parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter]
:keyword failure_reason: Error message if the script was able to run, but if the script itself
had errors or powershell threw an exception.
:paramtype failure_reason: str
:keyword timeout: Time limit for execution.
:paramtype timeout: str
:keyword retention: Time to live for the resource. If not provided, will be available for 60
days.
:paramtype retention: str
:keyword output: Standard output stream from the powershell execution.
:paramtype output: list[str]
:keyword named_outputs: User-defined dictionary.
:paramtype named_outputs: dict[str, JSON]
"""
super().__init__(**kwargs)
self.script_cmdlet_id = script_cmdlet_id
self.parameters = parameters
self.hidden_parameters = hidden_parameters
self.failure_reason = failure_reason
self.timeout = timeout
self.retention = retention
self.submitted_at = None
self.started_at = None
self.finished_at = None
self.provisioning_state = None
self.output = output
self.named_outputs = named_outputs
self.information = None
self.warnings = None
self.errors = None
class ScriptExecutionsList(_serialization.Model):
"""Pageable list of script executions.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of scripts.
:vartype value: list[~azure.mgmt.avs.models.ScriptExecution]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[ScriptExecution]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class ScriptPackage(ProxyResource):
"""Script Package resources available for execution.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar description: User friendly description of the package.
:vartype description: str
:ivar version: Module version.
:vartype version: str
:ivar company: Company that created and supports the package.
:vartype company: str
:ivar uri: Link to support by the package vendor.
:vartype uri: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"description": {"readonly": True},
"version": {"readonly": True},
"company": {"readonly": True},
"uri": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"description": {"key": "properties.description", "type": "str"},
"version": {"key": "properties.version", "type": "str"},
"company": {"key": "properties.company", "type": "str"},
"uri": {"key": "properties.uri", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.description = None
self.version = None
self.company = None
self.uri = None
class ScriptPackagesList(_serialization.Model):
"""A list of the available script packages.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of script package resources.
:vartype value: list[~azure.mgmt.avs.models.ScriptPackage]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[ScriptPackage]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class ScriptParameter(_serialization.Model):
"""An parameter that the script will accept.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar type: The type of parameter the script is expecting. psCredential is a
PSCredentialObject. Known values are: "String", "SecureString", "Credential", "Int", "Bool",
and "Float".
:vartype type: str or ~azure.mgmt.avs.models.ScriptParameterTypes
:ivar name: The parameter name that the script will expect a parameter value for.
:vartype name: str
:ivar description: User friendly description of the parameter.
:vartype description: str
:ivar visibility: Should this parameter be visible to arm and passed in the parameters argument
when executing. Known values are: "Visible" and "Hidden".
:vartype visibility: str or ~azure.mgmt.avs.models.VisibilityParameterEnum
:ivar optional: Is this parameter required or optional. Known values are: "Optional" and
"Required".
:vartype optional: str or ~azure.mgmt.avs.models.OptionalParamEnum
"""
_validation = {
"type": {"readonly": True},
"description": {"readonly": True},
"visibility": {"readonly": True},
"optional": {"readonly": True},
}
_attribute_map = {
"type": {"key": "type", "type": "str"},
"name": {"key": "name", "type": "str"},
"description": {"key": "description", "type": "str"},
"visibility": {"key": "visibility", "type": "str"},
"optional": {"key": "optional", "type": "str"},
}
def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword name: The parameter name that the script will expect a parameter value for.
:paramtype name: str
"""
super().__init__(**kwargs)
self.type = None
self.name = name
self.description = None
self.visibility = None
self.optional = None
class ScriptSecureStringExecutionParameter(ScriptExecutionParameter):
"""a plain text value execution parameter.
All required parameters must be populated in order to send to Azure.
:ivar name: The parameter name. Required.
:vartype name: str
:ivar type: The type of execution parameter. Required. Known values are: "Value",
"SecureValue", and "Credential".
:vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType
:ivar secure_value: A secure value for the passed parameter, not to be stored in logs.
:vartype secure_value: str
"""
_validation = {
"name": {"required": True},
"type": {"required": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"secure_value": {"key": "secureValue", "type": "str"},
}
def __init__(self, *, name: str, secure_value: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword name: The parameter name. Required.
:paramtype name: str
:keyword secure_value: A secure value for the passed parameter, not to be stored in logs.
:paramtype secure_value: str
"""
super().__init__(name=name, **kwargs)
self.type: str = "SecureValue"
self.secure_value = secure_value
class ScriptStringExecutionParameter(ScriptExecutionParameter):
"""a plain text value execution parameter.
All required parameters must be populated in order to send to Azure.
:ivar name: The parameter name. Required.
:vartype name: str
:ivar type: The type of execution parameter. Required. Known values are: "Value",
"SecureValue", and "Credential".
:vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType
:ivar value: The value for the passed parameter.
:vartype value: str
"""
_validation = {
"name": {"required": True},
"type": {"required": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"value": {"key": "value", "type": "str"},
}
def __init__(self, *, name: str, value: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword name: The parameter name. Required.
:paramtype name: str
:keyword value: The value for the passed parameter.
:paramtype value: str
"""
super().__init__(name=name, **kwargs)
self.type: str = "Value"
self.value = value
class ServiceSpecification(_serialization.Model):
"""Service specification payload.
:ivar log_specifications: Specifications of the Log for Azure Monitoring.
:vartype log_specifications: list[~azure.mgmt.avs.models.LogSpecification]
:ivar metric_specifications: Specifications of the Metrics for Azure Monitoring.
:vartype metric_specifications: list[~azure.mgmt.avs.models.MetricSpecification]
"""
_attribute_map = {
"log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"},
"metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"},
}
def __init__(
self,
*,
log_specifications: Optional[List["_models.LogSpecification"]] = None,
metric_specifications: Optional[List["_models.MetricSpecification"]] = None,
**kwargs: Any
) -> None:
"""
:keyword log_specifications: Specifications of the Log for Azure Monitoring.
:paramtype log_specifications: list[~azure.mgmt.avs.models.LogSpecification]
:keyword metric_specifications: Specifications of the Metrics for Azure Monitoring.
:paramtype metric_specifications: list[~azure.mgmt.avs.models.MetricSpecification]
"""
super().__init__(**kwargs)
self.log_specifications = log_specifications
self.metric_specifications = metric_specifications
class Sku(_serialization.Model):
"""The resource model definition representing SKU.
All required parameters must be populated in order to send to Azure.
:ivar name: The name of the SKU. Required.
:vartype name: str
"""
_validation = {
"name": {"required": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
}
def __init__(self, *, name: str, **kwargs: Any) -> None:
"""
:keyword name: The name of the SKU. Required.
:paramtype name: str
"""
super().__init__(**kwargs)
self.name = name
class Trial(_serialization.Model):
"""Subscription trial availability.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar status: Trial status. Known values are: "TrialAvailable", "TrialUsed", and
"TrialDisabled".
:vartype status: str or ~azure.mgmt.avs.models.TrialStatus
:ivar available_hosts: Number of trial hosts available.
:vartype available_hosts: int
"""
_validation = {
"status": {"readonly": True},
"available_hosts": {"readonly": True},
}
_attribute_map = {
"status": {"key": "status", "type": "str"},
"available_hosts": {"key": "availableHosts", "type": "int"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.status = None
self.available_hosts = None
class VirtualMachine(ProxyResource):
"""Virtual Machine.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the VM.
:vartype display_name: str
:ivar mo_ref_id: Virtual machine managed object reference id.
:vartype mo_ref_id: str
:ivar folder_path: Path to virtual machine's folder starting from datacenter virtual machine
folder.
:vartype folder_path: str
:ivar restrict_movement: Whether VM DRS-driven movement is restricted (enabled) or not
(disabled). Known values are: "Enabled" and "Disabled".
:vartype restrict_movement: str or ~azure.mgmt.avs.models.VirtualMachineRestrictMovementState
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"display_name": {"readonly": True},
"mo_ref_id": {"readonly": True},
"folder_path": {"readonly": True},
"restrict_movement": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"mo_ref_id": {"key": "properties.moRefId", "type": "str"},
"folder_path": {"key": "properties.folderPath", "type": "str"},
"restrict_movement": {"key": "properties.restrictMovement", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.display_name = None
self.mo_ref_id = None
self.folder_path = None
self.restrict_movement = None
class VirtualMachineRestrictMovement(_serialization.Model):
"""Set VM DRS-driven movement to restricted (enabled) or not (disabled).
:ivar restrict_movement: Whether VM DRS-driven movement is restricted (enabled) or not
(disabled). Known values are: "Enabled" and "Disabled".
:vartype restrict_movement: str or ~azure.mgmt.avs.models.VirtualMachineRestrictMovementState
"""
_attribute_map = {
"restrict_movement": {"key": "restrictMovement", "type": "str"},
}
def __init__(
self,
*,
restrict_movement: Optional[Union[str, "_models.VirtualMachineRestrictMovementState"]] = None,
**kwargs: Any
) -> None:
"""
:keyword restrict_movement: Whether VM DRS-driven movement is restricted (enabled) or not
(disabled). Known values are: "Enabled" and "Disabled".
:paramtype restrict_movement: str or ~azure.mgmt.avs.models.VirtualMachineRestrictMovementState
"""
super().__init__(**kwargs)
self.restrict_movement = restrict_movement
class VirtualMachinesList(_serialization.Model):
"""A list of Virtual Machines.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items to be displayed on the page.
:vartype value: list[~azure.mgmt.avs.models.VirtualMachine]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[VirtualMachine]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class VmHostPlacementPolicyProperties(PlacementPolicyProperties):
"""VM-Host placement policy properties.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar type: placement policy type. Required. Known values are: "VmVm" and "VmHost".
:vartype type: str or ~azure.mgmt.avs.models.PlacementPolicyType
:ivar state: Whether the placement policy is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:ivar display_name: Display name of the placement policy.
:vartype display_name: str
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState
:ivar vm_members: Virtual machine members list. Required.
:vartype vm_members: list[str]
:ivar host_members: Host members list. Required.
:vartype host_members: list[str]
:ivar affinity_type: placement policy affinity type. Required. Known values are: "Affinity" and
"AntiAffinity".
:vartype affinity_type: str or ~azure.mgmt.avs.models.AffinityType
:ivar affinity_strength: vm-host placement policy affinity strength (should/must). Known values
are: "Should" and "Must".
:vartype affinity_strength: str or ~azure.mgmt.avs.models.AffinityStrength
:ivar azure_hybrid_benefit_type: placement policy azure hybrid benefit opt-in type. Known
values are: "SqlHost" and "None".
:vartype azure_hybrid_benefit_type: str or ~azure.mgmt.avs.models.AzureHybridBenefitType
"""
_validation = {
"type": {"required": True},
"provisioning_state": {"readonly": True},
"vm_members": {"required": True},
"host_members": {"required": True},
"affinity_type": {"required": True},
}
_attribute_map = {
"type": {"key": "type", "type": "str"},
"state": {"key": "state", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"vm_members": {"key": "vmMembers", "type": "[str]"},
"host_members": {"key": "hostMembers", "type": "[str]"},
"affinity_type": {"key": "affinityType", "type": "str"},
"affinity_strength": {"key": "affinityStrength", "type": "str"},
"azure_hybrid_benefit_type": {"key": "azureHybridBenefitType", "type": "str"},
}
def __init__(
self,
*,
vm_members: List[str],
host_members: List[str],
affinity_type: Union[str, "_models.AffinityType"],
state: Optional[Union[str, "_models.PlacementPolicyState"]] = None,
display_name: Optional[str] = None,
affinity_strength: Optional[Union[str, "_models.AffinityStrength"]] = None,
azure_hybrid_benefit_type: Optional[Union[str, "_models.AzureHybridBenefitType"]] = None,
**kwargs: Any
) -> None:
"""
:keyword state: Whether the placement policy is enabled or disabled. Known values are:
"Enabled" and "Disabled".
:paramtype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:keyword display_name: Display name of the placement policy.
:paramtype display_name: str
:keyword vm_members: Virtual machine members list. Required.
:paramtype vm_members: list[str]
:keyword host_members: Host members list. Required.
:paramtype host_members: list[str]
:keyword affinity_type: placement policy affinity type. Required. Known values are: "Affinity"
and "AntiAffinity".
:paramtype affinity_type: str or ~azure.mgmt.avs.models.AffinityType
:keyword affinity_strength: vm-host placement policy affinity strength (should/must). Known
values are: "Should" and "Must".
:paramtype affinity_strength: str or ~azure.mgmt.avs.models.AffinityStrength
:keyword azure_hybrid_benefit_type: placement policy azure hybrid benefit opt-in type. Known
values are: "SqlHost" and "None".
:paramtype azure_hybrid_benefit_type: str or ~azure.mgmt.avs.models.AzureHybridBenefitType
"""
super().__init__(state=state, display_name=display_name, **kwargs)
self.type: str = "VmHost"
self.vm_members = vm_members
self.host_members = host_members
self.affinity_type = affinity_type
self.affinity_strength = affinity_strength
self.azure_hybrid_benefit_type = azure_hybrid_benefit_type
class VmPlacementPolicyProperties(PlacementPolicyProperties):
"""VM-VM placement policy properties.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar type: placement policy type. Required. Known values are: "VmVm" and "VmHost".
:vartype type: str or ~azure.mgmt.avs.models.PlacementPolicyType
:ivar state: Whether the placement policy is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:ivar display_name: Display name of the placement policy.
:vartype display_name: str
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState
:ivar vm_members: Virtual machine members list. Required.
:vartype vm_members: list[str]
:ivar affinity_type: placement policy affinity type. Required. Known values are: "Affinity" and
"AntiAffinity".
:vartype affinity_type: str or ~azure.mgmt.avs.models.AffinityType
"""
_validation = {
"type": {"required": True},
"provisioning_state": {"readonly": True},
"vm_members": {"required": True},
"affinity_type": {"required": True},
}
_attribute_map = {
"type": {"key": "type", "type": "str"},
"state": {"key": "state", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"vm_members": {"key": "vmMembers", "type": "[str]"},
"affinity_type": {"key": "affinityType", "type": "str"},
}
def __init__(
self,
*,
vm_members: List[str],
affinity_type: Union[str, "_models.AffinityType"],
state: Optional[Union[str, "_models.PlacementPolicyState"]] = None,
display_name: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword state: Whether the placement policy is enabled or disabled. Known values are:
"Enabled" and "Disabled".
:paramtype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:keyword display_name: Display name of the placement policy.
:paramtype display_name: str
:keyword vm_members: Virtual machine members list. Required.
:paramtype vm_members: list[str]
:keyword affinity_type: placement policy affinity type. Required. Known values are: "Affinity"
and "AntiAffinity".
:paramtype affinity_type: str or ~azure.mgmt.avs.models.AffinityType
"""
super().__init__(state=state, display_name=display_name, **kwargs)
self.type: str = "VmVm"
self.vm_members = vm_members
self.affinity_type = affinity_type
class WorkloadNetwork(ProxyResource):
"""Workload Network.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: 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"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
class WorkloadNetworkDhcp(ProxyResource):
"""NSX DHCP.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar properties: DHCP properties.
:vartype properties: ~azure.mgmt.avs.models.WorkloadNetworkDhcpEntity
"""
_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"},
"properties": {"key": "properties", "type": "WorkloadNetworkDhcpEntity"},
}
def __init__(self, *, properties: Optional["_models.WorkloadNetworkDhcpEntity"] = None, **kwargs: Any) -> None:
"""
:keyword properties: DHCP properties.
:paramtype properties: ~azure.mgmt.avs.models.WorkloadNetworkDhcpEntity
"""
super().__init__(**kwargs)
self.properties = properties
class WorkloadNetworkDhcpEntity(_serialization.Model):
"""Base class for WorkloadNetworkDhcpServer and WorkloadNetworkDhcpRelay to inherit from.
You probably want to use the sub-classes and not this class directly. Known sub-classes are:
WorkloadNetworkDhcpRelay, WorkloadNetworkDhcpServer
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar dhcp_type: Type of DHCP: SERVER or RELAY. Required. Known values are: "SERVER" and
"RELAY".
:vartype dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum
:ivar display_name: Display name of the DHCP entity.
:vartype display_name: str
:ivar segments: NSX Segments consuming DHCP.
:vartype segments: list[str]
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
"""
_validation = {
"dhcp_type": {"required": True},
"segments": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"dhcp_type": {"key": "dhcpType", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"segments": {"key": "segments", "type": "[str]"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"revision": {"key": "revision", "type": "int"},
}
_subtype_map = {"dhcp_type": {"RELAY": "WorkloadNetworkDhcpRelay", "SERVER": "WorkloadNetworkDhcpServer"}}
def __init__(self, *, display_name: Optional[str] = None, revision: Optional[int] = None, **kwargs: Any) -> None:
"""
:keyword display_name: Display name of the DHCP entity.
:paramtype display_name: str
:keyword revision: NSX revision number.
:paramtype revision: int
"""
super().__init__(**kwargs)
self.dhcp_type: Optional[str] = None
self.display_name = display_name
self.segments = None
self.provisioning_state = None
self.revision = revision
class WorkloadNetworkDhcpList(_serialization.Model):
"""A list of NSX dhcp entities.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkDhcp]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkDhcpRelay(WorkloadNetworkDhcpEntity):
"""NSX DHCP Relay.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar dhcp_type: Type of DHCP: SERVER or RELAY. Required. Known values are: "SERVER" and
"RELAY".
:vartype dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum
:ivar display_name: Display name of the DHCP entity.
:vartype display_name: str
:ivar segments: NSX Segments consuming DHCP.
:vartype segments: list[str]
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
:ivar server_addresses: DHCP Relay Addresses. Max 3.
:vartype server_addresses: list[str]
"""
_validation = {
"dhcp_type": {"required": True},
"segments": {"readonly": True},
"provisioning_state": {"readonly": True},
"server_addresses": {"max_items": 3, "min_items": 1},
}
_attribute_map = {
"dhcp_type": {"key": "dhcpType", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"segments": {"key": "segments", "type": "[str]"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"revision": {"key": "revision", "type": "int"},
"server_addresses": {"key": "serverAddresses", "type": "[str]"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
revision: Optional[int] = None,
server_addresses: Optional[List[str]] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the DHCP entity.
:paramtype display_name: str
:keyword revision: NSX revision number.
:paramtype revision: int
:keyword server_addresses: DHCP Relay Addresses. Max 3.
:paramtype server_addresses: list[str]
"""
super().__init__(display_name=display_name, revision=revision, **kwargs)
self.dhcp_type: str = "RELAY"
self.server_addresses = server_addresses
class WorkloadNetworkDhcpServer(WorkloadNetworkDhcpEntity):
"""NSX DHCP Server.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar dhcp_type: Type of DHCP: SERVER or RELAY. Required. Known values are: "SERVER" and
"RELAY".
:vartype dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum
:ivar display_name: Display name of the DHCP entity.
:vartype display_name: str
:ivar segments: NSX Segments consuming DHCP.
:vartype segments: list[str]
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
:ivar server_address: DHCP Server Address.
:vartype server_address: str
:ivar lease_time: DHCP Server Lease Time.
:vartype lease_time: int
"""
_validation = {
"dhcp_type": {"required": True},
"segments": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"dhcp_type": {"key": "dhcpType", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"segments": {"key": "segments", "type": "[str]"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"revision": {"key": "revision", "type": "int"},
"server_address": {"key": "serverAddress", "type": "str"},
"lease_time": {"key": "leaseTime", "type": "int"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
revision: Optional[int] = None,
server_address: Optional[str] = None,
lease_time: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the DHCP entity.
:paramtype display_name: str
:keyword revision: NSX revision number.
:paramtype revision: int
:keyword server_address: DHCP Server Address.
:paramtype server_address: str
:keyword lease_time: DHCP Server Lease Time.
:paramtype lease_time: int
"""
super().__init__(display_name=display_name, revision=revision, **kwargs)
self.dhcp_type: str = "SERVER"
self.server_address = server_address
self.lease_time = lease_time
class WorkloadNetworkDnsService(ProxyResource): # pylint: disable=too-many-instance-attributes
"""NSX DNS Service.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the DNS Service.
:vartype display_name: str
:ivar dns_service_ip: DNS service IP of the DNS Service.
:vartype dns_service_ip: str
:ivar default_dns_zone: Default DNS zone of the DNS Service.
:vartype default_dns_zone: str
:ivar fqdn_zones: FQDN zones of the DNS Service.
:vartype fqdn_zones: list[str]
:ivar log_level: DNS Service log level. Known values are: "DEBUG", "INFO", "WARNING", "ERROR",
and "FATAL".
:vartype log_level: str or ~azure.mgmt.avs.models.DnsServiceLogLevelEnum
:ivar status: DNS Service status. Known values are: "SUCCESS" and "FAILURE".
:vartype status: str or ~azure.mgmt.avs.models.DnsServiceStatusEnum
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.WorkloadNetworkDnsServiceProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"status": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"dns_service_ip": {"key": "properties.dnsServiceIp", "type": "str"},
"default_dns_zone": {"key": "properties.defaultDnsZone", "type": "str"},
"fqdn_zones": {"key": "properties.fqdnZones", "type": "[str]"},
"log_level": {"key": "properties.logLevel", "type": "str"},
"status": {"key": "properties.status", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"revision": {"key": "properties.revision", "type": "int"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
dns_service_ip: Optional[str] = None,
default_dns_zone: Optional[str] = None,
fqdn_zones: Optional[List[str]] = None,
log_level: Optional[Union[str, "_models.DnsServiceLogLevelEnum"]] = None,
revision: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the DNS Service.
:paramtype display_name: str
:keyword dns_service_ip: DNS service IP of the DNS Service.
:paramtype dns_service_ip: str
:keyword default_dns_zone: Default DNS zone of the DNS Service.
:paramtype default_dns_zone: str
:keyword fqdn_zones: FQDN zones of the DNS Service.
:paramtype fqdn_zones: list[str]
:keyword log_level: DNS Service log level. Known values are: "DEBUG", "INFO", "WARNING",
"ERROR", and "FATAL".
:paramtype log_level: str or ~azure.mgmt.avs.models.DnsServiceLogLevelEnum
:keyword revision: NSX revision number.
:paramtype revision: int
"""
super().__init__(**kwargs)
self.display_name = display_name
self.dns_service_ip = dns_service_ip
self.default_dns_zone = default_dns_zone
self.fqdn_zones = fqdn_zones
self.log_level = log_level
self.status = None
self.provisioning_state = None
self.revision = revision
class WorkloadNetworkDnsServicesList(_serialization.Model):
"""A list of NSX DNS Services.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkDnsService]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkDnsZone(ProxyResource):
"""NSX DNS Zone.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the DNS Zone.
:vartype display_name: str
:ivar domain: Domain names of the DNS Zone.
:vartype domain: list[str]
:ivar dns_server_ips: DNS Server IP array of the DNS Zone.
:vartype dns_server_ips: list[str]
:ivar source_ip: Source IP of the DNS Zone.
:vartype source_ip: str
:ivar dns_services: Number of DNS Services using the DNS zone.
:vartype dns_services: int
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.WorkloadNetworkDnsZoneProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"domain": {"key": "properties.domain", "type": "[str]"},
"dns_server_ips": {"key": "properties.dnsServerIps", "type": "[str]"},
"source_ip": {"key": "properties.sourceIp", "type": "str"},
"dns_services": {"key": "properties.dnsServices", "type": "int"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"revision": {"key": "properties.revision", "type": "int"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
domain: Optional[List[str]] = None,
dns_server_ips: Optional[List[str]] = None,
source_ip: Optional[str] = None,
dns_services: Optional[int] = None,
revision: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the DNS Zone.
:paramtype display_name: str
:keyword domain: Domain names of the DNS Zone.
:paramtype domain: list[str]
:keyword dns_server_ips: DNS Server IP array of the DNS Zone.
:paramtype dns_server_ips: list[str]
:keyword source_ip: Source IP of the DNS Zone.
:paramtype source_ip: str
:keyword dns_services: Number of DNS Services using the DNS zone.
:paramtype dns_services: int
:keyword revision: NSX revision number.
:paramtype revision: int
"""
super().__init__(**kwargs)
self.display_name = display_name
self.domain = domain
self.dns_server_ips = dns_server_ips
self.source_ip = source_ip
self.dns_services = dns_services
self.provisioning_state = None
self.revision = revision
class WorkloadNetworkDnsZonesList(_serialization.Model):
"""A list of NSX DNS Zones.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkDnsZone]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkGateway(ProxyResource):
"""NSX Gateway.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the DHCP entity.
:vartype display_name: str
:ivar path: NSX Gateway Path.
:vartype path: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"path": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"path": {"key": "properties.path", "type": "str"},
}
def __init__(self, *, display_name: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword display_name: Display name of the DHCP entity.
:paramtype display_name: str
"""
super().__init__(**kwargs)
self.display_name = display_name
self.path = None
class WorkloadNetworkGatewayList(_serialization.Model):
"""A list of NSX Gateways.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkGateway]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkGateway]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkList(_serialization.Model):
"""A list of workload networks.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetwork]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetwork]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkPortMirroring(ProxyResource):
"""NSX Port Mirroring.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the port mirroring profile.
:vartype display_name: str
:ivar direction: Direction of port mirroring profile. Known values are: "INGRESS", "EGRESS",
and "BIDIRECTIONAL".
:vartype direction: str or ~azure.mgmt.avs.models.PortMirroringDirectionEnum
:ivar source: Source VM Group.
:vartype source: str
:ivar destination: Destination VM Group.
:vartype destination: str
:ivar status: Port Mirroring Status. Known values are: "SUCCESS" and "FAILURE".
:vartype status: str or ~azure.mgmt.avs.models.PortMirroringStatusEnum
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.WorkloadNetworkPortMirroringProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"status": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"direction": {"key": "properties.direction", "type": "str"},
"source": {"key": "properties.source", "type": "str"},
"destination": {"key": "properties.destination", "type": "str"},
"status": {"key": "properties.status", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"revision": {"key": "properties.revision", "type": "int"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
direction: Optional[Union[str, "_models.PortMirroringDirectionEnum"]] = None,
source: Optional[str] = None,
destination: Optional[str] = None,
revision: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the port mirroring profile.
:paramtype display_name: str
:keyword direction: Direction of port mirroring profile. Known values are: "INGRESS", "EGRESS",
and "BIDIRECTIONAL".
:paramtype direction: str or ~azure.mgmt.avs.models.PortMirroringDirectionEnum
:keyword source: Source VM Group.
:paramtype source: str
:keyword destination: Destination VM Group.
:paramtype destination: str
:keyword revision: NSX revision number.
:paramtype revision: int
"""
super().__init__(**kwargs)
self.display_name = display_name
self.direction = direction
self.source = source
self.destination = destination
self.status = None
self.provisioning_state = None
self.revision = revision
class WorkloadNetworkPortMirroringList(_serialization.Model):
"""A list of NSX Port Mirroring.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkPortMirroring]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkPublicIP(ProxyResource):
"""NSX Public IP Block.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the Public IP Block.
:vartype display_name: str
:ivar number_of_public_i_ps: Number of Public IPs requested.
:vartype number_of_public_i_ps: int
:ivar public_ip_block: CIDR Block of the Public IP Block.
:vartype public_ip_block: str
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.WorkloadNetworkPublicIPProvisioningState
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"public_ip_block": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"number_of_public_i_ps": {"key": "properties.numberOfPublicIPs", "type": "int"},
"public_ip_block": {"key": "properties.publicIPBlock", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
}
def __init__(
self, *, display_name: Optional[str] = None, number_of_public_i_ps: Optional[int] = None, **kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the Public IP Block.
:paramtype display_name: str
:keyword number_of_public_i_ps: Number of Public IPs requested.
:paramtype number_of_public_i_ps: int
"""
super().__init__(**kwargs)
self.display_name = display_name
self.number_of_public_i_ps = number_of_public_i_ps
self.public_ip_block = None
self.provisioning_state = None
class WorkloadNetworkPublicIPsList(_serialization.Model):
"""A list of NSX Public IP Blocks.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkPublicIP]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkSegment(ProxyResource):
"""NSX Segment.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the segment.
:vartype display_name: str
:ivar connected_gateway: Gateway which to connect segment to.
:vartype connected_gateway: str
:ivar subnet: Subnet which to connect segment to.
:vartype subnet: ~azure.mgmt.avs.models.WorkloadNetworkSegmentSubnet
:ivar port_vif: Port Vif which segment is associated with.
:vartype port_vif: list[~azure.mgmt.avs.models.WorkloadNetworkSegmentPortVif]
:ivar status: Segment status. Known values are: "SUCCESS" and "FAILURE".
:vartype status: str or ~azure.mgmt.avs.models.SegmentStatusEnum
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.WorkloadNetworkSegmentProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"port_vif": {"readonly": True},
"status": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"connected_gateway": {"key": "properties.connectedGateway", "type": "str"},
"subnet": {"key": "properties.subnet", "type": "WorkloadNetworkSegmentSubnet"},
"port_vif": {"key": "properties.portVif", "type": "[WorkloadNetworkSegmentPortVif]"},
"status": {"key": "properties.status", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"revision": {"key": "properties.revision", "type": "int"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
connected_gateway: Optional[str] = None,
subnet: Optional["_models.WorkloadNetworkSegmentSubnet"] = None,
revision: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the segment.
:paramtype display_name: str
:keyword connected_gateway: Gateway which to connect segment to.
:paramtype connected_gateway: str
:keyword subnet: Subnet which to connect segment to.
:paramtype subnet: ~azure.mgmt.avs.models.WorkloadNetworkSegmentSubnet
:keyword revision: NSX revision number.
:paramtype revision: int
"""
super().__init__(**kwargs)
self.display_name = display_name
self.connected_gateway = connected_gateway
self.subnet = subnet
self.port_vif = None
self.status = None
self.provisioning_state = None
self.revision = revision
class WorkloadNetworkSegmentPortVif(_serialization.Model):
"""Ports and any VIF attached to segment.
:ivar port_name: Name of port or VIF attached to segment.
:vartype port_name: str
"""
_attribute_map = {
"port_name": {"key": "portName", "type": "str"},
}
def __init__(self, *, port_name: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword port_name: Name of port or VIF attached to segment.
:paramtype port_name: str
"""
super().__init__(**kwargs)
self.port_name = port_name
class WorkloadNetworkSegmentsList(_serialization.Model):
"""A list of NSX Segments.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkSegment]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkSegmentSubnet(_serialization.Model):
"""Subnet configuration for segment.
:ivar dhcp_ranges: DHCP Range assigned for subnet.
:vartype dhcp_ranges: list[str]
:ivar gateway_address: Gateway address.
:vartype gateway_address: str
"""
_attribute_map = {
"dhcp_ranges": {"key": "dhcpRanges", "type": "[str]"},
"gateway_address": {"key": "gatewayAddress", "type": "str"},
}
def __init__(
self, *, dhcp_ranges: Optional[List[str]] = None, gateway_address: Optional[str] = None, **kwargs: Any
) -> None:
"""
:keyword dhcp_ranges: DHCP Range assigned for subnet.
:paramtype dhcp_ranges: list[str]
:keyword gateway_address: Gateway address.
:paramtype gateway_address: str
"""
super().__init__(**kwargs)
self.dhcp_ranges = dhcp_ranges
self.gateway_address = gateway_address
class WorkloadNetworkVirtualMachine(ProxyResource):
"""NSX Virtual Machine.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the VM.
:vartype display_name: str
:ivar vm_type: Virtual machine type. Known values are: "REGULAR", "EDGE", and "SERVICE".
:vartype vm_type: str or ~azure.mgmt.avs.models.VMTypeEnum
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"vm_type": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"vm_type": {"key": "properties.vmType", "type": "str"},
}
def __init__(self, *, display_name: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword display_name: Display name of the VM.
:paramtype display_name: str
"""
super().__init__(**kwargs)
self.display_name = display_name
self.vm_type = None
class WorkloadNetworkVirtualMachinesList(_serialization.Model):
"""A list of NSX Virtual Machines.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkVirtualMachine]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkVMGroup(ProxyResource):
"""NSX VM Group.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the VM group.
:vartype display_name: str
:ivar members: Virtual machine members of this group.
:vartype members: list[str]
:ivar status: VM Group status. Known values are: "SUCCESS" and "FAILURE".
:vartype status: str or ~azure.mgmt.avs.models.VMGroupStatusEnum
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.WorkloadNetworkVMGroupProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"status": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"members": {"key": "properties.members", "type": "[str]"},
"status": {"key": "properties.status", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"revision": {"key": "properties.revision", "type": "int"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
members: Optional[List[str]] = None,
revision: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the VM group.
:paramtype display_name: str
:keyword members: Virtual machine members of this group.
:paramtype members: list[str]
:keyword revision: NSX revision number.
:paramtype revision: int
"""
super().__init__(**kwargs)
self.display_name = display_name
self.members = members
self.status = None
self.provisioning_state = None
self.revision = revision
class WorkloadNetworkVMGroupsList(_serialization.Model):
"""A list of NSX VM Groups.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkVMGroup]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/models/_models_py3.py
|
_models_py3.py
|
import sys
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union
from .. import _serialization
if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from .. import models as _models
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
class Resource(_serialization.Model):
"""The core properties of ARM resources.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: 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"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.id = None
self.name = None
self.type = None
class Addon(Resource):
"""An addon resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar properties: The properties of an addon resource.
:vartype properties: ~azure.mgmt.avs.models.AddonProperties
"""
_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"},
"properties": {"key": "properties", "type": "AddonProperties"},
}
def __init__(self, *, properties: Optional["_models.AddonProperties"] = None, **kwargs: Any) -> None:
"""
:keyword properties: The properties of an addon resource.
:paramtype properties: ~azure.mgmt.avs.models.AddonProperties
"""
super().__init__(**kwargs)
self.properties = properties
class AddonProperties(_serialization.Model):
"""The properties of an addon.
You probably want to use the sub-classes and not this class directly. Known sub-classes are:
AddonArcProperties, AddonHcxProperties, AddonSrmProperties, AddonVrProperties
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR",
"HCX", and "Arc".
:vartype addon_type: str or ~azure.mgmt.avs.models.AddonType
:ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState
"""
_validation = {
"addon_type": {"required": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"addon_type": {"key": "addonType", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
}
_subtype_map = {
"addon_type": {
"Arc": "AddonArcProperties",
"HCX": "AddonHcxProperties",
"SRM": "AddonSrmProperties",
"VR": "AddonVrProperties",
}
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.addon_type: Optional[str] = None
self.provisioning_state = None
class AddonArcProperties(AddonProperties):
"""The properties of an Arc addon.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR",
"HCX", and "Arc".
:vartype addon_type: str or ~azure.mgmt.avs.models.AddonType
:ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState
:ivar v_center: The VMware vCenter resource ID.
:vartype v_center: str
"""
_validation = {
"addon_type": {"required": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"addon_type": {"key": "addonType", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"v_center": {"key": "vCenter", "type": "str"},
}
def __init__(self, *, v_center: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword v_center: The VMware vCenter resource ID.
:paramtype v_center: str
"""
super().__init__(**kwargs)
self.addon_type: str = "Arc"
self.v_center = v_center
class AddonHcxProperties(AddonProperties):
"""The properties of an HCX addon.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR",
"HCX", and "Arc".
:vartype addon_type: str or ~azure.mgmt.avs.models.AddonType
:ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState
:ivar offer: The HCX offer, example VMware MaaS Cloud Provider (Enterprise). Required.
:vartype offer: str
"""
_validation = {
"addon_type": {"required": True},
"provisioning_state": {"readonly": True},
"offer": {"required": True},
}
_attribute_map = {
"addon_type": {"key": "addonType", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"offer": {"key": "offer", "type": "str"},
}
def __init__(self, *, offer: str, **kwargs: Any) -> None:
"""
:keyword offer: The HCX offer, example VMware MaaS Cloud Provider (Enterprise). Required.
:paramtype offer: str
"""
super().__init__(**kwargs)
self.addon_type: str = "HCX"
self.offer = offer
class AddonList(_serialization.Model):
"""A paged list of addons.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.Addon]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[Addon]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class AddonSrmProperties(AddonProperties):
"""The properties of a Site Recovery Manager (SRM) addon.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR",
"HCX", and "Arc".
:vartype addon_type: str or ~azure.mgmt.avs.models.AddonType
:ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState
:ivar license_key: The Site Recovery Manager (SRM) license.
:vartype license_key: str
"""
_validation = {
"addon_type": {"required": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"addon_type": {"key": "addonType", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"license_key": {"key": "licenseKey", "type": "str"},
}
def __init__(self, *, license_key: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword license_key: The Site Recovery Manager (SRM) license.
:paramtype license_key: str
"""
super().__init__(**kwargs)
self.addon_type: str = "SRM"
self.license_key = license_key
class AddonVrProperties(AddonProperties):
"""The properties of a vSphere Replication (VR) addon.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar addon_type: The type of private cloud addon. Required. Known values are: "SRM", "VR",
"HCX", and "Arc".
:vartype addon_type: str or ~azure.mgmt.avs.models.AddonType
:ivar provisioning_state: The state of the addon provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.AddonProvisioningState
:ivar vrs_count: The vSphere Replication Server (VRS) count. Required.
:vartype vrs_count: int
"""
_validation = {
"addon_type": {"required": True},
"provisioning_state": {"readonly": True},
"vrs_count": {"required": True},
}
_attribute_map = {
"addon_type": {"key": "addonType", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"vrs_count": {"key": "vrsCount", "type": "int"},
}
def __init__(self, *, vrs_count: int, **kwargs: Any) -> None:
"""
:keyword vrs_count: The vSphere Replication Server (VRS) count. Required.
:paramtype vrs_count: int
"""
super().__init__(**kwargs)
self.addon_type: str = "VR"
self.vrs_count = vrs_count
class AdminCredentials(_serialization.Model):
"""Administrative credentials for accessing vCenter and NSX-T.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar nsxt_username: NSX-T Manager username.
:vartype nsxt_username: str
:ivar nsxt_password: NSX-T Manager password.
:vartype nsxt_password: str
:ivar vcenter_username: vCenter admin username.
:vartype vcenter_username: str
:ivar vcenter_password: vCenter admin password.
:vartype vcenter_password: str
"""
_validation = {
"nsxt_username": {"readonly": True},
"nsxt_password": {"readonly": True},
"vcenter_username": {"readonly": True},
"vcenter_password": {"readonly": True},
}
_attribute_map = {
"nsxt_username": {"key": "nsxtUsername", "type": "str"},
"nsxt_password": {"key": "nsxtPassword", "type": "str"},
"vcenter_username": {"key": "vcenterUsername", "type": "str"},
"vcenter_password": {"key": "vcenterPassword", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.nsxt_username = None
self.nsxt_password = None
self.vcenter_username = None
self.vcenter_password = None
class AvailabilityProperties(_serialization.Model):
"""The properties describing private cloud availability zone distribution.
:ivar strategy: The availability strategy for the private cloud. Known values are: "SingleZone"
and "DualZone".
:vartype strategy: str or ~azure.mgmt.avs.models.AvailabilityStrategy
:ivar zone: The primary availability zone for the private cloud.
:vartype zone: int
:ivar secondary_zone: The secondary availability zone for the private cloud.
:vartype secondary_zone: int
"""
_attribute_map = {
"strategy": {"key": "strategy", "type": "str"},
"zone": {"key": "zone", "type": "int"},
"secondary_zone": {"key": "secondaryZone", "type": "int"},
}
def __init__(
self,
*,
strategy: Optional[Union[str, "_models.AvailabilityStrategy"]] = None,
zone: Optional[int] = None,
secondary_zone: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword strategy: The availability strategy for the private cloud. Known values are:
"SingleZone" and "DualZone".
:paramtype strategy: str or ~azure.mgmt.avs.models.AvailabilityStrategy
:keyword zone: The primary availability zone for the private cloud.
:paramtype zone: int
:keyword secondary_zone: The secondary availability zone for the private cloud.
:paramtype secondary_zone: int
"""
super().__init__(**kwargs)
self.strategy = strategy
self.zone = zone
self.secondary_zone = secondary_zone
class Circuit(_serialization.Model):
"""An ExpressRoute Circuit.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar primary_subnet: CIDR of primary subnet.
:vartype primary_subnet: str
:ivar secondary_subnet: CIDR of secondary subnet.
:vartype secondary_subnet: str
:ivar express_route_id: Identifier of the ExpressRoute Circuit (Microsoft Colo only).
:vartype express_route_id: str
:ivar express_route_private_peering_id: ExpressRoute Circuit private peering identifier.
:vartype express_route_private_peering_id: str
"""
_validation = {
"primary_subnet": {"readonly": True},
"secondary_subnet": {"readonly": True},
"express_route_id": {"readonly": True},
"express_route_private_peering_id": {"readonly": True},
}
_attribute_map = {
"primary_subnet": {"key": "primarySubnet", "type": "str"},
"secondary_subnet": {"key": "secondarySubnet", "type": "str"},
"express_route_id": {"key": "expressRouteID", "type": "str"},
"express_route_private_peering_id": {"key": "expressRoutePrivatePeeringID", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.primary_subnet = None
self.secondary_subnet = None
self.express_route_id = None
self.express_route_private_peering_id = None
class CloudLink(Resource):
"""A cloud link resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar status: The state of the cloud link. Known values are: "Active", "Building", "Deleting",
"Failed", and "Disconnected".
:vartype status: str or ~azure.mgmt.avs.models.CloudLinkStatus
:ivar linked_cloud: Identifier of the other private cloud participating in the link.
:vartype linked_cloud: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"status": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"status": {"key": "properties.status", "type": "str"},
"linked_cloud": {"key": "properties.linkedCloud", "type": "str"},
}
def __init__(self, *, linked_cloud: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword linked_cloud: Identifier of the other private cloud participating in the link.
:paramtype linked_cloud: str
"""
super().__init__(**kwargs)
self.status = None
self.linked_cloud = linked_cloud
class CloudLinkList(_serialization.Model):
"""A paged list of cloud links.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.CloudLink]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[CloudLink]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class Cluster(Resource):
"""A cluster resource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar sku: The cluster SKU. Required.
:vartype sku: ~azure.mgmt.avs.models.Sku
:ivar cluster_size: The cluster size.
:vartype cluster_size: int
:ivar provisioning_state: The state of the cluster provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState
:ivar cluster_id: The identity.
:vartype cluster_id: int
:ivar hosts: The hosts.
:vartype hosts: list[str]
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"sku": {"required": True},
"provisioning_state": {"readonly": True},
"cluster_id": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"sku": {"key": "sku", "type": "Sku"},
"cluster_size": {"key": "properties.clusterSize", "type": "int"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"cluster_id": {"key": "properties.clusterId", "type": "int"},
"hosts": {"key": "properties.hosts", "type": "[str]"},
}
def __init__(
self,
*,
sku: "_models.Sku",
cluster_size: Optional[int] = None,
hosts: Optional[List[str]] = None,
**kwargs: Any
) -> None:
"""
:keyword sku: The cluster SKU. Required.
:paramtype sku: ~azure.mgmt.avs.models.Sku
:keyword cluster_size: The cluster size.
:paramtype cluster_size: int
:keyword hosts: The hosts.
:paramtype hosts: list[str]
"""
super().__init__(**kwargs)
self.sku = sku
self.cluster_size = cluster_size
self.provisioning_state = None
self.cluster_id = None
self.hosts = hosts
class ClusterList(_serialization.Model):
"""A paged list of clusters.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.Cluster]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[Cluster]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class CommonClusterProperties(_serialization.Model):
"""The common properties of a cluster.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar cluster_size: The cluster size.
:vartype cluster_size: int
:ivar provisioning_state: The state of the cluster provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState
:ivar cluster_id: The identity.
:vartype cluster_id: int
:ivar hosts: The hosts.
:vartype hosts: list[str]
"""
_validation = {
"provisioning_state": {"readonly": True},
"cluster_id": {"readonly": True},
}
_attribute_map = {
"cluster_size": {"key": "clusterSize", "type": "int"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"cluster_id": {"key": "clusterId", "type": "int"},
"hosts": {"key": "hosts", "type": "[str]"},
}
def __init__(self, *, cluster_size: Optional[int] = None, hosts: Optional[List[str]] = None, **kwargs: Any) -> None:
"""
:keyword cluster_size: The cluster size.
:paramtype cluster_size: int
:keyword hosts: The hosts.
:paramtype hosts: list[str]
"""
super().__init__(**kwargs)
self.cluster_size = cluster_size
self.provisioning_state = None
self.cluster_id = None
self.hosts = hosts
class ClusterProperties(CommonClusterProperties):
"""The properties of a cluster.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar cluster_size: The cluster size.
:vartype cluster_size: int
:ivar provisioning_state: The state of the cluster provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState
:ivar cluster_id: The identity.
:vartype cluster_id: int
:ivar hosts: The hosts.
:vartype hosts: list[str]
"""
_validation = {
"provisioning_state": {"readonly": True},
"cluster_id": {"readonly": True},
}
_attribute_map = {
"cluster_size": {"key": "clusterSize", "type": "int"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"cluster_id": {"key": "clusterId", "type": "int"},
"hosts": {"key": "hosts", "type": "[str]"},
}
def __init__(self, *, cluster_size: Optional[int] = None, hosts: Optional[List[str]] = None, **kwargs: Any) -> None:
"""
:keyword cluster_size: The cluster size.
:paramtype cluster_size: int
:keyword hosts: The hosts.
:paramtype hosts: list[str]
"""
super().__init__(cluster_size=cluster_size, hosts=hosts, **kwargs)
class ClusterUpdate(_serialization.Model):
"""An update of a cluster resource.
:ivar cluster_size: The cluster size.
:vartype cluster_size: int
:ivar hosts: The hosts.
:vartype hosts: list[str]
"""
_attribute_map = {
"cluster_size": {"key": "properties.clusterSize", "type": "int"},
"hosts": {"key": "properties.hosts", "type": "[str]"},
}
def __init__(self, *, cluster_size: Optional[int] = None, hosts: Optional[List[str]] = None, **kwargs: Any) -> None:
"""
:keyword cluster_size: The cluster size.
:paramtype cluster_size: int
:keyword hosts: The hosts.
:paramtype hosts: list[str]
"""
super().__init__(**kwargs)
self.cluster_size = cluster_size
self.hosts = hosts
class ClusterZone(_serialization.Model):
"""Zone and associated hosts info.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar hosts: List of hosts belonging to the availability zone in a cluster.
:vartype hosts: list[str]
:ivar zone: Availability zone identifier.
:vartype zone: str
"""
_validation = {
"hosts": {"readonly": True},
"zone": {"readonly": True},
}
_attribute_map = {
"hosts": {"key": "hosts", "type": "[str]"},
"zone": {"key": "zone", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.hosts = None
self.zone = None
class ClusterZoneList(_serialization.Model):
"""List of all zones and associated hosts for a cluster.
:ivar zones: Zone and associated hosts info.
:vartype zones: list[~azure.mgmt.avs.models.ClusterZone]
"""
_attribute_map = {
"zones": {"key": "zones", "type": "[ClusterZone]"},
}
def __init__(self, *, zones: Optional[List["_models.ClusterZone"]] = None, **kwargs: Any) -> None:
"""
:keyword zones: Zone and associated hosts info.
:paramtype zones: list[~azure.mgmt.avs.models.ClusterZone]
"""
super().__init__(**kwargs)
self.zones = zones
class Datastore(Resource):
"""A datastore resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar provisioning_state: The state of the datastore provisioning. Known values are:
"Succeeded", "Failed", "Cancelled", "Pending", "Creating", "Updating", "Deleting", and
"Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.DatastoreProvisioningState
:ivar net_app_volume: An Azure NetApp Files volume.
:vartype net_app_volume: ~azure.mgmt.avs.models.NetAppVolume
:ivar disk_pool_volume: An iSCSI volume.
:vartype disk_pool_volume: ~azure.mgmt.avs.models.DiskPoolVolume
:ivar status: The operational status of the datastore. Known values are: "Unknown",
"Accessible", "Inaccessible", "Attached", "Detached", "LostCommunication", and "DeadOrError".
:vartype status: str or ~azure.mgmt.avs.models.DatastoreStatus
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"provisioning_state": {"readonly": True},
"status": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"net_app_volume": {"key": "properties.netAppVolume", "type": "NetAppVolume"},
"disk_pool_volume": {"key": "properties.diskPoolVolume", "type": "DiskPoolVolume"},
"status": {"key": "properties.status", "type": "str"},
}
def __init__(
self,
*,
net_app_volume: Optional["_models.NetAppVolume"] = None,
disk_pool_volume: Optional["_models.DiskPoolVolume"] = None,
**kwargs: Any
) -> None:
"""
:keyword net_app_volume: An Azure NetApp Files volume.
:paramtype net_app_volume: ~azure.mgmt.avs.models.NetAppVolume
:keyword disk_pool_volume: An iSCSI volume.
:paramtype disk_pool_volume: ~azure.mgmt.avs.models.DiskPoolVolume
"""
super().__init__(**kwargs)
self.provisioning_state = None
self.net_app_volume = net_app_volume
self.disk_pool_volume = disk_pool_volume
self.status = None
class DatastoreList(_serialization.Model):
"""A paged list of datastores.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.Datastore]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[Datastore]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class DiskPoolVolume(_serialization.Model):
"""An iSCSI volume from Microsoft.StoragePool provider.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar target_id: Azure resource ID of the iSCSI target. Required.
:vartype target_id: str
:ivar lun_name: Name of the LUN to be used for datastore. Required.
:vartype lun_name: str
:ivar mount_option: Mode that describes whether the LUN has to be mounted as a datastore or
attached as a LUN. Known values are: "MOUNT" and "ATTACH".
:vartype mount_option: str or ~azure.mgmt.avs.models.MountOptionEnum
:ivar path: Device path.
:vartype path: str
"""
_validation = {
"target_id": {"required": True},
"lun_name": {"required": True},
"path": {"readonly": True},
}
_attribute_map = {
"target_id": {"key": "targetId", "type": "str"},
"lun_name": {"key": "lunName", "type": "str"},
"mount_option": {"key": "mountOption", "type": "str"},
"path": {"key": "path", "type": "str"},
}
def __init__(
self,
*,
target_id: str,
lun_name: str,
mount_option: Union[str, "_models.MountOptionEnum"] = "MOUNT",
**kwargs: Any
) -> None:
"""
:keyword target_id: Azure resource ID of the iSCSI target. Required.
:paramtype target_id: str
:keyword lun_name: Name of the LUN to be used for datastore. Required.
:paramtype lun_name: str
:keyword mount_option: Mode that describes whether the LUN has to be mounted as a datastore or
attached as a LUN. Known values are: "MOUNT" and "ATTACH".
:paramtype mount_option: str or ~azure.mgmt.avs.models.MountOptionEnum
"""
super().__init__(**kwargs)
self.target_id = target_id
self.lun_name = lun_name
self.mount_option = mount_option
self.path = None
class Encryption(_serialization.Model):
"""The properties of customer managed encryption key.
:ivar status: Status of customer managed encryption key. Known values are: "Enabled" and
"Disabled".
:vartype status: str or ~azure.mgmt.avs.models.EncryptionState
:ivar key_vault_properties: The key vault where the encryption key is stored.
:vartype key_vault_properties: ~azure.mgmt.avs.models.EncryptionKeyVaultProperties
"""
_attribute_map = {
"status": {"key": "status", "type": "str"},
"key_vault_properties": {"key": "keyVaultProperties", "type": "EncryptionKeyVaultProperties"},
}
def __init__(
self,
*,
status: Optional[Union[str, "_models.EncryptionState"]] = None,
key_vault_properties: Optional["_models.EncryptionKeyVaultProperties"] = None,
**kwargs: Any
) -> None:
"""
:keyword status: Status of customer managed encryption key. Known values are: "Enabled" and
"Disabled".
:paramtype status: str or ~azure.mgmt.avs.models.EncryptionState
:keyword key_vault_properties: The key vault where the encryption key is stored.
:paramtype key_vault_properties: ~azure.mgmt.avs.models.EncryptionKeyVaultProperties
"""
super().__init__(**kwargs)
self.status = status
self.key_vault_properties = key_vault_properties
class EncryptionKeyVaultProperties(_serialization.Model):
"""An Encryption Key.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar key_name: The name of the key.
:vartype key_name: str
:ivar key_version: The version of the key.
:vartype key_version: str
:ivar auto_detected_key_version: The auto-detected version of the key if versionType is
auto-detected.
:vartype auto_detected_key_version: str
:ivar key_vault_url: The URL of the vault.
:vartype key_vault_url: str
:ivar key_state: The state of key provided. Known values are: "Connected" and "AccessDenied".
:vartype key_state: str or ~azure.mgmt.avs.models.EncryptionKeyStatus
:ivar version_type: Property of the key if user provided or auto detected. Known values are:
"Fixed" and "AutoDetected".
:vartype version_type: str or ~azure.mgmt.avs.models.EncryptionVersionType
"""
_validation = {
"auto_detected_key_version": {"readonly": True},
"key_state": {"readonly": True},
"version_type": {"readonly": True},
}
_attribute_map = {
"key_name": {"key": "keyName", "type": "str"},
"key_version": {"key": "keyVersion", "type": "str"},
"auto_detected_key_version": {"key": "autoDetectedKeyVersion", "type": "str"},
"key_vault_url": {"key": "keyVaultUrl", "type": "str"},
"key_state": {"key": "keyState", "type": "str"},
"version_type": {"key": "versionType", "type": "str"},
}
def __init__(
self,
*,
key_name: Optional[str] = None,
key_version: Optional[str] = None,
key_vault_url: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword key_name: The name of the key.
:paramtype key_name: str
:keyword key_version: The version of the key.
:paramtype key_version: str
:keyword key_vault_url: The URL of the vault.
:paramtype key_vault_url: str
"""
super().__init__(**kwargs)
self.key_name = key_name
self.key_version = key_version
self.auto_detected_key_version = None
self.key_vault_url = key_vault_url
self.key_state = None
self.version_type = None
class Endpoints(_serialization.Model):
"""Endpoint addresses.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar nsxt_manager: Endpoint for the NSX-T Data Center manager.
:vartype nsxt_manager: str
:ivar vcsa: Endpoint for Virtual Center Server Appliance.
:vartype vcsa: str
:ivar hcx_cloud_manager: Endpoint for the HCX Cloud Manager.
:vartype hcx_cloud_manager: str
"""
_validation = {
"nsxt_manager": {"readonly": True},
"vcsa": {"readonly": True},
"hcx_cloud_manager": {"readonly": True},
}
_attribute_map = {
"nsxt_manager": {"key": "nsxtManager", "type": "str"},
"vcsa": {"key": "vcsa", "type": "str"},
"hcx_cloud_manager": {"key": "hcxCloudManager", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.nsxt_manager = None
self.vcsa = None
self.hcx_cloud_manager = None
class ErrorAdditionalInfo(_serialization.Model):
"""The resource management error additional info.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar type: The additional info type.
:vartype type: str
:ivar info: The additional info.
:vartype info: JSON
"""
_validation = {
"type": {"readonly": True},
"info": {"readonly": True},
}
_attribute_map = {
"type": {"key": "type", "type": "str"},
"info": {"key": "info", "type": "object"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.type = None
self.info = None
class ErrorDetail(_serialization.Model):
"""The error detail.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar code: The error code.
:vartype code: str
:ivar message: The error message.
:vartype message: str
:ivar target: The error target.
:vartype target: str
:ivar details: The error details.
:vartype details: list[~azure.mgmt.avs.models.ErrorDetail]
:ivar additional_info: The error additional info.
:vartype additional_info: list[~azure.mgmt.avs.models.ErrorAdditionalInfo]
"""
_validation = {
"code": {"readonly": True},
"message": {"readonly": True},
"target": {"readonly": True},
"details": {"readonly": True},
"additional_info": {"readonly": True},
}
_attribute_map = {
"code": {"key": "code", "type": "str"},
"message": {"key": "message", "type": "str"},
"target": {"key": "target", "type": "str"},
"details": {"key": "details", "type": "[ErrorDetail]"},
"additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.code = None
self.message = None
self.target = None
self.details = None
self.additional_info = None
class ErrorResponse(_serialization.Model):
"""Common error response for all Azure Resource Manager APIs to return error details for failed
operations. (This also follows the OData error response format.).
:ivar error: The error object.
:vartype error: ~azure.mgmt.avs.models.ErrorDetail
"""
_attribute_map = {
"error": {"key": "error", "type": "ErrorDetail"},
}
def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None:
"""
:keyword error: The error object.
:paramtype error: ~azure.mgmt.avs.models.ErrorDetail
"""
super().__init__(**kwargs)
self.error = error
class ExpressRouteAuthorization(Resource):
"""ExpressRoute Circuit Authorization.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar provisioning_state: The state of the ExpressRoute Circuit Authorization provisioning.
Known values are: "Succeeded", "Failed", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.ExpressRouteAuthorizationProvisioningState
:ivar express_route_authorization_id: The ID of the ExpressRoute Circuit Authorization.
:vartype express_route_authorization_id: str
:ivar express_route_authorization_key: The key of the ExpressRoute Circuit Authorization.
:vartype express_route_authorization_key: str
:ivar express_route_id: The ID of the ExpressRoute Circuit.
:vartype express_route_id: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"provisioning_state": {"readonly": True},
"express_route_authorization_id": {"readonly": True},
"express_route_authorization_key": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"express_route_authorization_id": {"key": "properties.expressRouteAuthorizationId", "type": "str"},
"express_route_authorization_key": {"key": "properties.expressRouteAuthorizationKey", "type": "str"},
"express_route_id": {"key": "properties.expressRouteId", "type": "str"},
}
def __init__(self, *, express_route_id: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword express_route_id: The ID of the ExpressRoute Circuit.
:paramtype express_route_id: str
"""
super().__init__(**kwargs)
self.provisioning_state = None
self.express_route_authorization_id = None
self.express_route_authorization_key = None
self.express_route_id = express_route_id
class ExpressRouteAuthorizationList(_serialization.Model):
"""A paged list of ExpressRoute Circuit Authorizations.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.ExpressRouteAuthorization]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[ExpressRouteAuthorization]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class GlobalReachConnection(Resource):
"""A global reach connection resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar provisioning_state: The state of the ExpressRoute Circuit Authorization provisioning.
Known values are: "Succeeded", "Failed", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.GlobalReachConnectionProvisioningState
:ivar address_prefix: The network used for global reach carved out from the original network
block provided for the private cloud.
:vartype address_prefix: str
:ivar authorization_key: Authorization key from the peer express route used for the global
reach connection.
:vartype authorization_key: str
:ivar circuit_connection_status: The connection status of the global reach connection. Known
values are: "Connected", "Connecting", and "Disconnected".
:vartype circuit_connection_status: str or ~azure.mgmt.avs.models.GlobalReachConnectionStatus
:ivar peer_express_route_circuit: Identifier of the ExpressRoute Circuit to peer with in the
global reach connection.
:vartype peer_express_route_circuit: str
:ivar express_route_id: The ID of the Private Cloud's ExpressRoute Circuit that is
participating in the global reach connection.
:vartype express_route_id: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"provisioning_state": {"readonly": True},
"address_prefix": {"readonly": True},
"circuit_connection_status": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"address_prefix": {"key": "properties.addressPrefix", "type": "str"},
"authorization_key": {"key": "properties.authorizationKey", "type": "str"},
"circuit_connection_status": {"key": "properties.circuitConnectionStatus", "type": "str"},
"peer_express_route_circuit": {"key": "properties.peerExpressRouteCircuit", "type": "str"},
"express_route_id": {"key": "properties.expressRouteId", "type": "str"},
}
def __init__(
self,
*,
authorization_key: Optional[str] = None,
peer_express_route_circuit: Optional[str] = None,
express_route_id: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword authorization_key: Authorization key from the peer express route used for the global
reach connection.
:paramtype authorization_key: str
:keyword peer_express_route_circuit: Identifier of the ExpressRoute Circuit to peer with in the
global reach connection.
:paramtype peer_express_route_circuit: str
:keyword express_route_id: The ID of the Private Cloud's ExpressRoute Circuit that is
participating in the global reach connection.
:paramtype express_route_id: str
"""
super().__init__(**kwargs)
self.provisioning_state = None
self.address_prefix = None
self.authorization_key = authorization_key
self.circuit_connection_status = None
self.peer_express_route_circuit = peer_express_route_circuit
self.express_route_id = express_route_id
class GlobalReachConnectionList(_serialization.Model):
"""A paged list of global reach connections.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.GlobalReachConnection]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[GlobalReachConnection]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class HcxEnterpriseSite(Resource):
"""An HCX Enterprise Site resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar activation_key: The activation key.
:vartype activation_key: str
:ivar status: The status of the HCX Enterprise Site. Known values are: "Available", "Consumed",
"Deactivated", and "Deleted".
:vartype status: str or ~azure.mgmt.avs.models.HcxEnterpriseSiteStatus
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"activation_key": {"readonly": True},
"status": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"activation_key": {"key": "properties.activationKey", "type": "str"},
"status": {"key": "properties.status", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.activation_key = None
self.status = None
class HcxEnterpriseSiteList(_serialization.Model):
"""A paged list of HCX Enterprise Sites.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on a page.
:vartype value: list[~azure.mgmt.avs.models.HcxEnterpriseSite]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[HcxEnterpriseSite]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class IdentitySource(_serialization.Model):
"""vCenter Single Sign On Identity Source.
:ivar name: The name of the identity source.
:vartype name: str
:ivar alias: The domain's NetBIOS name.
:vartype alias: str
:ivar domain: The domain's dns name.
:vartype domain: str
:ivar base_user_dn: The base distinguished name for users.
:vartype base_user_dn: str
:ivar base_group_dn: The base distinguished name for groups.
:vartype base_group_dn: str
:ivar primary_server: Primary server URL.
:vartype primary_server: str
:ivar secondary_server: Secondary server URL.
:vartype secondary_server: str
:ivar ssl: Protect LDAP communication using SSL certificate (LDAPS). Known values are:
"Enabled" and "Disabled".
:vartype ssl: str or ~azure.mgmt.avs.models.SslEnum
:ivar username: The ID of an Active Directory user with a minimum of read-only access to Base
DN for users and group.
:vartype username: str
:ivar password: The password of the Active Directory user with a minimum of read-only access to
Base DN for users and groups.
:vartype password: str
"""
_attribute_map = {
"name": {"key": "name", "type": "str"},
"alias": {"key": "alias", "type": "str"},
"domain": {"key": "domain", "type": "str"},
"base_user_dn": {"key": "baseUserDN", "type": "str"},
"base_group_dn": {"key": "baseGroupDN", "type": "str"},
"primary_server": {"key": "primaryServer", "type": "str"},
"secondary_server": {"key": "secondaryServer", "type": "str"},
"ssl": {"key": "ssl", "type": "str"},
"username": {"key": "username", "type": "str"},
"password": {"key": "password", "type": "str"},
}
def __init__(
self,
*,
name: Optional[str] = None,
alias: Optional[str] = None,
domain: Optional[str] = None,
base_user_dn: Optional[str] = None,
base_group_dn: Optional[str] = None,
primary_server: Optional[str] = None,
secondary_server: Optional[str] = None,
ssl: Optional[Union[str, "_models.SslEnum"]] = None,
username: Optional[str] = None,
password: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword name: The name of the identity source.
:paramtype name: str
:keyword alias: The domain's NetBIOS name.
:paramtype alias: str
:keyword domain: The domain's dns name.
:paramtype domain: str
:keyword base_user_dn: The base distinguished name for users.
:paramtype base_user_dn: str
:keyword base_group_dn: The base distinguished name for groups.
:paramtype base_group_dn: str
:keyword primary_server: Primary server URL.
:paramtype primary_server: str
:keyword secondary_server: Secondary server URL.
:paramtype secondary_server: str
:keyword ssl: Protect LDAP communication using SSL certificate (LDAPS). Known values are:
"Enabled" and "Disabled".
:paramtype ssl: str or ~azure.mgmt.avs.models.SslEnum
:keyword username: The ID of an Active Directory user with a minimum of read-only access to
Base DN for users and group.
:paramtype username: str
:keyword password: The password of the Active Directory user with a minimum of read-only access
to Base DN for users and groups.
:paramtype password: str
"""
super().__init__(**kwargs)
self.name = name
self.alias = alias
self.domain = domain
self.base_user_dn = base_user_dn
self.base_group_dn = base_group_dn
self.primary_server = primary_server
self.secondary_server = secondary_server
self.ssl = ssl
self.username = username
self.password = password
class LogSpecification(_serialization.Model):
"""Specifications of the Log for Azure Monitoring.
:ivar name: Name of the log.
:vartype name: str
:ivar display_name: Localized friendly display name of the log.
:vartype display_name: str
:ivar blob_duration: Blob duration of the log.
:vartype blob_duration: str
"""
_attribute_map = {
"name": {"key": "name", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"blob_duration": {"key": "blobDuration", "type": "str"},
}
def __init__(
self,
*,
name: Optional[str] = None,
display_name: Optional[str] = None,
blob_duration: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword name: Name of the log.
:paramtype name: str
:keyword display_name: Localized friendly display name of the log.
:paramtype display_name: str
:keyword blob_duration: Blob duration of the log.
:paramtype blob_duration: str
"""
super().__init__(**kwargs)
self.name = name
self.display_name = display_name
self.blob_duration = blob_duration
class ManagementCluster(CommonClusterProperties):
"""The properties of a management cluster.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar cluster_size: The cluster size.
:vartype cluster_size: int
:ivar provisioning_state: The state of the cluster provisioning. Known values are: "Succeeded",
"Failed", "Cancelled", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.ClusterProvisioningState
:ivar cluster_id: The identity.
:vartype cluster_id: int
:ivar hosts: The hosts.
:vartype hosts: list[str]
"""
_validation = {
"provisioning_state": {"readonly": True},
"cluster_id": {"readonly": True},
}
_attribute_map = {
"cluster_size": {"key": "clusterSize", "type": "int"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"cluster_id": {"key": "clusterId", "type": "int"},
"hosts": {"key": "hosts", "type": "[str]"},
}
def __init__(self, *, cluster_size: Optional[int] = None, hosts: Optional[List[str]] = None, **kwargs: Any) -> None:
"""
:keyword cluster_size: The cluster size.
:paramtype cluster_size: int
:keyword hosts: The hosts.
:paramtype hosts: list[str]
"""
super().__init__(cluster_size=cluster_size, hosts=hosts, **kwargs)
class MetricDimension(_serialization.Model):
"""Specifications of the Dimension of metrics.
:ivar name: Name of the dimension.
:vartype name: str
:ivar display_name: Localized friendly display name of the dimension.
:vartype display_name: str
:ivar internal_name: Name of the dimension as it appears in MDM.
:vartype internal_name: str
:ivar to_be_exported_for_shoebox: A boolean flag indicating whether this dimension should be
included for the shoebox export scenario.
:vartype to_be_exported_for_shoebox: bool
"""
_attribute_map = {
"name": {"key": "name", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"internal_name": {"key": "internalName", "type": "str"},
"to_be_exported_for_shoebox": {"key": "toBeExportedForShoebox", "type": "bool"},
}
def __init__(
self,
*,
name: Optional[str] = None,
display_name: Optional[str] = None,
internal_name: Optional[str] = None,
to_be_exported_for_shoebox: Optional[bool] = None,
**kwargs: Any
) -> None:
"""
:keyword name: Name of the dimension.
:paramtype name: str
:keyword display_name: Localized friendly display name of the dimension.
:paramtype display_name: str
:keyword internal_name: Name of the dimension as it appears in MDM.
:paramtype internal_name: str
:keyword to_be_exported_for_shoebox: A boolean flag indicating whether this dimension should be
included for the shoebox export scenario.
:paramtype to_be_exported_for_shoebox: bool
"""
super().__init__(**kwargs)
self.name = name
self.display_name = display_name
self.internal_name = internal_name
self.to_be_exported_for_shoebox = to_be_exported_for_shoebox
class MetricSpecification(_serialization.Model): # pylint: disable=too-many-instance-attributes
"""Specifications of the Metrics for Azure Monitoring.
:ivar name: Name of the metric.
:vartype name: str
:ivar display_name: Localized friendly display name of the metric.
:vartype display_name: str
:ivar display_description: Localized friendly description of the metric.
:vartype display_description: str
:ivar unit: Unit that makes sense for the metric.
:vartype unit: str
:ivar category: Name of the metric category that the metric belongs to. A metric can only
belong to a single category.
:vartype category: str
:ivar aggregation_type: Only provide one value for this field. Valid values: Average, Minimum,
Maximum, Total, Count.
:vartype aggregation_type: str
:ivar supported_aggregation_types: Supported aggregation types.
:vartype supported_aggregation_types: list[str]
:ivar supported_time_grain_types: Supported time grain types.
:vartype supported_time_grain_types: list[str]
:ivar fill_gap_with_zero: Optional. If set to true, then zero will be returned for time
duration where no metric is emitted/published.
:vartype fill_gap_with_zero: bool
:ivar dimensions: Dimensions of the metric.
:vartype dimensions: list[~azure.mgmt.avs.models.MetricDimension]
:ivar enable_regional_mdm_account: Whether or not the service is using regional MDM accounts.
:vartype enable_regional_mdm_account: str
:ivar source_mdm_account: The name of the MDM account.
:vartype source_mdm_account: str
:ivar source_mdm_namespace: The name of the MDM namespace.
:vartype source_mdm_namespace: str
"""
_attribute_map = {
"name": {"key": "name", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"display_description": {"key": "displayDescription", "type": "str"},
"unit": {"key": "unit", "type": "str"},
"category": {"key": "category", "type": "str"},
"aggregation_type": {"key": "aggregationType", "type": "str"},
"supported_aggregation_types": {"key": "supportedAggregationTypes", "type": "[str]"},
"supported_time_grain_types": {"key": "supportedTimeGrainTypes", "type": "[str]"},
"fill_gap_with_zero": {"key": "fillGapWithZero", "type": "bool"},
"dimensions": {"key": "dimensions", "type": "[MetricDimension]"},
"enable_regional_mdm_account": {"key": "enableRegionalMdmAccount", "type": "str"},
"source_mdm_account": {"key": "sourceMdmAccount", "type": "str"},
"source_mdm_namespace": {"key": "sourceMdmNamespace", "type": "str"},
}
def __init__(
self,
*,
name: Optional[str] = None,
display_name: Optional[str] = None,
display_description: Optional[str] = None,
unit: Optional[str] = None,
category: Optional[str] = None,
aggregation_type: Optional[str] = None,
supported_aggregation_types: Optional[List[str]] = None,
supported_time_grain_types: Optional[List[str]] = None,
fill_gap_with_zero: Optional[bool] = None,
dimensions: Optional[List["_models.MetricDimension"]] = None,
enable_regional_mdm_account: Optional[str] = None,
source_mdm_account: Optional[str] = None,
source_mdm_namespace: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword name: Name of the metric.
:paramtype name: str
:keyword display_name: Localized friendly display name of the metric.
:paramtype display_name: str
:keyword display_description: Localized friendly description of the metric.
:paramtype display_description: str
:keyword unit: Unit that makes sense for the metric.
:paramtype unit: str
:keyword category: Name of the metric category that the metric belongs to. A metric can only
belong to a single category.
:paramtype category: str
:keyword aggregation_type: Only provide one value for this field. Valid values: Average,
Minimum, Maximum, Total, Count.
:paramtype aggregation_type: str
:keyword supported_aggregation_types: Supported aggregation types.
:paramtype supported_aggregation_types: list[str]
:keyword supported_time_grain_types: Supported time grain types.
:paramtype supported_time_grain_types: list[str]
:keyword fill_gap_with_zero: Optional. If set to true, then zero will be returned for time
duration where no metric is emitted/published.
:paramtype fill_gap_with_zero: bool
:keyword dimensions: Dimensions of the metric.
:paramtype dimensions: list[~azure.mgmt.avs.models.MetricDimension]
:keyword enable_regional_mdm_account: Whether or not the service is using regional MDM
accounts.
:paramtype enable_regional_mdm_account: str
:keyword source_mdm_account: The name of the MDM account.
:paramtype source_mdm_account: str
:keyword source_mdm_namespace: The name of the MDM namespace.
:paramtype source_mdm_namespace: str
"""
super().__init__(**kwargs)
self.name = name
self.display_name = display_name
self.display_description = display_description
self.unit = unit
self.category = category
self.aggregation_type = aggregation_type
self.supported_aggregation_types = supported_aggregation_types
self.supported_time_grain_types = supported_time_grain_types
self.fill_gap_with_zero = fill_gap_with_zero
self.dimensions = dimensions
self.enable_regional_mdm_account = enable_regional_mdm_account
self.source_mdm_account = source_mdm_account
self.source_mdm_namespace = source_mdm_namespace
class NetAppVolume(_serialization.Model):
"""An Azure NetApp Files volume from Microsoft.NetApp provider.
All required parameters must be populated in order to send to Azure.
:ivar id: Azure resource ID of the NetApp volume. Required.
:vartype id: str
"""
_validation = {
"id": {"required": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
}
def __init__(self, *, id: str, **kwargs: Any) -> None: # pylint: disable=redefined-builtin
"""
:keyword id: Azure resource ID of the NetApp volume. Required.
:paramtype id: str
"""
super().__init__(**kwargs)
self.id = id
class Operation(_serialization.Model):
"""A REST API operation.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar name: Name of the operation being performed on this object.
:vartype name: str
:ivar display: Contains the localized display information for this operation.
:vartype display: ~azure.mgmt.avs.models.OperationDisplay
:ivar is_data_action: Gets or sets a value indicating whether the operation is a data action or
not.
:vartype is_data_action: bool
:ivar origin: Origin of the operation.
:vartype origin: str
:ivar properties: Properties of the operation.
:vartype properties: ~azure.mgmt.avs.models.OperationProperties
"""
_validation = {
"name": {"readonly": True},
"display": {"readonly": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
"display": {"key": "display", "type": "OperationDisplay"},
"is_data_action": {"key": "isDataAction", "type": "bool"},
"origin": {"key": "origin", "type": "str"},
"properties": {"key": "properties", "type": "OperationProperties"},
}
def __init__(
self,
*,
is_data_action: Optional[bool] = None,
origin: Optional[str] = None,
properties: Optional["_models.OperationProperties"] = None,
**kwargs: Any
) -> None:
"""
:keyword is_data_action: Gets or sets a value indicating whether the operation is a data action
or not.
:paramtype is_data_action: bool
:keyword origin: Origin of the operation.
:paramtype origin: str
:keyword properties: Properties of the operation.
:paramtype properties: ~azure.mgmt.avs.models.OperationProperties
"""
super().__init__(**kwargs)
self.name = None
self.display = None
self.is_data_action = is_data_action
self.origin = origin
self.properties = properties
class OperationDisplay(_serialization.Model):
"""Contains the localized display information for this operation.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar provider: Localized friendly form of the resource provider name.
:vartype provider: str
:ivar resource: Localized friendly form of the resource type related to this operation.
:vartype resource: str
:ivar operation: Localized friendly name for the operation.
:vartype operation: str
:ivar description: Localized friendly description for the operation.
:vartype description: str
"""
_validation = {
"provider": {"readonly": True},
"resource": {"readonly": True},
"operation": {"readonly": True},
"description": {"readonly": True},
}
_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: Any) -> None:
""" """
super().__init__(**kwargs)
self.provider = None
self.resource = None
self.operation = None
self.description = None
class OperationList(_serialization.Model):
"""Pageable list of operations.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of operations.
:vartype value: list[~azure.mgmt.avs.models.Operation]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[Operation]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class OperationProperties(_serialization.Model):
"""Extra Operation properties.
:ivar service_specification: Service specifications of the operation.
:vartype service_specification: ~azure.mgmt.avs.models.ServiceSpecification
"""
_attribute_map = {
"service_specification": {"key": "serviceSpecification", "type": "ServiceSpecification"},
}
def __init__(
self, *, service_specification: Optional["_models.ServiceSpecification"] = None, **kwargs: Any
) -> None:
"""
:keyword service_specification: Service specifications of the operation.
:paramtype service_specification: ~azure.mgmt.avs.models.ServiceSpecification
"""
super().__init__(**kwargs)
self.service_specification = service_specification
class PlacementPoliciesList(_serialization.Model):
"""Represents list of placement policies.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.PlacementPolicy]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[PlacementPolicy]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class PlacementPolicy(Resource):
"""A vSphere Distributed Resource Scheduler (DRS) placement policy.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar properties: placement policy properties.
:vartype properties: ~azure.mgmt.avs.models.PlacementPolicyProperties
"""
_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"},
"properties": {"key": "properties", "type": "PlacementPolicyProperties"},
}
def __init__(self, *, properties: Optional["_models.PlacementPolicyProperties"] = None, **kwargs: Any) -> None:
"""
:keyword properties: placement policy properties.
:paramtype properties: ~azure.mgmt.avs.models.PlacementPolicyProperties
"""
super().__init__(**kwargs)
self.properties = properties
class PlacementPolicyProperties(_serialization.Model):
"""Abstract placement policy properties.
You probably want to use the sub-classes and not this class directly. Known sub-classes are:
VmHostPlacementPolicyProperties, VmPlacementPolicyProperties
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar type: placement policy type. Required. Known values are: "VmVm" and "VmHost".
:vartype type: str or ~azure.mgmt.avs.models.PlacementPolicyType
:ivar state: Whether the placement policy is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:ivar display_name: Display name of the placement policy.
:vartype display_name: str
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState
"""
_validation = {
"type": {"required": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"type": {"key": "type", "type": "str"},
"state": {"key": "state", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
}
_subtype_map = {"type": {"VmHost": "VmHostPlacementPolicyProperties", "VmVm": "VmPlacementPolicyProperties"}}
def __init__(
self,
*,
state: Optional[Union[str, "_models.PlacementPolicyState"]] = None,
display_name: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword state: Whether the placement policy is enabled or disabled. Known values are:
"Enabled" and "Disabled".
:paramtype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:keyword display_name: Display name of the placement policy.
:paramtype display_name: str
"""
super().__init__(**kwargs)
self.type: Optional[str] = None
self.state = state
self.display_name = display_name
self.provisioning_state = None
class PlacementPolicyUpdate(_serialization.Model):
"""An update of a DRS placement policy resource.
:ivar state: Whether the placement policy is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:ivar vm_members: Virtual machine members list.
:vartype vm_members: list[str]
:ivar host_members: Host members list.
:vartype host_members: list[str]
:ivar affinity_strength: vm-host placement policy affinity strength (should/must). Known values
are: "Should" and "Must".
:vartype affinity_strength: str or ~azure.mgmt.avs.models.AffinityStrength
:ivar azure_hybrid_benefit_type: placement policy azure hybrid benefit opt-in type. Known
values are: "SqlHost" and "None".
:vartype azure_hybrid_benefit_type: str or ~azure.mgmt.avs.models.AzureHybridBenefitType
"""
_attribute_map = {
"state": {"key": "properties.state", "type": "str"},
"vm_members": {"key": "properties.vmMembers", "type": "[str]"},
"host_members": {"key": "properties.hostMembers", "type": "[str]"},
"affinity_strength": {"key": "properties.affinityStrength", "type": "str"},
"azure_hybrid_benefit_type": {"key": "properties.azureHybridBenefitType", "type": "str"},
}
def __init__(
self,
*,
state: Optional[Union[str, "_models.PlacementPolicyState"]] = None,
vm_members: Optional[List[str]] = None,
host_members: Optional[List[str]] = None,
affinity_strength: Optional[Union[str, "_models.AffinityStrength"]] = None,
azure_hybrid_benefit_type: Optional[Union[str, "_models.AzureHybridBenefitType"]] = None,
**kwargs: Any
) -> None:
"""
:keyword state: Whether the placement policy is enabled or disabled. Known values are:
"Enabled" and "Disabled".
:paramtype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:keyword vm_members: Virtual machine members list.
:paramtype vm_members: list[str]
:keyword host_members: Host members list.
:paramtype host_members: list[str]
:keyword affinity_strength: vm-host placement policy affinity strength (should/must). Known
values are: "Should" and "Must".
:paramtype affinity_strength: str or ~azure.mgmt.avs.models.AffinityStrength
:keyword azure_hybrid_benefit_type: placement policy azure hybrid benefit opt-in type. Known
values are: "SqlHost" and "None".
:paramtype azure_hybrid_benefit_type: str or ~azure.mgmt.avs.models.AzureHybridBenefitType
"""
super().__init__(**kwargs)
self.state = state
self.vm_members = vm_members
self.host_members = host_members
self.affinity_strength = affinity_strength
self.azure_hybrid_benefit_type = azure_hybrid_benefit_type
class TrackedResource(Resource):
"""The resource model definition for a ARM tracked top level resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar location: Resource location.
:vartype location: str
:ivar tags: Resource tags.
:vartype tags: dict[str, 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}"},
}
def __init__(self, *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None:
"""
:keyword location: Resource location.
:paramtype location: str
:keyword tags: Resource tags.
:paramtype tags: dict[str, str]
"""
super().__init__(**kwargs)
self.location = location
self.tags = tags
class PrivateCloud(TrackedResource): # pylint: disable=too-many-instance-attributes
"""A private cloud resource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar location: Resource location.
:vartype location: str
:ivar tags: Resource tags.
:vartype tags: dict[str, str]
:ivar sku: The private cloud SKU. Required.
:vartype sku: ~azure.mgmt.avs.models.Sku
:ivar identity: The identity of the private cloud, if configured.
:vartype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity
:ivar management_cluster: The default cluster used for management.
:vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:ivar internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype internet: str or ~azure.mgmt.avs.models.InternetEnum
:ivar identity_sources: vCenter Single Sign On Identity Sources.
:vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:ivar availability: Properties describing how the cloud is distributed across availability
zones.
:vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:ivar encryption: Customer managed key encryption, can be enabled or disabled.
:vartype encryption: ~azure.mgmt.avs.models.Encryption
:ivar extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:vartype extended_network_blocks: list[str]
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Cancelled", "Pending", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState
:ivar circuit: An ExpressRoute Circuit.
:vartype circuit: ~azure.mgmt.avs.models.Circuit
:ivar endpoints: The endpoints.
:vartype endpoints: ~azure.mgmt.avs.models.Endpoints
:ivar network_block: The block of addresses should be unique across VNet in your subscription
as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are
between 0 and 255, and X is between 0 and 22.
:vartype network_block: str
:ivar management_network: Network used to access vCenter Server and NSX-T Manager.
:vartype management_network: str
:ivar provisioning_network: Used for virtual machine cold migration, cloning, and snapshot
migration.
:vartype provisioning_network: str
:ivar vmotion_network: Used for live migration of virtual machines.
:vartype vmotion_network: str
:ivar vcenter_password: Optionally, set the vCenter admin password when the private cloud is
created.
:vartype vcenter_password: str
:ivar nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is
created.
:vartype nsxt_password: str
:ivar vcenter_certificate_thumbprint: Thumbprint of the vCenter Server SSL certificate.
:vartype vcenter_certificate_thumbprint: str
:ivar nsxt_certificate_thumbprint: Thumbprint of the NSX-T Manager SSL certificate.
:vartype nsxt_certificate_thumbprint: str
:ivar external_cloud_links: Array of cloud link IDs from other clouds that connect to this one.
:vartype external_cloud_links: list[str]
:ivar secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present in a
stretched private cloud.
:vartype secondary_circuit: ~azure.mgmt.avs.models.Circuit
:ivar nsx_public_ip_quota_raised: Flag to indicate whether the private cloud has the quota for
provisioned NSX Public IP count raised from 64 to 1024. Known values are: "Enabled" and
"Disabled".
:vartype nsx_public_ip_quota_raised: str or ~azure.mgmt.avs.models.NsxPublicIpQuotaRaisedEnum
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"sku": {"required": True},
"provisioning_state": {"readonly": True},
"endpoints": {"readonly": True},
"management_network": {"readonly": True},
"provisioning_network": {"readonly": True},
"vmotion_network": {"readonly": True},
"vcenter_certificate_thumbprint": {"readonly": True},
"nsxt_certificate_thumbprint": {"readonly": True},
"external_cloud_links": {"readonly": True},
"nsx_public_ip_quota_raised": {"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}"},
"sku": {"key": "sku", "type": "Sku"},
"identity": {"key": "identity", "type": "PrivateCloudIdentity"},
"management_cluster": {"key": "properties.managementCluster", "type": "ManagementCluster"},
"internet": {"key": "properties.internet", "type": "str"},
"identity_sources": {"key": "properties.identitySources", "type": "[IdentitySource]"},
"availability": {"key": "properties.availability", "type": "AvailabilityProperties"},
"encryption": {"key": "properties.encryption", "type": "Encryption"},
"extended_network_blocks": {"key": "properties.extendedNetworkBlocks", "type": "[str]"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"circuit": {"key": "properties.circuit", "type": "Circuit"},
"endpoints": {"key": "properties.endpoints", "type": "Endpoints"},
"network_block": {"key": "properties.networkBlock", "type": "str"},
"management_network": {"key": "properties.managementNetwork", "type": "str"},
"provisioning_network": {"key": "properties.provisioningNetwork", "type": "str"},
"vmotion_network": {"key": "properties.vmotionNetwork", "type": "str"},
"vcenter_password": {"key": "properties.vcenterPassword", "type": "str"},
"nsxt_password": {"key": "properties.nsxtPassword", "type": "str"},
"vcenter_certificate_thumbprint": {"key": "properties.vcenterCertificateThumbprint", "type": "str"},
"nsxt_certificate_thumbprint": {"key": "properties.nsxtCertificateThumbprint", "type": "str"},
"external_cloud_links": {"key": "properties.externalCloudLinks", "type": "[str]"},
"secondary_circuit": {"key": "properties.secondaryCircuit", "type": "Circuit"},
"nsx_public_ip_quota_raised": {"key": "properties.nsxPublicIpQuotaRaised", "type": "str"},
}
def __init__( # pylint: disable=too-many-locals
self,
*,
sku: "_models.Sku",
location: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.PrivateCloudIdentity"] = None,
management_cluster: Optional["_models.ManagementCluster"] = None,
internet: Union[str, "_models.InternetEnum"] = "Disabled",
identity_sources: Optional[List["_models.IdentitySource"]] = None,
availability: Optional["_models.AvailabilityProperties"] = None,
encryption: Optional["_models.Encryption"] = None,
extended_network_blocks: Optional[List[str]] = None,
circuit: Optional["_models.Circuit"] = None,
network_block: Optional[str] = None,
vcenter_password: Optional[str] = None,
nsxt_password: Optional[str] = None,
secondary_circuit: Optional["_models.Circuit"] = None,
**kwargs: Any
) -> None:
"""
:keyword location: Resource location.
:paramtype location: str
:keyword tags: Resource tags.
:paramtype tags: dict[str, str]
:keyword sku: The private cloud SKU. Required.
:paramtype sku: ~azure.mgmt.avs.models.Sku
:keyword identity: The identity of the private cloud, if configured.
:paramtype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity
:keyword management_cluster: The default cluster used for management.
:paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:keyword internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum
:keyword identity_sources: vCenter Single Sign On Identity Sources.
:paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:keyword availability: Properties describing how the cloud is distributed across availability
zones.
:paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:keyword encryption: Customer managed key encryption, can be enabled or disabled.
:paramtype encryption: ~azure.mgmt.avs.models.Encryption
:keyword extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:paramtype extended_network_blocks: list[str]
:keyword circuit: An ExpressRoute Circuit.
:paramtype circuit: ~azure.mgmt.avs.models.Circuit
:keyword network_block: The block of addresses should be unique across VNet in your
subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where
A,B,C,D are between 0 and 255, and X is between 0 and 22.
:paramtype network_block: str
:keyword vcenter_password: Optionally, set the vCenter admin password when the private cloud is
created.
:paramtype vcenter_password: str
:keyword nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is
created.
:paramtype nsxt_password: str
:keyword secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present
in a stretched private cloud.
:paramtype secondary_circuit: ~azure.mgmt.avs.models.Circuit
"""
super().__init__(location=location, tags=tags, **kwargs)
self.sku = sku
self.identity = identity
self.management_cluster = management_cluster
self.internet = internet
self.identity_sources = identity_sources
self.availability = availability
self.encryption = encryption
self.extended_network_blocks = extended_network_blocks
self.provisioning_state = None
self.circuit = circuit
self.endpoints = None
self.network_block = network_block
self.management_network = None
self.provisioning_network = None
self.vmotion_network = None
self.vcenter_password = vcenter_password
self.nsxt_password = nsxt_password
self.vcenter_certificate_thumbprint = None
self.nsxt_certificate_thumbprint = None
self.external_cloud_links = None
self.secondary_circuit = secondary_circuit
self.nsx_public_ip_quota_raised = None
class PrivateCloudIdentity(_serialization.Model):
"""Identity for the virtual machine.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar principal_id: The principal ID of private cloud identity. This property will only be
provided for a system assigned identity.
:vartype principal_id: str
:ivar tenant_id: The tenant ID associated with the private cloud. This property will only be
provided for a system assigned identity.
:vartype tenant_id: str
:ivar type: The type of identity used for the private cloud. The type 'SystemAssigned' refers
to an implicitly created identity. The type 'None' will remove any identities from the Private
Cloud. Known values are: "SystemAssigned" and "None".
:vartype type: str or ~azure.mgmt.avs.models.ResourceIdentityType
"""
_validation = {
"principal_id": {"readonly": True},
"tenant_id": {"readonly": True},
}
_attribute_map = {
"principal_id": {"key": "principalId", "type": "str"},
"tenant_id": {"key": "tenantId", "type": "str"},
"type": {"key": "type", "type": "str"},
}
def __init__(self, *, type: Optional[Union[str, "_models.ResourceIdentityType"]] = None, **kwargs: Any) -> None:
"""
:keyword type: The type of identity used for the private cloud. The type 'SystemAssigned'
refers to an implicitly created identity. The type 'None' will remove any identities from the
Private Cloud. Known values are: "SystemAssigned" and "None".
:paramtype type: str or ~azure.mgmt.avs.models.ResourceIdentityType
"""
super().__init__(**kwargs)
self.principal_id = None
self.tenant_id = None
self.type = type
class PrivateCloudList(_serialization.Model):
"""A paged list of private clouds.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.PrivateCloud]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[PrivateCloud]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class PrivateCloudUpdateProperties(_serialization.Model):
"""The properties of a private cloud resource that may be updated.
:ivar management_cluster: The default cluster used for management.
:vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:ivar internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype internet: str or ~azure.mgmt.avs.models.InternetEnum
:ivar identity_sources: vCenter Single Sign On Identity Sources.
:vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:ivar availability: Properties describing how the cloud is distributed across availability
zones.
:vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:ivar encryption: Customer managed key encryption, can be enabled or disabled.
:vartype encryption: ~azure.mgmt.avs.models.Encryption
:ivar extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:vartype extended_network_blocks: list[str]
"""
_attribute_map = {
"management_cluster": {"key": "managementCluster", "type": "ManagementCluster"},
"internet": {"key": "internet", "type": "str"},
"identity_sources": {"key": "identitySources", "type": "[IdentitySource]"},
"availability": {"key": "availability", "type": "AvailabilityProperties"},
"encryption": {"key": "encryption", "type": "Encryption"},
"extended_network_blocks": {"key": "extendedNetworkBlocks", "type": "[str]"},
}
def __init__(
self,
*,
management_cluster: Optional["_models.ManagementCluster"] = None,
internet: Union[str, "_models.InternetEnum"] = "Disabled",
identity_sources: Optional[List["_models.IdentitySource"]] = None,
availability: Optional["_models.AvailabilityProperties"] = None,
encryption: Optional["_models.Encryption"] = None,
extended_network_blocks: Optional[List[str]] = None,
**kwargs: Any
) -> None:
"""
:keyword management_cluster: The default cluster used for management.
:paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:keyword internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum
:keyword identity_sources: vCenter Single Sign On Identity Sources.
:paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:keyword availability: Properties describing how the cloud is distributed across availability
zones.
:paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:keyword encryption: Customer managed key encryption, can be enabled or disabled.
:paramtype encryption: ~azure.mgmt.avs.models.Encryption
:keyword extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:paramtype extended_network_blocks: list[str]
"""
super().__init__(**kwargs)
self.management_cluster = management_cluster
self.internet = internet
self.identity_sources = identity_sources
self.availability = availability
self.encryption = encryption
self.extended_network_blocks = extended_network_blocks
class PrivateCloudProperties(PrivateCloudUpdateProperties): # pylint: disable=too-many-instance-attributes
"""The properties of a private cloud resource.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar management_cluster: The default cluster used for management.
:vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:ivar internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype internet: str or ~azure.mgmt.avs.models.InternetEnum
:ivar identity_sources: vCenter Single Sign On Identity Sources.
:vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:ivar availability: Properties describing how the cloud is distributed across availability
zones.
:vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:ivar encryption: Customer managed key encryption, can be enabled or disabled.
:vartype encryption: ~azure.mgmt.avs.models.Encryption
:ivar extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:vartype extended_network_blocks: list[str]
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Cancelled", "Pending", "Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.PrivateCloudProvisioningState
:ivar circuit: An ExpressRoute Circuit.
:vartype circuit: ~azure.mgmt.avs.models.Circuit
:ivar endpoints: The endpoints.
:vartype endpoints: ~azure.mgmt.avs.models.Endpoints
:ivar network_block: The block of addresses should be unique across VNet in your subscription
as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where A,B,C,D are
between 0 and 255, and X is between 0 and 22. Required.
:vartype network_block: str
:ivar management_network: Network used to access vCenter Server and NSX-T Manager.
:vartype management_network: str
:ivar provisioning_network: Used for virtual machine cold migration, cloning, and snapshot
migration.
:vartype provisioning_network: str
:ivar vmotion_network: Used for live migration of virtual machines.
:vartype vmotion_network: str
:ivar vcenter_password: Optionally, set the vCenter admin password when the private cloud is
created.
:vartype vcenter_password: str
:ivar nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is
created.
:vartype nsxt_password: str
:ivar vcenter_certificate_thumbprint: Thumbprint of the vCenter Server SSL certificate.
:vartype vcenter_certificate_thumbprint: str
:ivar nsxt_certificate_thumbprint: Thumbprint of the NSX-T Manager SSL certificate.
:vartype nsxt_certificate_thumbprint: str
:ivar external_cloud_links: Array of cloud link IDs from other clouds that connect to this one.
:vartype external_cloud_links: list[str]
:ivar secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present in a
stretched private cloud.
:vartype secondary_circuit: ~azure.mgmt.avs.models.Circuit
:ivar nsx_public_ip_quota_raised: Flag to indicate whether the private cloud has the quota for
provisioned NSX Public IP count raised from 64 to 1024. Known values are: "Enabled" and
"Disabled".
:vartype nsx_public_ip_quota_raised: str or ~azure.mgmt.avs.models.NsxPublicIpQuotaRaisedEnum
"""
_validation = {
"provisioning_state": {"readonly": True},
"endpoints": {"readonly": True},
"network_block": {"required": True},
"management_network": {"readonly": True},
"provisioning_network": {"readonly": True},
"vmotion_network": {"readonly": True},
"vcenter_certificate_thumbprint": {"readonly": True},
"nsxt_certificate_thumbprint": {"readonly": True},
"external_cloud_links": {"readonly": True},
"nsx_public_ip_quota_raised": {"readonly": True},
}
_attribute_map = {
"management_cluster": {"key": "managementCluster", "type": "ManagementCluster"},
"internet": {"key": "internet", "type": "str"},
"identity_sources": {"key": "identitySources", "type": "[IdentitySource]"},
"availability": {"key": "availability", "type": "AvailabilityProperties"},
"encryption": {"key": "encryption", "type": "Encryption"},
"extended_network_blocks": {"key": "extendedNetworkBlocks", "type": "[str]"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"circuit": {"key": "circuit", "type": "Circuit"},
"endpoints": {"key": "endpoints", "type": "Endpoints"},
"network_block": {"key": "networkBlock", "type": "str"},
"management_network": {"key": "managementNetwork", "type": "str"},
"provisioning_network": {"key": "provisioningNetwork", "type": "str"},
"vmotion_network": {"key": "vmotionNetwork", "type": "str"},
"vcenter_password": {"key": "vcenterPassword", "type": "str"},
"nsxt_password": {"key": "nsxtPassword", "type": "str"},
"vcenter_certificate_thumbprint": {"key": "vcenterCertificateThumbprint", "type": "str"},
"nsxt_certificate_thumbprint": {"key": "nsxtCertificateThumbprint", "type": "str"},
"external_cloud_links": {"key": "externalCloudLinks", "type": "[str]"},
"secondary_circuit": {"key": "secondaryCircuit", "type": "Circuit"},
"nsx_public_ip_quota_raised": {"key": "nsxPublicIpQuotaRaised", "type": "str"},
}
def __init__(
self,
*,
network_block: str,
management_cluster: Optional["_models.ManagementCluster"] = None,
internet: Union[str, "_models.InternetEnum"] = "Disabled",
identity_sources: Optional[List["_models.IdentitySource"]] = None,
availability: Optional["_models.AvailabilityProperties"] = None,
encryption: Optional["_models.Encryption"] = None,
extended_network_blocks: Optional[List[str]] = None,
circuit: Optional["_models.Circuit"] = None,
vcenter_password: Optional[str] = None,
nsxt_password: Optional[str] = None,
secondary_circuit: Optional["_models.Circuit"] = None,
**kwargs: Any
) -> None:
"""
:keyword management_cluster: The default cluster used for management.
:paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:keyword internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum
:keyword identity_sources: vCenter Single Sign On Identity Sources.
:paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:keyword availability: Properties describing how the cloud is distributed across availability
zones.
:paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:keyword encryption: Customer managed key encryption, can be enabled or disabled.
:paramtype encryption: ~azure.mgmt.avs.models.Encryption
:keyword extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:paramtype extended_network_blocks: list[str]
:keyword circuit: An ExpressRoute Circuit.
:paramtype circuit: ~azure.mgmt.avs.models.Circuit
:keyword network_block: The block of addresses should be unique across VNet in your
subscription as well as on-premise. Make sure the CIDR format is conformed to (A.B.C.D/X) where
A,B,C,D are between 0 and 255, and X is between 0 and 22. Required.
:paramtype network_block: str
:keyword vcenter_password: Optionally, set the vCenter admin password when the private cloud is
created.
:paramtype vcenter_password: str
:keyword nsxt_password: Optionally, set the NSX-T Manager password when the private cloud is
created.
:paramtype nsxt_password: str
:keyword secondary_circuit: A secondary expressRoute circuit from a separate AZ. Only present
in a stretched private cloud.
:paramtype secondary_circuit: ~azure.mgmt.avs.models.Circuit
"""
super().__init__(
management_cluster=management_cluster,
internet=internet,
identity_sources=identity_sources,
availability=availability,
encryption=encryption,
extended_network_blocks=extended_network_blocks,
**kwargs
)
self.provisioning_state = None
self.circuit = circuit
self.endpoints = None
self.network_block = network_block
self.management_network = None
self.provisioning_network = None
self.vmotion_network = None
self.vcenter_password = vcenter_password
self.nsxt_password = nsxt_password
self.vcenter_certificate_thumbprint = None
self.nsxt_certificate_thumbprint = None
self.external_cloud_links = None
self.secondary_circuit = secondary_circuit
self.nsx_public_ip_quota_raised = None
class PrivateCloudUpdate(_serialization.Model):
"""An update to a private cloud resource.
:ivar tags: Resource tags.
:vartype tags: dict[str, str]
:ivar identity: The identity of the private cloud, if configured.
:vartype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity
:ivar management_cluster: The default cluster used for management.
:vartype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:ivar internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype internet: str or ~azure.mgmt.avs.models.InternetEnum
:ivar identity_sources: vCenter Single Sign On Identity Sources.
:vartype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:ivar availability: Properties describing how the cloud is distributed across availability
zones.
:vartype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:ivar encryption: Customer managed key encryption, can be enabled or disabled.
:vartype encryption: ~azure.mgmt.avs.models.Encryption
:ivar extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:vartype extended_network_blocks: list[str]
"""
_attribute_map = {
"tags": {"key": "tags", "type": "{str}"},
"identity": {"key": "identity", "type": "PrivateCloudIdentity"},
"management_cluster": {"key": "properties.managementCluster", "type": "ManagementCluster"},
"internet": {"key": "properties.internet", "type": "str"},
"identity_sources": {"key": "properties.identitySources", "type": "[IdentitySource]"},
"availability": {"key": "properties.availability", "type": "AvailabilityProperties"},
"encryption": {"key": "properties.encryption", "type": "Encryption"},
"extended_network_blocks": {"key": "properties.extendedNetworkBlocks", "type": "[str]"},
}
def __init__(
self,
*,
tags: Optional[Dict[str, str]] = None,
identity: Optional["_models.PrivateCloudIdentity"] = None,
management_cluster: Optional["_models.ManagementCluster"] = None,
internet: Union[str, "_models.InternetEnum"] = "Disabled",
identity_sources: Optional[List["_models.IdentitySource"]] = None,
availability: Optional["_models.AvailabilityProperties"] = None,
encryption: Optional["_models.Encryption"] = None,
extended_network_blocks: Optional[List[str]] = None,
**kwargs: Any
) -> None:
"""
:keyword tags: Resource tags.
:paramtype tags: dict[str, str]
:keyword identity: The identity of the private cloud, if configured.
:paramtype identity: ~azure.mgmt.avs.models.PrivateCloudIdentity
:keyword management_cluster: The default cluster used for management.
:paramtype management_cluster: ~azure.mgmt.avs.models.ManagementCluster
:keyword internet: Connectivity to internet is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:paramtype internet: str or ~azure.mgmt.avs.models.InternetEnum
:keyword identity_sources: vCenter Single Sign On Identity Sources.
:paramtype identity_sources: list[~azure.mgmt.avs.models.IdentitySource]
:keyword availability: Properties describing how the cloud is distributed across availability
zones.
:paramtype availability: ~azure.mgmt.avs.models.AvailabilityProperties
:keyword encryption: Customer managed key encryption, can be enabled or disabled.
:paramtype encryption: ~azure.mgmt.avs.models.Encryption
:keyword extended_network_blocks: Array of additional networks noncontiguous with networkBlock.
Networks must be unique and non-overlapping across VNet in your subscription, on-premise, and
this privateCloud networkBlock attribute. Make sure the CIDR format conforms to (A.B.C.D/X).
:paramtype extended_network_blocks: list[str]
"""
super().__init__(**kwargs)
self.tags = tags
self.identity = identity
self.management_cluster = management_cluster
self.internet = internet
self.identity_sources = identity_sources
self.availability = availability
self.encryption = encryption
self.extended_network_blocks = extended_network_blocks
class ProxyResource(Resource):
"""The resource model definition for a ARM proxy resource.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: 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"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
class ScriptExecutionParameter(_serialization.Model):
"""The arguments passed in to the execution.
You probably want to use the sub-classes and not this class directly. Known sub-classes are:
PSCredentialExecutionParameter, ScriptSecureStringExecutionParameter,
ScriptStringExecutionParameter
All required parameters must be populated in order to send to Azure.
:ivar name: The parameter name. Required.
:vartype name: str
:ivar type: The type of execution parameter. Required. Known values are: "Value",
"SecureValue", and "Credential".
:vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType
"""
_validation = {
"name": {"required": True},
"type": {"required": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
}
_subtype_map = {
"type": {
"Credential": "PSCredentialExecutionParameter",
"SecureValue": "ScriptSecureStringExecutionParameter",
"Value": "ScriptStringExecutionParameter",
}
}
def __init__(self, *, name: str, **kwargs: Any) -> None:
"""
:keyword name: The parameter name. Required.
:paramtype name: str
"""
super().__init__(**kwargs)
self.name = name
self.type: Optional[str] = None
class PSCredentialExecutionParameter(ScriptExecutionParameter):
"""a powershell credential object.
All required parameters must be populated in order to send to Azure.
:ivar name: The parameter name. Required.
:vartype name: str
:ivar type: The type of execution parameter. Required. Known values are: "Value",
"SecureValue", and "Credential".
:vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType
:ivar username: username for login.
:vartype username: str
:ivar password: password for login.
:vartype password: str
"""
_validation = {
"name": {"required": True},
"type": {"required": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"username": {"key": "username", "type": "str"},
"password": {"key": "password", "type": "str"},
}
def __init__(
self, *, name: str, username: Optional[str] = None, password: Optional[str] = None, **kwargs: Any
) -> None:
"""
:keyword name: The parameter name. Required.
:paramtype name: str
:keyword username: username for login.
:paramtype username: str
:keyword password: password for login.
:paramtype password: str
"""
super().__init__(name=name, **kwargs)
self.type: str = "Credential"
self.username = username
self.password = password
class Quota(_serialization.Model):
"""Subscription quotas.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar hosts_remaining: Remaining hosts quota by sku type.
:vartype hosts_remaining: dict[str, int]
:ivar quota_enabled: Host quota is active for current subscription. Known values are: "Enabled"
and "Disabled".
:vartype quota_enabled: str or ~azure.mgmt.avs.models.QuotaEnabled
"""
_validation = {
"hosts_remaining": {"readonly": True},
"quota_enabled": {"readonly": True},
}
_attribute_map = {
"hosts_remaining": {"key": "hostsRemaining", "type": "{int}"},
"quota_enabled": {"key": "quotaEnabled", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.hosts_remaining = None
self.quota_enabled = None
class ScriptCmdlet(ProxyResource):
"""A cmdlet available for script execution.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar description: Description of the scripts functionality.
:vartype description: str
:ivar timeout: Recommended time limit for execution.
:vartype timeout: str
:ivar parameters: Parameters the script will accept.
:vartype parameters: list[~azure.mgmt.avs.models.ScriptParameter]
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"description": {"readonly": True},
"timeout": {"readonly": True},
"parameters": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"description": {"key": "properties.description", "type": "str"},
"timeout": {"key": "properties.timeout", "type": "str"},
"parameters": {"key": "properties.parameters", "type": "[ScriptParameter]"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.description = None
self.timeout = None
self.parameters = None
class ScriptCmdletsList(_serialization.Model):
"""Pageable list of scripts/cmdlets.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of scripts.
:vartype value: list[~azure.mgmt.avs.models.ScriptCmdlet]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[ScriptCmdlet]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class ScriptExecution(ProxyResource): # pylint: disable=too-many-instance-attributes
"""An instance of a script executed by a user - custom or AVS.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar script_cmdlet_id: A reference to the script cmdlet resource if user is running a AVS
script.
:vartype script_cmdlet_id: str
:ivar parameters: Parameters the script will accept.
:vartype parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter]
:ivar hidden_parameters: Parameters that will be hidden/not visible to ARM, such as passwords
and credentials.
:vartype hidden_parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter]
:ivar failure_reason: Error message if the script was able to run, but if the script itself had
errors or powershell threw an exception.
:vartype failure_reason: str
:ivar timeout: Time limit for execution.
:vartype timeout: str
:ivar retention: Time to live for the resource. If not provided, will be available for 60 days.
:vartype retention: str
:ivar submitted_at: Time the script execution was submitted.
:vartype submitted_at: ~datetime.datetime
:ivar started_at: Time the script execution was started.
:vartype started_at: ~datetime.datetime
:ivar finished_at: Time the script execution was finished.
:vartype finished_at: ~datetime.datetime
:ivar provisioning_state: The state of the script execution resource. Known values are:
"Pending", "Running", "Succeeded", "Failed", "Cancelling", "Cancelled", "Deleting", and
"Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.ScriptExecutionProvisioningState
:ivar output: Standard output stream from the powershell execution.
:vartype output: list[str]
:ivar named_outputs: User-defined dictionary.
:vartype named_outputs: dict[str, JSON]
:ivar information: Standard information out stream from the powershell execution.
:vartype information: list[str]
:ivar warnings: Standard warning out stream from the powershell execution.
:vartype warnings: list[str]
:ivar errors: Standard error output stream from the powershell execution.
:vartype errors: list[str]
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"submitted_at": {"readonly": True},
"started_at": {"readonly": True},
"finished_at": {"readonly": True},
"provisioning_state": {"readonly": True},
"information": {"readonly": True},
"warnings": {"readonly": True},
"errors": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"script_cmdlet_id": {"key": "properties.scriptCmdletId", "type": "str"},
"parameters": {"key": "properties.parameters", "type": "[ScriptExecutionParameter]"},
"hidden_parameters": {"key": "properties.hiddenParameters", "type": "[ScriptExecutionParameter]"},
"failure_reason": {"key": "properties.failureReason", "type": "str"},
"timeout": {"key": "properties.timeout", "type": "str"},
"retention": {"key": "properties.retention", "type": "str"},
"submitted_at": {"key": "properties.submittedAt", "type": "iso-8601"},
"started_at": {"key": "properties.startedAt", "type": "iso-8601"},
"finished_at": {"key": "properties.finishedAt", "type": "iso-8601"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"output": {"key": "properties.output", "type": "[str]"},
"named_outputs": {"key": "properties.namedOutputs", "type": "{object}"},
"information": {"key": "properties.information", "type": "[str]"},
"warnings": {"key": "properties.warnings", "type": "[str]"},
"errors": {"key": "properties.errors", "type": "[str]"},
}
def __init__(
self,
*,
script_cmdlet_id: Optional[str] = None,
parameters: Optional[List["_models.ScriptExecutionParameter"]] = None,
hidden_parameters: Optional[List["_models.ScriptExecutionParameter"]] = None,
failure_reason: Optional[str] = None,
timeout: Optional[str] = None,
retention: Optional[str] = None,
output: Optional[List[str]] = None,
named_outputs: Optional[Dict[str, JSON]] = None,
**kwargs: Any
) -> None:
"""
:keyword script_cmdlet_id: A reference to the script cmdlet resource if user is running a AVS
script.
:paramtype script_cmdlet_id: str
:keyword parameters: Parameters the script will accept.
:paramtype parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter]
:keyword hidden_parameters: Parameters that will be hidden/not visible to ARM, such as
passwords and credentials.
:paramtype hidden_parameters: list[~azure.mgmt.avs.models.ScriptExecutionParameter]
:keyword failure_reason: Error message if the script was able to run, but if the script itself
had errors or powershell threw an exception.
:paramtype failure_reason: str
:keyword timeout: Time limit for execution.
:paramtype timeout: str
:keyword retention: Time to live for the resource. If not provided, will be available for 60
days.
:paramtype retention: str
:keyword output: Standard output stream from the powershell execution.
:paramtype output: list[str]
:keyword named_outputs: User-defined dictionary.
:paramtype named_outputs: dict[str, JSON]
"""
super().__init__(**kwargs)
self.script_cmdlet_id = script_cmdlet_id
self.parameters = parameters
self.hidden_parameters = hidden_parameters
self.failure_reason = failure_reason
self.timeout = timeout
self.retention = retention
self.submitted_at = None
self.started_at = None
self.finished_at = None
self.provisioning_state = None
self.output = output
self.named_outputs = named_outputs
self.information = None
self.warnings = None
self.errors = None
class ScriptExecutionsList(_serialization.Model):
"""Pageable list of script executions.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of scripts.
:vartype value: list[~azure.mgmt.avs.models.ScriptExecution]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[ScriptExecution]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class ScriptPackage(ProxyResource):
"""Script Package resources available for execution.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar description: User friendly description of the package.
:vartype description: str
:ivar version: Module version.
:vartype version: str
:ivar company: Company that created and supports the package.
:vartype company: str
:ivar uri: Link to support by the package vendor.
:vartype uri: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"description": {"readonly": True},
"version": {"readonly": True},
"company": {"readonly": True},
"uri": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"description": {"key": "properties.description", "type": "str"},
"version": {"key": "properties.version", "type": "str"},
"company": {"key": "properties.company", "type": "str"},
"uri": {"key": "properties.uri", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.description = None
self.version = None
self.company = None
self.uri = None
class ScriptPackagesList(_serialization.Model):
"""A list of the available script packages.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: List of script package resources.
:vartype value: list[~azure.mgmt.avs.models.ScriptPackage]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[ScriptPackage]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class ScriptParameter(_serialization.Model):
"""An parameter that the script will accept.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar type: The type of parameter the script is expecting. psCredential is a
PSCredentialObject. Known values are: "String", "SecureString", "Credential", "Int", "Bool",
and "Float".
:vartype type: str or ~azure.mgmt.avs.models.ScriptParameterTypes
:ivar name: The parameter name that the script will expect a parameter value for.
:vartype name: str
:ivar description: User friendly description of the parameter.
:vartype description: str
:ivar visibility: Should this parameter be visible to arm and passed in the parameters argument
when executing. Known values are: "Visible" and "Hidden".
:vartype visibility: str or ~azure.mgmt.avs.models.VisibilityParameterEnum
:ivar optional: Is this parameter required or optional. Known values are: "Optional" and
"Required".
:vartype optional: str or ~azure.mgmt.avs.models.OptionalParamEnum
"""
_validation = {
"type": {"readonly": True},
"description": {"readonly": True},
"visibility": {"readonly": True},
"optional": {"readonly": True},
}
_attribute_map = {
"type": {"key": "type", "type": "str"},
"name": {"key": "name", "type": "str"},
"description": {"key": "description", "type": "str"},
"visibility": {"key": "visibility", "type": "str"},
"optional": {"key": "optional", "type": "str"},
}
def __init__(self, *, name: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword name: The parameter name that the script will expect a parameter value for.
:paramtype name: str
"""
super().__init__(**kwargs)
self.type = None
self.name = name
self.description = None
self.visibility = None
self.optional = None
class ScriptSecureStringExecutionParameter(ScriptExecutionParameter):
"""a plain text value execution parameter.
All required parameters must be populated in order to send to Azure.
:ivar name: The parameter name. Required.
:vartype name: str
:ivar type: The type of execution parameter. Required. Known values are: "Value",
"SecureValue", and "Credential".
:vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType
:ivar secure_value: A secure value for the passed parameter, not to be stored in logs.
:vartype secure_value: str
"""
_validation = {
"name": {"required": True},
"type": {"required": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"secure_value": {"key": "secureValue", "type": "str"},
}
def __init__(self, *, name: str, secure_value: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword name: The parameter name. Required.
:paramtype name: str
:keyword secure_value: A secure value for the passed parameter, not to be stored in logs.
:paramtype secure_value: str
"""
super().__init__(name=name, **kwargs)
self.type: str = "SecureValue"
self.secure_value = secure_value
class ScriptStringExecutionParameter(ScriptExecutionParameter):
"""a plain text value execution parameter.
All required parameters must be populated in order to send to Azure.
:ivar name: The parameter name. Required.
:vartype name: str
:ivar type: The type of execution parameter. Required. Known values are: "Value",
"SecureValue", and "Credential".
:vartype type: str or ~azure.mgmt.avs.models.ScriptExecutionParameterType
:ivar value: The value for the passed parameter.
:vartype value: str
"""
_validation = {
"name": {"required": True},
"type": {"required": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"value": {"key": "value", "type": "str"},
}
def __init__(self, *, name: str, value: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword name: The parameter name. Required.
:paramtype name: str
:keyword value: The value for the passed parameter.
:paramtype value: str
"""
super().__init__(name=name, **kwargs)
self.type: str = "Value"
self.value = value
class ServiceSpecification(_serialization.Model):
"""Service specification payload.
:ivar log_specifications: Specifications of the Log for Azure Monitoring.
:vartype log_specifications: list[~azure.mgmt.avs.models.LogSpecification]
:ivar metric_specifications: Specifications of the Metrics for Azure Monitoring.
:vartype metric_specifications: list[~azure.mgmt.avs.models.MetricSpecification]
"""
_attribute_map = {
"log_specifications": {"key": "logSpecifications", "type": "[LogSpecification]"},
"metric_specifications": {"key": "metricSpecifications", "type": "[MetricSpecification]"},
}
def __init__(
self,
*,
log_specifications: Optional[List["_models.LogSpecification"]] = None,
metric_specifications: Optional[List["_models.MetricSpecification"]] = None,
**kwargs: Any
) -> None:
"""
:keyword log_specifications: Specifications of the Log for Azure Monitoring.
:paramtype log_specifications: list[~azure.mgmt.avs.models.LogSpecification]
:keyword metric_specifications: Specifications of the Metrics for Azure Monitoring.
:paramtype metric_specifications: list[~azure.mgmt.avs.models.MetricSpecification]
"""
super().__init__(**kwargs)
self.log_specifications = log_specifications
self.metric_specifications = metric_specifications
class Sku(_serialization.Model):
"""The resource model definition representing SKU.
All required parameters must be populated in order to send to Azure.
:ivar name: The name of the SKU. Required.
:vartype name: str
"""
_validation = {
"name": {"required": True},
}
_attribute_map = {
"name": {"key": "name", "type": "str"},
}
def __init__(self, *, name: str, **kwargs: Any) -> None:
"""
:keyword name: The name of the SKU. Required.
:paramtype name: str
"""
super().__init__(**kwargs)
self.name = name
class Trial(_serialization.Model):
"""Subscription trial availability.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar status: Trial status. Known values are: "TrialAvailable", "TrialUsed", and
"TrialDisabled".
:vartype status: str or ~azure.mgmt.avs.models.TrialStatus
:ivar available_hosts: Number of trial hosts available.
:vartype available_hosts: int
"""
_validation = {
"status": {"readonly": True},
"available_hosts": {"readonly": True},
}
_attribute_map = {
"status": {"key": "status", "type": "str"},
"available_hosts": {"key": "availableHosts", "type": "int"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.status = None
self.available_hosts = None
class VirtualMachine(ProxyResource):
"""Virtual Machine.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the VM.
:vartype display_name: str
:ivar mo_ref_id: Virtual machine managed object reference id.
:vartype mo_ref_id: str
:ivar folder_path: Path to virtual machine's folder starting from datacenter virtual machine
folder.
:vartype folder_path: str
:ivar restrict_movement: Whether VM DRS-driven movement is restricted (enabled) or not
(disabled). Known values are: "Enabled" and "Disabled".
:vartype restrict_movement: str or ~azure.mgmt.avs.models.VirtualMachineRestrictMovementState
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"display_name": {"readonly": True},
"mo_ref_id": {"readonly": True},
"folder_path": {"readonly": True},
"restrict_movement": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"mo_ref_id": {"key": "properties.moRefId", "type": "str"},
"folder_path": {"key": "properties.folderPath", "type": "str"},
"restrict_movement": {"key": "properties.restrictMovement", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.display_name = None
self.mo_ref_id = None
self.folder_path = None
self.restrict_movement = None
class VirtualMachineRestrictMovement(_serialization.Model):
"""Set VM DRS-driven movement to restricted (enabled) or not (disabled).
:ivar restrict_movement: Whether VM DRS-driven movement is restricted (enabled) or not
(disabled). Known values are: "Enabled" and "Disabled".
:vartype restrict_movement: str or ~azure.mgmt.avs.models.VirtualMachineRestrictMovementState
"""
_attribute_map = {
"restrict_movement": {"key": "restrictMovement", "type": "str"},
}
def __init__(
self,
*,
restrict_movement: Optional[Union[str, "_models.VirtualMachineRestrictMovementState"]] = None,
**kwargs: Any
) -> None:
"""
:keyword restrict_movement: Whether VM DRS-driven movement is restricted (enabled) or not
(disabled). Known values are: "Enabled" and "Disabled".
:paramtype restrict_movement: str or ~azure.mgmt.avs.models.VirtualMachineRestrictMovementState
"""
super().__init__(**kwargs)
self.restrict_movement = restrict_movement
class VirtualMachinesList(_serialization.Model):
"""A list of Virtual Machines.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items to be displayed on the page.
:vartype value: list[~azure.mgmt.avs.models.VirtualMachine]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[VirtualMachine]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class VmHostPlacementPolicyProperties(PlacementPolicyProperties):
"""VM-Host placement policy properties.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar type: placement policy type. Required. Known values are: "VmVm" and "VmHost".
:vartype type: str or ~azure.mgmt.avs.models.PlacementPolicyType
:ivar state: Whether the placement policy is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:ivar display_name: Display name of the placement policy.
:vartype display_name: str
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState
:ivar vm_members: Virtual machine members list. Required.
:vartype vm_members: list[str]
:ivar host_members: Host members list. Required.
:vartype host_members: list[str]
:ivar affinity_type: placement policy affinity type. Required. Known values are: "Affinity" and
"AntiAffinity".
:vartype affinity_type: str or ~azure.mgmt.avs.models.AffinityType
:ivar affinity_strength: vm-host placement policy affinity strength (should/must). Known values
are: "Should" and "Must".
:vartype affinity_strength: str or ~azure.mgmt.avs.models.AffinityStrength
:ivar azure_hybrid_benefit_type: placement policy azure hybrid benefit opt-in type. Known
values are: "SqlHost" and "None".
:vartype azure_hybrid_benefit_type: str or ~azure.mgmt.avs.models.AzureHybridBenefitType
"""
_validation = {
"type": {"required": True},
"provisioning_state": {"readonly": True},
"vm_members": {"required": True},
"host_members": {"required": True},
"affinity_type": {"required": True},
}
_attribute_map = {
"type": {"key": "type", "type": "str"},
"state": {"key": "state", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"vm_members": {"key": "vmMembers", "type": "[str]"},
"host_members": {"key": "hostMembers", "type": "[str]"},
"affinity_type": {"key": "affinityType", "type": "str"},
"affinity_strength": {"key": "affinityStrength", "type": "str"},
"azure_hybrid_benefit_type": {"key": "azureHybridBenefitType", "type": "str"},
}
def __init__(
self,
*,
vm_members: List[str],
host_members: List[str],
affinity_type: Union[str, "_models.AffinityType"],
state: Optional[Union[str, "_models.PlacementPolicyState"]] = None,
display_name: Optional[str] = None,
affinity_strength: Optional[Union[str, "_models.AffinityStrength"]] = None,
azure_hybrid_benefit_type: Optional[Union[str, "_models.AzureHybridBenefitType"]] = None,
**kwargs: Any
) -> None:
"""
:keyword state: Whether the placement policy is enabled or disabled. Known values are:
"Enabled" and "Disabled".
:paramtype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:keyword display_name: Display name of the placement policy.
:paramtype display_name: str
:keyword vm_members: Virtual machine members list. Required.
:paramtype vm_members: list[str]
:keyword host_members: Host members list. Required.
:paramtype host_members: list[str]
:keyword affinity_type: placement policy affinity type. Required. Known values are: "Affinity"
and "AntiAffinity".
:paramtype affinity_type: str or ~azure.mgmt.avs.models.AffinityType
:keyword affinity_strength: vm-host placement policy affinity strength (should/must). Known
values are: "Should" and "Must".
:paramtype affinity_strength: str or ~azure.mgmt.avs.models.AffinityStrength
:keyword azure_hybrid_benefit_type: placement policy azure hybrid benefit opt-in type. Known
values are: "SqlHost" and "None".
:paramtype azure_hybrid_benefit_type: str or ~azure.mgmt.avs.models.AzureHybridBenefitType
"""
super().__init__(state=state, display_name=display_name, **kwargs)
self.type: str = "VmHost"
self.vm_members = vm_members
self.host_members = host_members
self.affinity_type = affinity_type
self.affinity_strength = affinity_strength
self.azure_hybrid_benefit_type = azure_hybrid_benefit_type
class VmPlacementPolicyProperties(PlacementPolicyProperties):
"""VM-VM placement policy properties.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar type: placement policy type. Required. Known values are: "VmVm" and "VmHost".
:vartype type: str or ~azure.mgmt.avs.models.PlacementPolicyType
:ivar state: Whether the placement policy is enabled or disabled. Known values are: "Enabled"
and "Disabled".
:vartype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:ivar display_name: Display name of the placement policy.
:vartype display_name: str
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.PlacementPolicyProvisioningState
:ivar vm_members: Virtual machine members list. Required.
:vartype vm_members: list[str]
:ivar affinity_type: placement policy affinity type. Required. Known values are: "Affinity" and
"AntiAffinity".
:vartype affinity_type: str or ~azure.mgmt.avs.models.AffinityType
"""
_validation = {
"type": {"required": True},
"provisioning_state": {"readonly": True},
"vm_members": {"required": True},
"affinity_type": {"required": True},
}
_attribute_map = {
"type": {"key": "type", "type": "str"},
"state": {"key": "state", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"vm_members": {"key": "vmMembers", "type": "[str]"},
"affinity_type": {"key": "affinityType", "type": "str"},
}
def __init__(
self,
*,
vm_members: List[str],
affinity_type: Union[str, "_models.AffinityType"],
state: Optional[Union[str, "_models.PlacementPolicyState"]] = None,
display_name: Optional[str] = None,
**kwargs: Any
) -> None:
"""
:keyword state: Whether the placement policy is enabled or disabled. Known values are:
"Enabled" and "Disabled".
:paramtype state: str or ~azure.mgmt.avs.models.PlacementPolicyState
:keyword display_name: Display name of the placement policy.
:paramtype display_name: str
:keyword vm_members: Virtual machine members list. Required.
:paramtype vm_members: list[str]
:keyword affinity_type: placement policy affinity type. Required. Known values are: "Affinity"
and "AntiAffinity".
:paramtype affinity_type: str or ~azure.mgmt.avs.models.AffinityType
"""
super().__init__(state=state, display_name=display_name, **kwargs)
self.type: str = "VmVm"
self.vm_members = vm_members
self.affinity_type = affinity_type
class WorkloadNetwork(ProxyResource):
"""Workload Network.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: 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"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
class WorkloadNetworkDhcp(ProxyResource):
"""NSX DHCP.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar properties: DHCP properties.
:vartype properties: ~azure.mgmt.avs.models.WorkloadNetworkDhcpEntity
"""
_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"},
"properties": {"key": "properties", "type": "WorkloadNetworkDhcpEntity"},
}
def __init__(self, *, properties: Optional["_models.WorkloadNetworkDhcpEntity"] = None, **kwargs: Any) -> None:
"""
:keyword properties: DHCP properties.
:paramtype properties: ~azure.mgmt.avs.models.WorkloadNetworkDhcpEntity
"""
super().__init__(**kwargs)
self.properties = properties
class WorkloadNetworkDhcpEntity(_serialization.Model):
"""Base class for WorkloadNetworkDhcpServer and WorkloadNetworkDhcpRelay to inherit from.
You probably want to use the sub-classes and not this class directly. Known sub-classes are:
WorkloadNetworkDhcpRelay, WorkloadNetworkDhcpServer
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar dhcp_type: Type of DHCP: SERVER or RELAY. Required. Known values are: "SERVER" and
"RELAY".
:vartype dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum
:ivar display_name: Display name of the DHCP entity.
:vartype display_name: str
:ivar segments: NSX Segments consuming DHCP.
:vartype segments: list[str]
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
"""
_validation = {
"dhcp_type": {"required": True},
"segments": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"dhcp_type": {"key": "dhcpType", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"segments": {"key": "segments", "type": "[str]"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"revision": {"key": "revision", "type": "int"},
}
_subtype_map = {"dhcp_type": {"RELAY": "WorkloadNetworkDhcpRelay", "SERVER": "WorkloadNetworkDhcpServer"}}
def __init__(self, *, display_name: Optional[str] = None, revision: Optional[int] = None, **kwargs: Any) -> None:
"""
:keyword display_name: Display name of the DHCP entity.
:paramtype display_name: str
:keyword revision: NSX revision number.
:paramtype revision: int
"""
super().__init__(**kwargs)
self.dhcp_type: Optional[str] = None
self.display_name = display_name
self.segments = None
self.provisioning_state = None
self.revision = revision
class WorkloadNetworkDhcpList(_serialization.Model):
"""A list of NSX dhcp entities.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDhcp]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkDhcp]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkDhcpRelay(WorkloadNetworkDhcpEntity):
"""NSX DHCP Relay.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar dhcp_type: Type of DHCP: SERVER or RELAY. Required. Known values are: "SERVER" and
"RELAY".
:vartype dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum
:ivar display_name: Display name of the DHCP entity.
:vartype display_name: str
:ivar segments: NSX Segments consuming DHCP.
:vartype segments: list[str]
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
:ivar server_addresses: DHCP Relay Addresses. Max 3.
:vartype server_addresses: list[str]
"""
_validation = {
"dhcp_type": {"required": True},
"segments": {"readonly": True},
"provisioning_state": {"readonly": True},
"server_addresses": {"max_items": 3, "min_items": 1},
}
_attribute_map = {
"dhcp_type": {"key": "dhcpType", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"segments": {"key": "segments", "type": "[str]"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"revision": {"key": "revision", "type": "int"},
"server_addresses": {"key": "serverAddresses", "type": "[str]"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
revision: Optional[int] = None,
server_addresses: Optional[List[str]] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the DHCP entity.
:paramtype display_name: str
:keyword revision: NSX revision number.
:paramtype revision: int
:keyword server_addresses: DHCP Relay Addresses. Max 3.
:paramtype server_addresses: list[str]
"""
super().__init__(display_name=display_name, revision=revision, **kwargs)
self.dhcp_type: str = "RELAY"
self.server_addresses = server_addresses
class WorkloadNetworkDhcpServer(WorkloadNetworkDhcpEntity):
"""NSX DHCP Server.
Variables are only populated by the server, and will be ignored when sending a request.
All required parameters must be populated in order to send to Azure.
:ivar dhcp_type: Type of DHCP: SERVER or RELAY. Required. Known values are: "SERVER" and
"RELAY".
:vartype dhcp_type: str or ~azure.mgmt.avs.models.DhcpTypeEnum
:ivar display_name: Display name of the DHCP entity.
:vartype display_name: str
:ivar segments: NSX Segments consuming DHCP.
:vartype segments: list[str]
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or ~azure.mgmt.avs.models.WorkloadNetworkDhcpProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
:ivar server_address: DHCP Server Address.
:vartype server_address: str
:ivar lease_time: DHCP Server Lease Time.
:vartype lease_time: int
"""
_validation = {
"dhcp_type": {"required": True},
"segments": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"dhcp_type": {"key": "dhcpType", "type": "str"},
"display_name": {"key": "displayName", "type": "str"},
"segments": {"key": "segments", "type": "[str]"},
"provisioning_state": {"key": "provisioningState", "type": "str"},
"revision": {"key": "revision", "type": "int"},
"server_address": {"key": "serverAddress", "type": "str"},
"lease_time": {"key": "leaseTime", "type": "int"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
revision: Optional[int] = None,
server_address: Optional[str] = None,
lease_time: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the DHCP entity.
:paramtype display_name: str
:keyword revision: NSX revision number.
:paramtype revision: int
:keyword server_address: DHCP Server Address.
:paramtype server_address: str
:keyword lease_time: DHCP Server Lease Time.
:paramtype lease_time: int
"""
super().__init__(display_name=display_name, revision=revision, **kwargs)
self.dhcp_type: str = "SERVER"
self.server_address = server_address
self.lease_time = lease_time
class WorkloadNetworkDnsService(ProxyResource): # pylint: disable=too-many-instance-attributes
"""NSX DNS Service.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the DNS Service.
:vartype display_name: str
:ivar dns_service_ip: DNS service IP of the DNS Service.
:vartype dns_service_ip: str
:ivar default_dns_zone: Default DNS zone of the DNS Service.
:vartype default_dns_zone: str
:ivar fqdn_zones: FQDN zones of the DNS Service.
:vartype fqdn_zones: list[str]
:ivar log_level: DNS Service log level. Known values are: "DEBUG", "INFO", "WARNING", "ERROR",
and "FATAL".
:vartype log_level: str or ~azure.mgmt.avs.models.DnsServiceLogLevelEnum
:ivar status: DNS Service status. Known values are: "SUCCESS" and "FAILURE".
:vartype status: str or ~azure.mgmt.avs.models.DnsServiceStatusEnum
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.WorkloadNetworkDnsServiceProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"status": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"dns_service_ip": {"key": "properties.dnsServiceIp", "type": "str"},
"default_dns_zone": {"key": "properties.defaultDnsZone", "type": "str"},
"fqdn_zones": {"key": "properties.fqdnZones", "type": "[str]"},
"log_level": {"key": "properties.logLevel", "type": "str"},
"status": {"key": "properties.status", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"revision": {"key": "properties.revision", "type": "int"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
dns_service_ip: Optional[str] = None,
default_dns_zone: Optional[str] = None,
fqdn_zones: Optional[List[str]] = None,
log_level: Optional[Union[str, "_models.DnsServiceLogLevelEnum"]] = None,
revision: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the DNS Service.
:paramtype display_name: str
:keyword dns_service_ip: DNS service IP of the DNS Service.
:paramtype dns_service_ip: str
:keyword default_dns_zone: Default DNS zone of the DNS Service.
:paramtype default_dns_zone: str
:keyword fqdn_zones: FQDN zones of the DNS Service.
:paramtype fqdn_zones: list[str]
:keyword log_level: DNS Service log level. Known values are: "DEBUG", "INFO", "WARNING",
"ERROR", and "FATAL".
:paramtype log_level: str or ~azure.mgmt.avs.models.DnsServiceLogLevelEnum
:keyword revision: NSX revision number.
:paramtype revision: int
"""
super().__init__(**kwargs)
self.display_name = display_name
self.dns_service_ip = dns_service_ip
self.default_dns_zone = default_dns_zone
self.fqdn_zones = fqdn_zones
self.log_level = log_level
self.status = None
self.provisioning_state = None
self.revision = revision
class WorkloadNetworkDnsServicesList(_serialization.Model):
"""A list of NSX DNS Services.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsService]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkDnsService]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkDnsZone(ProxyResource):
"""NSX DNS Zone.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the DNS Zone.
:vartype display_name: str
:ivar domain: Domain names of the DNS Zone.
:vartype domain: list[str]
:ivar dns_server_ips: DNS Server IP array of the DNS Zone.
:vartype dns_server_ips: list[str]
:ivar source_ip: Source IP of the DNS Zone.
:vartype source_ip: str
:ivar dns_services: Number of DNS Services using the DNS zone.
:vartype dns_services: int
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.WorkloadNetworkDnsZoneProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"domain": {"key": "properties.domain", "type": "[str]"},
"dns_server_ips": {"key": "properties.dnsServerIps", "type": "[str]"},
"source_ip": {"key": "properties.sourceIp", "type": "str"},
"dns_services": {"key": "properties.dnsServices", "type": "int"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"revision": {"key": "properties.revision", "type": "int"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
domain: Optional[List[str]] = None,
dns_server_ips: Optional[List[str]] = None,
source_ip: Optional[str] = None,
dns_services: Optional[int] = None,
revision: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the DNS Zone.
:paramtype display_name: str
:keyword domain: Domain names of the DNS Zone.
:paramtype domain: list[str]
:keyword dns_server_ips: DNS Server IP array of the DNS Zone.
:paramtype dns_server_ips: list[str]
:keyword source_ip: Source IP of the DNS Zone.
:paramtype source_ip: str
:keyword dns_services: Number of DNS Services using the DNS zone.
:paramtype dns_services: int
:keyword revision: NSX revision number.
:paramtype revision: int
"""
super().__init__(**kwargs)
self.display_name = display_name
self.domain = domain
self.dns_server_ips = dns_server_ips
self.source_ip = source_ip
self.dns_services = dns_services
self.provisioning_state = None
self.revision = revision
class WorkloadNetworkDnsZonesList(_serialization.Model):
"""A list of NSX DNS Zones.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkDnsZone]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkDnsZone]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkGateway(ProxyResource):
"""NSX Gateway.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the DHCP entity.
:vartype display_name: str
:ivar path: NSX Gateway Path.
:vartype path: str
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"path": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"path": {"key": "properties.path", "type": "str"},
}
def __init__(self, *, display_name: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword display_name: Display name of the DHCP entity.
:paramtype display_name: str
"""
super().__init__(**kwargs)
self.display_name = display_name
self.path = None
class WorkloadNetworkGatewayList(_serialization.Model):
"""A list of NSX Gateways.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkGateway]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkGateway]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkList(_serialization.Model):
"""A list of workload networks.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetwork]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetwork]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkPortMirroring(ProxyResource):
"""NSX Port Mirroring.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the port mirroring profile.
:vartype display_name: str
:ivar direction: Direction of port mirroring profile. Known values are: "INGRESS", "EGRESS",
and "BIDIRECTIONAL".
:vartype direction: str or ~azure.mgmt.avs.models.PortMirroringDirectionEnum
:ivar source: Source VM Group.
:vartype source: str
:ivar destination: Destination VM Group.
:vartype destination: str
:ivar status: Port Mirroring Status. Known values are: "SUCCESS" and "FAILURE".
:vartype status: str or ~azure.mgmt.avs.models.PortMirroringStatusEnum
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.WorkloadNetworkPortMirroringProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"status": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"direction": {"key": "properties.direction", "type": "str"},
"source": {"key": "properties.source", "type": "str"},
"destination": {"key": "properties.destination", "type": "str"},
"status": {"key": "properties.status", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"revision": {"key": "properties.revision", "type": "int"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
direction: Optional[Union[str, "_models.PortMirroringDirectionEnum"]] = None,
source: Optional[str] = None,
destination: Optional[str] = None,
revision: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the port mirroring profile.
:paramtype display_name: str
:keyword direction: Direction of port mirroring profile. Known values are: "INGRESS", "EGRESS",
and "BIDIRECTIONAL".
:paramtype direction: str or ~azure.mgmt.avs.models.PortMirroringDirectionEnum
:keyword source: Source VM Group.
:paramtype source: str
:keyword destination: Destination VM Group.
:paramtype destination: str
:keyword revision: NSX revision number.
:paramtype revision: int
"""
super().__init__(**kwargs)
self.display_name = display_name
self.direction = direction
self.source = source
self.destination = destination
self.status = None
self.provisioning_state = None
self.revision = revision
class WorkloadNetworkPortMirroringList(_serialization.Model):
"""A list of NSX Port Mirroring.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkPortMirroring]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkPortMirroring]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkPublicIP(ProxyResource):
"""NSX Public IP Block.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the Public IP Block.
:vartype display_name: str
:ivar number_of_public_i_ps: Number of Public IPs requested.
:vartype number_of_public_i_ps: int
:ivar public_ip_block: CIDR Block of the Public IP Block.
:vartype public_ip_block: str
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.WorkloadNetworkPublicIPProvisioningState
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"public_ip_block": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"number_of_public_i_ps": {"key": "properties.numberOfPublicIPs", "type": "int"},
"public_ip_block": {"key": "properties.publicIPBlock", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
}
def __init__(
self, *, display_name: Optional[str] = None, number_of_public_i_ps: Optional[int] = None, **kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the Public IP Block.
:paramtype display_name: str
:keyword number_of_public_i_ps: Number of Public IPs requested.
:paramtype number_of_public_i_ps: int
"""
super().__init__(**kwargs)
self.display_name = display_name
self.number_of_public_i_ps = number_of_public_i_ps
self.public_ip_block = None
self.provisioning_state = None
class WorkloadNetworkPublicIPsList(_serialization.Model):
"""A list of NSX Public IP Blocks.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkPublicIP]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkPublicIP]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkSegment(ProxyResource):
"""NSX Segment.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the segment.
:vartype display_name: str
:ivar connected_gateway: Gateway which to connect segment to.
:vartype connected_gateway: str
:ivar subnet: Subnet which to connect segment to.
:vartype subnet: ~azure.mgmt.avs.models.WorkloadNetworkSegmentSubnet
:ivar port_vif: Port Vif which segment is associated with.
:vartype port_vif: list[~azure.mgmt.avs.models.WorkloadNetworkSegmentPortVif]
:ivar status: Segment status. Known values are: "SUCCESS" and "FAILURE".
:vartype status: str or ~azure.mgmt.avs.models.SegmentStatusEnum
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.WorkloadNetworkSegmentProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"port_vif": {"readonly": True},
"status": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"connected_gateway": {"key": "properties.connectedGateway", "type": "str"},
"subnet": {"key": "properties.subnet", "type": "WorkloadNetworkSegmentSubnet"},
"port_vif": {"key": "properties.portVif", "type": "[WorkloadNetworkSegmentPortVif]"},
"status": {"key": "properties.status", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"revision": {"key": "properties.revision", "type": "int"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
connected_gateway: Optional[str] = None,
subnet: Optional["_models.WorkloadNetworkSegmentSubnet"] = None,
revision: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the segment.
:paramtype display_name: str
:keyword connected_gateway: Gateway which to connect segment to.
:paramtype connected_gateway: str
:keyword subnet: Subnet which to connect segment to.
:paramtype subnet: ~azure.mgmt.avs.models.WorkloadNetworkSegmentSubnet
:keyword revision: NSX revision number.
:paramtype revision: int
"""
super().__init__(**kwargs)
self.display_name = display_name
self.connected_gateway = connected_gateway
self.subnet = subnet
self.port_vif = None
self.status = None
self.provisioning_state = None
self.revision = revision
class WorkloadNetworkSegmentPortVif(_serialization.Model):
"""Ports and any VIF attached to segment.
:ivar port_name: Name of port or VIF attached to segment.
:vartype port_name: str
"""
_attribute_map = {
"port_name": {"key": "portName", "type": "str"},
}
def __init__(self, *, port_name: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword port_name: Name of port or VIF attached to segment.
:paramtype port_name: str
"""
super().__init__(**kwargs)
self.port_name = port_name
class WorkloadNetworkSegmentsList(_serialization.Model):
"""A list of NSX Segments.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkSegment]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkSegment]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkSegmentSubnet(_serialization.Model):
"""Subnet configuration for segment.
:ivar dhcp_ranges: DHCP Range assigned for subnet.
:vartype dhcp_ranges: list[str]
:ivar gateway_address: Gateway address.
:vartype gateway_address: str
"""
_attribute_map = {
"dhcp_ranges": {"key": "dhcpRanges", "type": "[str]"},
"gateway_address": {"key": "gatewayAddress", "type": "str"},
}
def __init__(
self, *, dhcp_ranges: Optional[List[str]] = None, gateway_address: Optional[str] = None, **kwargs: Any
) -> None:
"""
:keyword dhcp_ranges: DHCP Range assigned for subnet.
:paramtype dhcp_ranges: list[str]
:keyword gateway_address: Gateway address.
:paramtype gateway_address: str
"""
super().__init__(**kwargs)
self.dhcp_ranges = dhcp_ranges
self.gateway_address = gateway_address
class WorkloadNetworkVirtualMachine(ProxyResource):
"""NSX Virtual Machine.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the VM.
:vartype display_name: str
:ivar vm_type: Virtual machine type. Known values are: "REGULAR", "EDGE", and "SERVICE".
:vartype vm_type: str or ~azure.mgmt.avs.models.VMTypeEnum
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"vm_type": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"vm_type": {"key": "properties.vmType", "type": "str"},
}
def __init__(self, *, display_name: Optional[str] = None, **kwargs: Any) -> None:
"""
:keyword display_name: Display name of the VM.
:paramtype display_name: str
"""
super().__init__(**kwargs)
self.display_name = display_name
self.vm_type = None
class WorkloadNetworkVirtualMachinesList(_serialization.Model):
"""A list of NSX Virtual Machines.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkVirtualMachine]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkVirtualMachine]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
class WorkloadNetworkVMGroup(ProxyResource):
"""NSX VM Group.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: Resource ID.
:vartype id: str
:ivar name: Resource name.
:vartype name: str
:ivar type: Resource type.
:vartype type: str
:ivar display_name: Display name of the VM group.
:vartype display_name: str
:ivar members: Virtual machine members of this group.
:vartype members: list[str]
:ivar status: VM Group status. Known values are: "SUCCESS" and "FAILURE".
:vartype status: str or ~azure.mgmt.avs.models.VMGroupStatusEnum
:ivar provisioning_state: The provisioning state. Known values are: "Succeeded", "Failed",
"Building", "Deleting", "Updating", and "Canceled".
:vartype provisioning_state: str or
~azure.mgmt.avs.models.WorkloadNetworkVMGroupProvisioningState
:ivar revision: NSX revision number.
:vartype revision: int
"""
_validation = {
"id": {"readonly": True},
"name": {"readonly": True},
"type": {"readonly": True},
"status": {"readonly": True},
"provisioning_state": {"readonly": True},
}
_attribute_map = {
"id": {"key": "id", "type": "str"},
"name": {"key": "name", "type": "str"},
"type": {"key": "type", "type": "str"},
"display_name": {"key": "properties.displayName", "type": "str"},
"members": {"key": "properties.members", "type": "[str]"},
"status": {"key": "properties.status", "type": "str"},
"provisioning_state": {"key": "properties.provisioningState", "type": "str"},
"revision": {"key": "properties.revision", "type": "int"},
}
def __init__(
self,
*,
display_name: Optional[str] = None,
members: Optional[List[str]] = None,
revision: Optional[int] = None,
**kwargs: Any
) -> None:
"""
:keyword display_name: Display name of the VM group.
:paramtype display_name: str
:keyword members: Virtual machine members of this group.
:paramtype members: list[str]
:keyword revision: NSX revision number.
:paramtype revision: int
"""
super().__init__(**kwargs)
self.display_name = display_name
self.members = members
self.status = None
self.provisioning_state = None
self.revision = revision
class WorkloadNetworkVMGroupsList(_serialization.Model):
"""A list of NSX VM Groups.
Variables are only populated by the server, and will be ignored when sending a request.
:ivar value: The items on the page.
:vartype value: list[~azure.mgmt.avs.models.WorkloadNetworkVMGroup]
:ivar next_link: URL to get the next page if any.
:vartype next_link: str
"""
_validation = {
"value": {"readonly": True},
"next_link": {"readonly": True},
}
_attribute_map = {
"value": {"key": "value", "type": "[WorkloadNetworkVMGroup]"},
"next_link": {"key": "nextLink", "type": "str"},
}
def __init__(self, **kwargs: Any) -> None:
""" """
super().__init__(**kwargs)
self.value = None
self.next_link = None
| 0.696681 | 0.225587 |
from ._models_py3 import Addon
from ._models_py3 import AddonArcProperties
from ._models_py3 import AddonHcxProperties
from ._models_py3 import AddonList
from ._models_py3 import AddonProperties
from ._models_py3 import AddonSrmProperties
from ._models_py3 import AddonVrProperties
from ._models_py3 import AdminCredentials
from ._models_py3 import AvailabilityProperties
from ._models_py3 import Circuit
from ._models_py3 import CloudLink
from ._models_py3 import CloudLinkList
from ._models_py3 import Cluster
from ._models_py3 import ClusterList
from ._models_py3 import ClusterProperties
from ._models_py3 import ClusterUpdate
from ._models_py3 import ClusterZone
from ._models_py3 import ClusterZoneList
from ._models_py3 import CommonClusterProperties
from ._models_py3 import Datastore
from ._models_py3 import DatastoreList
from ._models_py3 import DiskPoolVolume
from ._models_py3 import Encryption
from ._models_py3 import EncryptionKeyVaultProperties
from ._models_py3 import Endpoints
from ._models_py3 import ErrorAdditionalInfo
from ._models_py3 import ErrorDetail
from ._models_py3 import ErrorResponse
from ._models_py3 import ExpressRouteAuthorization
from ._models_py3 import ExpressRouteAuthorizationList
from ._models_py3 import GlobalReachConnection
from ._models_py3 import GlobalReachConnectionList
from ._models_py3 import HcxEnterpriseSite
from ._models_py3 import HcxEnterpriseSiteList
from ._models_py3 import IdentitySource
from ._models_py3 import LogSpecification
from ._models_py3 import ManagementCluster
from ._models_py3 import MetricDimension
from ._models_py3 import MetricSpecification
from ._models_py3 import NetAppVolume
from ._models_py3 import Operation
from ._models_py3 import OperationDisplay
from ._models_py3 import OperationList
from ._models_py3 import OperationProperties
from ._models_py3 import PSCredentialExecutionParameter
from ._models_py3 import PlacementPoliciesList
from ._models_py3 import PlacementPolicy
from ._models_py3 import PlacementPolicyProperties
from ._models_py3 import PlacementPolicyUpdate
from ._models_py3 import PrivateCloud
from ._models_py3 import PrivateCloudIdentity
from ._models_py3 import PrivateCloudList
from ._models_py3 import PrivateCloudProperties
from ._models_py3 import PrivateCloudUpdate
from ._models_py3 import PrivateCloudUpdateProperties
from ._models_py3 import ProxyResource
from ._models_py3 import Quota
from ._models_py3 import Resource
from ._models_py3 import ScriptCmdlet
from ._models_py3 import ScriptCmdletsList
from ._models_py3 import ScriptExecution
from ._models_py3 import ScriptExecutionParameter
from ._models_py3 import ScriptExecutionsList
from ._models_py3 import ScriptPackage
from ._models_py3 import ScriptPackagesList
from ._models_py3 import ScriptParameter
from ._models_py3 import ScriptSecureStringExecutionParameter
from ._models_py3 import ScriptStringExecutionParameter
from ._models_py3 import ServiceSpecification
from ._models_py3 import Sku
from ._models_py3 import TrackedResource
from ._models_py3 import Trial
from ._models_py3 import VirtualMachine
from ._models_py3 import VirtualMachineRestrictMovement
from ._models_py3 import VirtualMachinesList
from ._models_py3 import VmHostPlacementPolicyProperties
from ._models_py3 import VmPlacementPolicyProperties
from ._models_py3 import WorkloadNetwork
from ._models_py3 import WorkloadNetworkDhcp
from ._models_py3 import WorkloadNetworkDhcpEntity
from ._models_py3 import WorkloadNetworkDhcpList
from ._models_py3 import WorkloadNetworkDhcpRelay
from ._models_py3 import WorkloadNetworkDhcpServer
from ._models_py3 import WorkloadNetworkDnsService
from ._models_py3 import WorkloadNetworkDnsServicesList
from ._models_py3 import WorkloadNetworkDnsZone
from ._models_py3 import WorkloadNetworkDnsZonesList
from ._models_py3 import WorkloadNetworkGateway
from ._models_py3 import WorkloadNetworkGatewayList
from ._models_py3 import WorkloadNetworkList
from ._models_py3 import WorkloadNetworkPortMirroring
from ._models_py3 import WorkloadNetworkPortMirroringList
from ._models_py3 import WorkloadNetworkPublicIP
from ._models_py3 import WorkloadNetworkPublicIPsList
from ._models_py3 import WorkloadNetworkSegment
from ._models_py3 import WorkloadNetworkSegmentPortVif
from ._models_py3 import WorkloadNetworkSegmentSubnet
from ._models_py3 import WorkloadNetworkSegmentsList
from ._models_py3 import WorkloadNetworkVMGroup
from ._models_py3 import WorkloadNetworkVMGroupsList
from ._models_py3 import WorkloadNetworkVirtualMachine
from ._models_py3 import WorkloadNetworkVirtualMachinesList
from ._avs_client_enums import AddonProvisioningState
from ._avs_client_enums import AddonType
from ._avs_client_enums import AffinityStrength
from ._avs_client_enums import AffinityType
from ._avs_client_enums import AvailabilityStrategy
from ._avs_client_enums import AzureHybridBenefitType
from ._avs_client_enums import CloudLinkStatus
from ._avs_client_enums import ClusterProvisioningState
from ._avs_client_enums import DatastoreProvisioningState
from ._avs_client_enums import DatastoreStatus
from ._avs_client_enums import DhcpTypeEnum
from ._avs_client_enums import DnsServiceLogLevelEnum
from ._avs_client_enums import DnsServiceStatusEnum
from ._avs_client_enums import EncryptionKeyStatus
from ._avs_client_enums import EncryptionState
from ._avs_client_enums import EncryptionVersionType
from ._avs_client_enums import ExpressRouteAuthorizationProvisioningState
from ._avs_client_enums import GlobalReachConnectionProvisioningState
from ._avs_client_enums import GlobalReachConnectionStatus
from ._avs_client_enums import HcxEnterpriseSiteStatus
from ._avs_client_enums import InternetEnum
from ._avs_client_enums import MountOptionEnum
from ._avs_client_enums import NsxPublicIpQuotaRaisedEnum
from ._avs_client_enums import OptionalParamEnum
from ._avs_client_enums import PlacementPolicyProvisioningState
from ._avs_client_enums import PlacementPolicyState
from ._avs_client_enums import PlacementPolicyType
from ._avs_client_enums import PortMirroringDirectionEnum
from ._avs_client_enums import PortMirroringStatusEnum
from ._avs_client_enums import PrivateCloudProvisioningState
from ._avs_client_enums import QuotaEnabled
from ._avs_client_enums import ResourceIdentityType
from ._avs_client_enums import ScriptExecutionParameterType
from ._avs_client_enums import ScriptExecutionProvisioningState
from ._avs_client_enums import ScriptOutputStreamType
from ._avs_client_enums import ScriptParameterTypes
from ._avs_client_enums import SegmentStatusEnum
from ._avs_client_enums import SslEnum
from ._avs_client_enums import TrialStatus
from ._avs_client_enums import VMGroupStatusEnum
from ._avs_client_enums import VMTypeEnum
from ._avs_client_enums import VirtualMachineRestrictMovementState
from ._avs_client_enums import VisibilityParameterEnum
from ._avs_client_enums import WorkloadNetworkDhcpProvisioningState
from ._avs_client_enums import WorkloadNetworkDnsServiceProvisioningState
from ._avs_client_enums import WorkloadNetworkDnsZoneProvisioningState
from ._avs_client_enums import WorkloadNetworkName
from ._avs_client_enums import WorkloadNetworkPortMirroringProvisioningState
from ._avs_client_enums import WorkloadNetworkPublicIPProvisioningState
from ._avs_client_enums import WorkloadNetworkSegmentProvisioningState
from ._avs_client_enums import WorkloadNetworkVMGroupProvisioningState
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"Addon",
"AddonArcProperties",
"AddonHcxProperties",
"AddonList",
"AddonProperties",
"AddonSrmProperties",
"AddonVrProperties",
"AdminCredentials",
"AvailabilityProperties",
"Circuit",
"CloudLink",
"CloudLinkList",
"Cluster",
"ClusterList",
"ClusterProperties",
"ClusterUpdate",
"ClusterZone",
"ClusterZoneList",
"CommonClusterProperties",
"Datastore",
"DatastoreList",
"DiskPoolVolume",
"Encryption",
"EncryptionKeyVaultProperties",
"Endpoints",
"ErrorAdditionalInfo",
"ErrorDetail",
"ErrorResponse",
"ExpressRouteAuthorization",
"ExpressRouteAuthorizationList",
"GlobalReachConnection",
"GlobalReachConnectionList",
"HcxEnterpriseSite",
"HcxEnterpriseSiteList",
"IdentitySource",
"LogSpecification",
"ManagementCluster",
"MetricDimension",
"MetricSpecification",
"NetAppVolume",
"Operation",
"OperationDisplay",
"OperationList",
"OperationProperties",
"PSCredentialExecutionParameter",
"PlacementPoliciesList",
"PlacementPolicy",
"PlacementPolicyProperties",
"PlacementPolicyUpdate",
"PrivateCloud",
"PrivateCloudIdentity",
"PrivateCloudList",
"PrivateCloudProperties",
"PrivateCloudUpdate",
"PrivateCloudUpdateProperties",
"ProxyResource",
"Quota",
"Resource",
"ScriptCmdlet",
"ScriptCmdletsList",
"ScriptExecution",
"ScriptExecutionParameter",
"ScriptExecutionsList",
"ScriptPackage",
"ScriptPackagesList",
"ScriptParameter",
"ScriptSecureStringExecutionParameter",
"ScriptStringExecutionParameter",
"ServiceSpecification",
"Sku",
"TrackedResource",
"Trial",
"VirtualMachine",
"VirtualMachineRestrictMovement",
"VirtualMachinesList",
"VmHostPlacementPolicyProperties",
"VmPlacementPolicyProperties",
"WorkloadNetwork",
"WorkloadNetworkDhcp",
"WorkloadNetworkDhcpEntity",
"WorkloadNetworkDhcpList",
"WorkloadNetworkDhcpRelay",
"WorkloadNetworkDhcpServer",
"WorkloadNetworkDnsService",
"WorkloadNetworkDnsServicesList",
"WorkloadNetworkDnsZone",
"WorkloadNetworkDnsZonesList",
"WorkloadNetworkGateway",
"WorkloadNetworkGatewayList",
"WorkloadNetworkList",
"WorkloadNetworkPortMirroring",
"WorkloadNetworkPortMirroringList",
"WorkloadNetworkPublicIP",
"WorkloadNetworkPublicIPsList",
"WorkloadNetworkSegment",
"WorkloadNetworkSegmentPortVif",
"WorkloadNetworkSegmentSubnet",
"WorkloadNetworkSegmentsList",
"WorkloadNetworkVMGroup",
"WorkloadNetworkVMGroupsList",
"WorkloadNetworkVirtualMachine",
"WorkloadNetworkVirtualMachinesList",
"AddonProvisioningState",
"AddonType",
"AffinityStrength",
"AffinityType",
"AvailabilityStrategy",
"AzureHybridBenefitType",
"CloudLinkStatus",
"ClusterProvisioningState",
"DatastoreProvisioningState",
"DatastoreStatus",
"DhcpTypeEnum",
"DnsServiceLogLevelEnum",
"DnsServiceStatusEnum",
"EncryptionKeyStatus",
"EncryptionState",
"EncryptionVersionType",
"ExpressRouteAuthorizationProvisioningState",
"GlobalReachConnectionProvisioningState",
"GlobalReachConnectionStatus",
"HcxEnterpriseSiteStatus",
"InternetEnum",
"MountOptionEnum",
"NsxPublicIpQuotaRaisedEnum",
"OptionalParamEnum",
"PlacementPolicyProvisioningState",
"PlacementPolicyState",
"PlacementPolicyType",
"PortMirroringDirectionEnum",
"PortMirroringStatusEnum",
"PrivateCloudProvisioningState",
"QuotaEnabled",
"ResourceIdentityType",
"ScriptExecutionParameterType",
"ScriptExecutionProvisioningState",
"ScriptOutputStreamType",
"ScriptParameterTypes",
"SegmentStatusEnum",
"SslEnum",
"TrialStatus",
"VMGroupStatusEnum",
"VMTypeEnum",
"VirtualMachineRestrictMovementState",
"VisibilityParameterEnum",
"WorkloadNetworkDhcpProvisioningState",
"WorkloadNetworkDnsServiceProvisioningState",
"WorkloadNetworkDnsZoneProvisioningState",
"WorkloadNetworkName",
"WorkloadNetworkPortMirroringProvisioningState",
"WorkloadNetworkPublicIPProvisioningState",
"WorkloadNetworkSegmentProvisioningState",
"WorkloadNetworkVMGroupProvisioningState",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/models/__init__.py
|
__init__.py
|
from ._models_py3 import Addon
from ._models_py3 import AddonArcProperties
from ._models_py3 import AddonHcxProperties
from ._models_py3 import AddonList
from ._models_py3 import AddonProperties
from ._models_py3 import AddonSrmProperties
from ._models_py3 import AddonVrProperties
from ._models_py3 import AdminCredentials
from ._models_py3 import AvailabilityProperties
from ._models_py3 import Circuit
from ._models_py3 import CloudLink
from ._models_py3 import CloudLinkList
from ._models_py3 import Cluster
from ._models_py3 import ClusterList
from ._models_py3 import ClusterProperties
from ._models_py3 import ClusterUpdate
from ._models_py3 import ClusterZone
from ._models_py3 import ClusterZoneList
from ._models_py3 import CommonClusterProperties
from ._models_py3 import Datastore
from ._models_py3 import DatastoreList
from ._models_py3 import DiskPoolVolume
from ._models_py3 import Encryption
from ._models_py3 import EncryptionKeyVaultProperties
from ._models_py3 import Endpoints
from ._models_py3 import ErrorAdditionalInfo
from ._models_py3 import ErrorDetail
from ._models_py3 import ErrorResponse
from ._models_py3 import ExpressRouteAuthorization
from ._models_py3 import ExpressRouteAuthorizationList
from ._models_py3 import GlobalReachConnection
from ._models_py3 import GlobalReachConnectionList
from ._models_py3 import HcxEnterpriseSite
from ._models_py3 import HcxEnterpriseSiteList
from ._models_py3 import IdentitySource
from ._models_py3 import LogSpecification
from ._models_py3 import ManagementCluster
from ._models_py3 import MetricDimension
from ._models_py3 import MetricSpecification
from ._models_py3 import NetAppVolume
from ._models_py3 import Operation
from ._models_py3 import OperationDisplay
from ._models_py3 import OperationList
from ._models_py3 import OperationProperties
from ._models_py3 import PSCredentialExecutionParameter
from ._models_py3 import PlacementPoliciesList
from ._models_py3 import PlacementPolicy
from ._models_py3 import PlacementPolicyProperties
from ._models_py3 import PlacementPolicyUpdate
from ._models_py3 import PrivateCloud
from ._models_py3 import PrivateCloudIdentity
from ._models_py3 import PrivateCloudList
from ._models_py3 import PrivateCloudProperties
from ._models_py3 import PrivateCloudUpdate
from ._models_py3 import PrivateCloudUpdateProperties
from ._models_py3 import ProxyResource
from ._models_py3 import Quota
from ._models_py3 import Resource
from ._models_py3 import ScriptCmdlet
from ._models_py3 import ScriptCmdletsList
from ._models_py3 import ScriptExecution
from ._models_py3 import ScriptExecutionParameter
from ._models_py3 import ScriptExecutionsList
from ._models_py3 import ScriptPackage
from ._models_py3 import ScriptPackagesList
from ._models_py3 import ScriptParameter
from ._models_py3 import ScriptSecureStringExecutionParameter
from ._models_py3 import ScriptStringExecutionParameter
from ._models_py3 import ServiceSpecification
from ._models_py3 import Sku
from ._models_py3 import TrackedResource
from ._models_py3 import Trial
from ._models_py3 import VirtualMachine
from ._models_py3 import VirtualMachineRestrictMovement
from ._models_py3 import VirtualMachinesList
from ._models_py3 import VmHostPlacementPolicyProperties
from ._models_py3 import VmPlacementPolicyProperties
from ._models_py3 import WorkloadNetwork
from ._models_py3 import WorkloadNetworkDhcp
from ._models_py3 import WorkloadNetworkDhcpEntity
from ._models_py3 import WorkloadNetworkDhcpList
from ._models_py3 import WorkloadNetworkDhcpRelay
from ._models_py3 import WorkloadNetworkDhcpServer
from ._models_py3 import WorkloadNetworkDnsService
from ._models_py3 import WorkloadNetworkDnsServicesList
from ._models_py3 import WorkloadNetworkDnsZone
from ._models_py3 import WorkloadNetworkDnsZonesList
from ._models_py3 import WorkloadNetworkGateway
from ._models_py3 import WorkloadNetworkGatewayList
from ._models_py3 import WorkloadNetworkList
from ._models_py3 import WorkloadNetworkPortMirroring
from ._models_py3 import WorkloadNetworkPortMirroringList
from ._models_py3 import WorkloadNetworkPublicIP
from ._models_py3 import WorkloadNetworkPublicIPsList
from ._models_py3 import WorkloadNetworkSegment
from ._models_py3 import WorkloadNetworkSegmentPortVif
from ._models_py3 import WorkloadNetworkSegmentSubnet
from ._models_py3 import WorkloadNetworkSegmentsList
from ._models_py3 import WorkloadNetworkVMGroup
from ._models_py3 import WorkloadNetworkVMGroupsList
from ._models_py3 import WorkloadNetworkVirtualMachine
from ._models_py3 import WorkloadNetworkVirtualMachinesList
from ._avs_client_enums import AddonProvisioningState
from ._avs_client_enums import AddonType
from ._avs_client_enums import AffinityStrength
from ._avs_client_enums import AffinityType
from ._avs_client_enums import AvailabilityStrategy
from ._avs_client_enums import AzureHybridBenefitType
from ._avs_client_enums import CloudLinkStatus
from ._avs_client_enums import ClusterProvisioningState
from ._avs_client_enums import DatastoreProvisioningState
from ._avs_client_enums import DatastoreStatus
from ._avs_client_enums import DhcpTypeEnum
from ._avs_client_enums import DnsServiceLogLevelEnum
from ._avs_client_enums import DnsServiceStatusEnum
from ._avs_client_enums import EncryptionKeyStatus
from ._avs_client_enums import EncryptionState
from ._avs_client_enums import EncryptionVersionType
from ._avs_client_enums import ExpressRouteAuthorizationProvisioningState
from ._avs_client_enums import GlobalReachConnectionProvisioningState
from ._avs_client_enums import GlobalReachConnectionStatus
from ._avs_client_enums import HcxEnterpriseSiteStatus
from ._avs_client_enums import InternetEnum
from ._avs_client_enums import MountOptionEnum
from ._avs_client_enums import NsxPublicIpQuotaRaisedEnum
from ._avs_client_enums import OptionalParamEnum
from ._avs_client_enums import PlacementPolicyProvisioningState
from ._avs_client_enums import PlacementPolicyState
from ._avs_client_enums import PlacementPolicyType
from ._avs_client_enums import PortMirroringDirectionEnum
from ._avs_client_enums import PortMirroringStatusEnum
from ._avs_client_enums import PrivateCloudProvisioningState
from ._avs_client_enums import QuotaEnabled
from ._avs_client_enums import ResourceIdentityType
from ._avs_client_enums import ScriptExecutionParameterType
from ._avs_client_enums import ScriptExecutionProvisioningState
from ._avs_client_enums import ScriptOutputStreamType
from ._avs_client_enums import ScriptParameterTypes
from ._avs_client_enums import SegmentStatusEnum
from ._avs_client_enums import SslEnum
from ._avs_client_enums import TrialStatus
from ._avs_client_enums import VMGroupStatusEnum
from ._avs_client_enums import VMTypeEnum
from ._avs_client_enums import VirtualMachineRestrictMovementState
from ._avs_client_enums import VisibilityParameterEnum
from ._avs_client_enums import WorkloadNetworkDhcpProvisioningState
from ._avs_client_enums import WorkloadNetworkDnsServiceProvisioningState
from ._avs_client_enums import WorkloadNetworkDnsZoneProvisioningState
from ._avs_client_enums import WorkloadNetworkName
from ._avs_client_enums import WorkloadNetworkPortMirroringProvisioningState
from ._avs_client_enums import WorkloadNetworkPublicIPProvisioningState
from ._avs_client_enums import WorkloadNetworkSegmentProvisioningState
from ._avs_client_enums import WorkloadNetworkVMGroupProvisioningState
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
from ._patch import patch_sdk as _patch_sdk
__all__ = [
"Addon",
"AddonArcProperties",
"AddonHcxProperties",
"AddonList",
"AddonProperties",
"AddonSrmProperties",
"AddonVrProperties",
"AdminCredentials",
"AvailabilityProperties",
"Circuit",
"CloudLink",
"CloudLinkList",
"Cluster",
"ClusterList",
"ClusterProperties",
"ClusterUpdate",
"ClusterZone",
"ClusterZoneList",
"CommonClusterProperties",
"Datastore",
"DatastoreList",
"DiskPoolVolume",
"Encryption",
"EncryptionKeyVaultProperties",
"Endpoints",
"ErrorAdditionalInfo",
"ErrorDetail",
"ErrorResponse",
"ExpressRouteAuthorization",
"ExpressRouteAuthorizationList",
"GlobalReachConnection",
"GlobalReachConnectionList",
"HcxEnterpriseSite",
"HcxEnterpriseSiteList",
"IdentitySource",
"LogSpecification",
"ManagementCluster",
"MetricDimension",
"MetricSpecification",
"NetAppVolume",
"Operation",
"OperationDisplay",
"OperationList",
"OperationProperties",
"PSCredentialExecutionParameter",
"PlacementPoliciesList",
"PlacementPolicy",
"PlacementPolicyProperties",
"PlacementPolicyUpdate",
"PrivateCloud",
"PrivateCloudIdentity",
"PrivateCloudList",
"PrivateCloudProperties",
"PrivateCloudUpdate",
"PrivateCloudUpdateProperties",
"ProxyResource",
"Quota",
"Resource",
"ScriptCmdlet",
"ScriptCmdletsList",
"ScriptExecution",
"ScriptExecutionParameter",
"ScriptExecutionsList",
"ScriptPackage",
"ScriptPackagesList",
"ScriptParameter",
"ScriptSecureStringExecutionParameter",
"ScriptStringExecutionParameter",
"ServiceSpecification",
"Sku",
"TrackedResource",
"Trial",
"VirtualMachine",
"VirtualMachineRestrictMovement",
"VirtualMachinesList",
"VmHostPlacementPolicyProperties",
"VmPlacementPolicyProperties",
"WorkloadNetwork",
"WorkloadNetworkDhcp",
"WorkloadNetworkDhcpEntity",
"WorkloadNetworkDhcpList",
"WorkloadNetworkDhcpRelay",
"WorkloadNetworkDhcpServer",
"WorkloadNetworkDnsService",
"WorkloadNetworkDnsServicesList",
"WorkloadNetworkDnsZone",
"WorkloadNetworkDnsZonesList",
"WorkloadNetworkGateway",
"WorkloadNetworkGatewayList",
"WorkloadNetworkList",
"WorkloadNetworkPortMirroring",
"WorkloadNetworkPortMirroringList",
"WorkloadNetworkPublicIP",
"WorkloadNetworkPublicIPsList",
"WorkloadNetworkSegment",
"WorkloadNetworkSegmentPortVif",
"WorkloadNetworkSegmentSubnet",
"WorkloadNetworkSegmentsList",
"WorkloadNetworkVMGroup",
"WorkloadNetworkVMGroupsList",
"WorkloadNetworkVirtualMachine",
"WorkloadNetworkVirtualMachinesList",
"AddonProvisioningState",
"AddonType",
"AffinityStrength",
"AffinityType",
"AvailabilityStrategy",
"AzureHybridBenefitType",
"CloudLinkStatus",
"ClusterProvisioningState",
"DatastoreProvisioningState",
"DatastoreStatus",
"DhcpTypeEnum",
"DnsServiceLogLevelEnum",
"DnsServiceStatusEnum",
"EncryptionKeyStatus",
"EncryptionState",
"EncryptionVersionType",
"ExpressRouteAuthorizationProvisioningState",
"GlobalReachConnectionProvisioningState",
"GlobalReachConnectionStatus",
"HcxEnterpriseSiteStatus",
"InternetEnum",
"MountOptionEnum",
"NsxPublicIpQuotaRaisedEnum",
"OptionalParamEnum",
"PlacementPolicyProvisioningState",
"PlacementPolicyState",
"PlacementPolicyType",
"PortMirroringDirectionEnum",
"PortMirroringStatusEnum",
"PrivateCloudProvisioningState",
"QuotaEnabled",
"ResourceIdentityType",
"ScriptExecutionParameterType",
"ScriptExecutionProvisioningState",
"ScriptOutputStreamType",
"ScriptParameterTypes",
"SegmentStatusEnum",
"SslEnum",
"TrialStatus",
"VMGroupStatusEnum",
"VMTypeEnum",
"VirtualMachineRestrictMovementState",
"VisibilityParameterEnum",
"WorkloadNetworkDhcpProvisioningState",
"WorkloadNetworkDnsServiceProvisioningState",
"WorkloadNetworkDnsZoneProvisioningState",
"WorkloadNetworkName",
"WorkloadNetworkPortMirroringProvisioningState",
"WorkloadNetworkPublicIPProvisioningState",
"WorkloadNetworkSegmentProvisioningState",
"WorkloadNetworkVMGroupProvisioningState",
]
__all__.extend([p for p in _patch_all if p not in __all__])
_patch_sdk()
| 0.506347 | 0.048294 |
from enum import Enum
from azure.core import CaseInsensitiveEnumMeta
class AddonProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the addon provisioning."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELLED = "Cancelled"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class AddonType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of private cloud addon."""
SRM = "SRM"
VR = "VR"
HCX = "HCX"
ARC = "Arc"
class AffinityStrength(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""VM-Host placement policy affinity strength (should/must)."""
SHOULD = "Should"
MUST = "Must"
class AffinityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Placement policy affinity type."""
AFFINITY = "Affinity"
ANTI_AFFINITY = "AntiAffinity"
class AvailabilityStrategy(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The availability strategy for the private cloud."""
SINGLE_ZONE = "SingleZone"
DUAL_ZONE = "DualZone"
class AzureHybridBenefitType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Placement policy hosts opt-in Azure Hybrid Benefit type."""
SQL_HOST = "SqlHost"
NONE = "None"
class CloudLinkStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the cloud link."""
ACTIVE = "Active"
BUILDING = "Building"
DELETING = "Deleting"
FAILED = "Failed"
DISCONNECTED = "Disconnected"
class ClusterProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the cluster provisioning."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELLED = "Cancelled"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class DatastoreProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the datastore provisioning."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELLED = "Cancelled"
PENDING = "Pending"
CREATING = "Creating"
UPDATING = "Updating"
DELETING = "Deleting"
CANCELED = "Canceled"
class DatastoreStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The operational status of the datastore."""
UNKNOWN = "Unknown"
ACCESSIBLE = "Accessible"
INACCESSIBLE = "Inaccessible"
ATTACHED = "Attached"
DETACHED = "Detached"
LOST_COMMUNICATION = "LostCommunication"
DEAD_OR_ERROR = "DeadOrError"
class DhcpTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of DHCP: SERVER or RELAY."""
SERVER = "SERVER"
RELAY = "RELAY"
class DnsServiceLogLevelEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""DNS Service log level."""
DEBUG = "DEBUG"
INFO = "INFO"
WARNING = "WARNING"
ERROR = "ERROR"
FATAL = "FATAL"
class DnsServiceStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""DNS Service status."""
SUCCESS = "SUCCESS"
FAILURE = "FAILURE"
class EncryptionKeyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of key provided."""
CONNECTED = "Connected"
ACCESS_DENIED = "AccessDenied"
class EncryptionState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Status of customer managed encryption key."""
ENABLED = "Enabled"
DISABLED = "Disabled"
class EncryptionVersionType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Property of the key if user provided or auto detected."""
FIXED = "Fixed"
AUTO_DETECTED = "AutoDetected"
class ExpressRouteAuthorizationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the ExpressRoute Circuit Authorization provisioning."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
UPDATING = "Updating"
CANCELED = "Canceled"
class GlobalReachConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the ExpressRoute Circuit Authorization provisioning."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
UPDATING = "Updating"
CANCELED = "Canceled"
class GlobalReachConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The connection status of the global reach connection."""
CONNECTED = "Connected"
CONNECTING = "Connecting"
DISCONNECTED = "Disconnected"
class HcxEnterpriseSiteStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The status of the HCX Enterprise Site."""
AVAILABLE = "Available"
CONSUMED = "Consumed"
DEACTIVATED = "Deactivated"
DELETED = "Deleted"
class InternetEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Connectivity to internet is enabled or disabled."""
ENABLED = "Enabled"
DISABLED = "Disabled"
class MountOptionEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Mode that describes whether the LUN has to be mounted as a datastore or attached as a LUN."""
MOUNT = "MOUNT"
ATTACH = "ATTACH"
class NsxPublicIpQuotaRaisedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Flag to indicate whether the private cloud has the quota for provisioned NSX Public IP count
raised from 64 to 1024.
"""
ENABLED = "Enabled"
DISABLED = "Disabled"
class OptionalParamEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Is this parameter required or optional."""
OPTIONAL = "Optional"
REQUIRED = "Required"
class PlacementPolicyProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class PlacementPolicyState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Whether the placement policy is enabled or disabled."""
ENABLED = "Enabled"
DISABLED = "Disabled"
class PlacementPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""placement policy type."""
VM_VM = "VmVm"
VM_HOST = "VmHost"
class PortMirroringDirectionEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Direction of port mirroring profile."""
INGRESS = "INGRESS"
EGRESS = "EGRESS"
BIDIRECTIONAL = "BIDIRECTIONAL"
class PortMirroringStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Port Mirroring Status."""
SUCCESS = "SUCCESS"
FAILURE = "FAILURE"
class PrivateCloudProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELLED = "Cancelled"
PENDING = "Pending"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class QuotaEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Host quota is active for current subscription."""
ENABLED = "Enabled"
DISABLED = "Disabled"
class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of identity used for the private cloud. The type 'SystemAssigned' refers to an
implicitly created identity. The type 'None' will remove any identities from the Private Cloud.
"""
SYSTEM_ASSIGNED = "SystemAssigned"
NONE = "None"
class ScriptExecutionParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of execution parameter."""
VALUE = "Value"
SECURE_VALUE = "SecureValue"
CREDENTIAL = "Credential"
class ScriptExecutionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the script execution resource."""
PENDING = "Pending"
RUNNING = "Running"
SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELLING = "Cancelling"
CANCELLED = "Cancelled"
DELETING = "Deleting"
CANCELED = "Canceled"
class ScriptOutputStreamType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""ScriptOutputStreamType."""
INFORMATION = "Information"
WARNING = "Warning"
OUTPUT = "Output"
ERROR = "Error"
class ScriptParameterTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of parameter the script is expecting. psCredential is a PSCredentialObject."""
STRING = "String"
SECURE_STRING = "SecureString"
CREDENTIAL = "Credential"
INT = "Int"
BOOL = "Bool"
FLOAT = "Float"
class SegmentStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Segment status."""
SUCCESS = "SUCCESS"
FAILURE = "FAILURE"
class SslEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Protect LDAP communication using SSL certificate (LDAPS)."""
ENABLED = "Enabled"
DISABLED = "Disabled"
class TrialStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Trial status."""
TRIAL_AVAILABLE = "TrialAvailable"
TRIAL_USED = "TrialUsed"
TRIAL_DISABLED = "TrialDisabled"
class VirtualMachineRestrictMovementState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Whether VM DRS-driven movement is restricted (enabled) or not (disabled)."""
ENABLED = "Enabled"
DISABLED = "Disabled"
class VisibilityParameterEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Should this parameter be visible to arm and passed in the parameters argument when executing."""
VISIBLE = "Visible"
HIDDEN = "Hidden"
class VMGroupStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""VM Group status."""
SUCCESS = "SUCCESS"
FAILURE = "FAILURE"
class VMTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Virtual machine type."""
REGULAR = "REGULAR"
EDGE = "EDGE"
SERVICE = "SERVICE"
class WorkloadNetworkDhcpProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class WorkloadNetworkDnsServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class WorkloadNetworkDnsZoneProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class WorkloadNetworkName(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""WorkloadNetworkName."""
DEFAULT = "default"
class WorkloadNetworkPortMirroringProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class WorkloadNetworkPublicIPProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class WorkloadNetworkSegmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class WorkloadNetworkVMGroupProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
|
azure-mgmt-avs
|
/azure_mgmt_avs-8.0.0-py3-none-any.whl/azure/mgmt/avs/models/_avs_client_enums.py
|
_avs_client_enums.py
|
from enum import Enum
from azure.core import CaseInsensitiveEnumMeta
class AddonProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the addon provisioning."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELLED = "Cancelled"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class AddonType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of private cloud addon."""
SRM = "SRM"
VR = "VR"
HCX = "HCX"
ARC = "Arc"
class AffinityStrength(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""VM-Host placement policy affinity strength (should/must)."""
SHOULD = "Should"
MUST = "Must"
class AffinityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Placement policy affinity type."""
AFFINITY = "Affinity"
ANTI_AFFINITY = "AntiAffinity"
class AvailabilityStrategy(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The availability strategy for the private cloud."""
SINGLE_ZONE = "SingleZone"
DUAL_ZONE = "DualZone"
class AzureHybridBenefitType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Placement policy hosts opt-in Azure Hybrid Benefit type."""
SQL_HOST = "SqlHost"
NONE = "None"
class CloudLinkStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the cloud link."""
ACTIVE = "Active"
BUILDING = "Building"
DELETING = "Deleting"
FAILED = "Failed"
DISCONNECTED = "Disconnected"
class ClusterProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the cluster provisioning."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELLED = "Cancelled"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class DatastoreProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the datastore provisioning."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELLED = "Cancelled"
PENDING = "Pending"
CREATING = "Creating"
UPDATING = "Updating"
DELETING = "Deleting"
CANCELED = "Canceled"
class DatastoreStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The operational status of the datastore."""
UNKNOWN = "Unknown"
ACCESSIBLE = "Accessible"
INACCESSIBLE = "Inaccessible"
ATTACHED = "Attached"
DETACHED = "Detached"
LOST_COMMUNICATION = "LostCommunication"
DEAD_OR_ERROR = "DeadOrError"
class DhcpTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of DHCP: SERVER or RELAY."""
SERVER = "SERVER"
RELAY = "RELAY"
class DnsServiceLogLevelEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""DNS Service log level."""
DEBUG = "DEBUG"
INFO = "INFO"
WARNING = "WARNING"
ERROR = "ERROR"
FATAL = "FATAL"
class DnsServiceStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""DNS Service status."""
SUCCESS = "SUCCESS"
FAILURE = "FAILURE"
class EncryptionKeyStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of key provided."""
CONNECTED = "Connected"
ACCESS_DENIED = "AccessDenied"
class EncryptionState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Status of customer managed encryption key."""
ENABLED = "Enabled"
DISABLED = "Disabled"
class EncryptionVersionType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Property of the key if user provided or auto detected."""
FIXED = "Fixed"
AUTO_DETECTED = "AutoDetected"
class ExpressRouteAuthorizationProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the ExpressRoute Circuit Authorization provisioning."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
UPDATING = "Updating"
CANCELED = "Canceled"
class GlobalReachConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the ExpressRoute Circuit Authorization provisioning."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
UPDATING = "Updating"
CANCELED = "Canceled"
class GlobalReachConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The connection status of the global reach connection."""
CONNECTED = "Connected"
CONNECTING = "Connecting"
DISCONNECTED = "Disconnected"
class HcxEnterpriseSiteStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The status of the HCX Enterprise Site."""
AVAILABLE = "Available"
CONSUMED = "Consumed"
DEACTIVATED = "Deactivated"
DELETED = "Deleted"
class InternetEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Connectivity to internet is enabled or disabled."""
ENABLED = "Enabled"
DISABLED = "Disabled"
class MountOptionEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Mode that describes whether the LUN has to be mounted as a datastore or attached as a LUN."""
MOUNT = "MOUNT"
ATTACH = "ATTACH"
class NsxPublicIpQuotaRaisedEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Flag to indicate whether the private cloud has the quota for provisioned NSX Public IP count
raised from 64 to 1024.
"""
ENABLED = "Enabled"
DISABLED = "Disabled"
class OptionalParamEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Is this parameter required or optional."""
OPTIONAL = "Optional"
REQUIRED = "Required"
class PlacementPolicyProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class PlacementPolicyState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Whether the placement policy is enabled or disabled."""
ENABLED = "Enabled"
DISABLED = "Disabled"
class PlacementPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""placement policy type."""
VM_VM = "VmVm"
VM_HOST = "VmHost"
class PortMirroringDirectionEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Direction of port mirroring profile."""
INGRESS = "INGRESS"
EGRESS = "EGRESS"
BIDIRECTIONAL = "BIDIRECTIONAL"
class PortMirroringStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Port Mirroring Status."""
SUCCESS = "SUCCESS"
FAILURE = "FAILURE"
class PrivateCloudProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELLED = "Cancelled"
PENDING = "Pending"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class QuotaEnabled(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Host quota is active for current subscription."""
ENABLED = "Enabled"
DISABLED = "Disabled"
class ResourceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of identity used for the private cloud. The type 'SystemAssigned' refers to an
implicitly created identity. The type 'None' will remove any identities from the Private Cloud.
"""
SYSTEM_ASSIGNED = "SystemAssigned"
NONE = "None"
class ScriptExecutionParameterType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of execution parameter."""
VALUE = "Value"
SECURE_VALUE = "SecureValue"
CREDENTIAL = "Credential"
class ScriptExecutionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The state of the script execution resource."""
PENDING = "Pending"
RUNNING = "Running"
SUCCEEDED = "Succeeded"
FAILED = "Failed"
CANCELLING = "Cancelling"
CANCELLED = "Cancelled"
DELETING = "Deleting"
CANCELED = "Canceled"
class ScriptOutputStreamType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""ScriptOutputStreamType."""
INFORMATION = "Information"
WARNING = "Warning"
OUTPUT = "Output"
ERROR = "Error"
class ScriptParameterTypes(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The type of parameter the script is expecting. psCredential is a PSCredentialObject."""
STRING = "String"
SECURE_STRING = "SecureString"
CREDENTIAL = "Credential"
INT = "Int"
BOOL = "Bool"
FLOAT = "Float"
class SegmentStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Segment status."""
SUCCESS = "SUCCESS"
FAILURE = "FAILURE"
class SslEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Protect LDAP communication using SSL certificate (LDAPS)."""
ENABLED = "Enabled"
DISABLED = "Disabled"
class TrialStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Trial status."""
TRIAL_AVAILABLE = "TrialAvailable"
TRIAL_USED = "TrialUsed"
TRIAL_DISABLED = "TrialDisabled"
class VirtualMachineRestrictMovementState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Whether VM DRS-driven movement is restricted (enabled) or not (disabled)."""
ENABLED = "Enabled"
DISABLED = "Disabled"
class VisibilityParameterEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Should this parameter be visible to arm and passed in the parameters argument when executing."""
VISIBLE = "Visible"
HIDDEN = "Hidden"
class VMGroupStatusEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""VM Group status."""
SUCCESS = "SUCCESS"
FAILURE = "FAILURE"
class VMTypeEnum(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Virtual machine type."""
REGULAR = "REGULAR"
EDGE = "EDGE"
SERVICE = "SERVICE"
class WorkloadNetworkDhcpProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class WorkloadNetworkDnsServiceProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class WorkloadNetworkDnsZoneProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class WorkloadNetworkName(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""WorkloadNetworkName."""
DEFAULT = "default"
class WorkloadNetworkPortMirroringProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class WorkloadNetworkPublicIPProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class WorkloadNetworkSegmentProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
class WorkloadNetworkVMGroupProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""The provisioning state."""
SUCCEEDED = "Succeeded"
FAILED = "Failed"
BUILDING = "Building"
DELETING = "Deleting"
UPDATING = "Updating"
CANCELED = "Canceled"
| 0.880976 | 0.116211 |
# Microsoft Azure SDK for Python
This is the Microsoft Azure Azureadb2c Management Client Library.
This package has been tested with Python 3.6+.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
## Deprecation notice
This package reached the end of its life and is no longer supported as of 3/31/2023.
## _Disclaimer_
_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
# Usage
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
Code samples for this package can be found at [Azureadb2c Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
# Provide Feedback
If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.

|
azure-mgmt-azureadb2c
|
/azure-mgmt-azureadb2c-1.0.0b2.zip/azure-mgmt-azureadb2c-1.0.0b2/README.md
|
README.md
|
# Microsoft Azure SDK for Python
This is the Microsoft Azure Azureadb2c Management Client Library.
This package has been tested with Python 3.6+.
For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all).
## Deprecation notice
This package reached the end of its life and is no longer supported as of 3/31/2023.
## _Disclaimer_
_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_
# Usage
To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt)
For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/)
Code samples for this package can be found at [Azureadb2c Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com.
Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples)
# Provide Feedback
If you encounter any bugs or have suggestions, please file an issue in the
[Issues](https://github.com/Azure/azure-sdk-for-python/issues)
section of the project.

| 0.773815 | 0.589982 |
from azure.mgmt.core import ARMPipelineClient
from msrest import Serializer, Deserializer
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from ._configuration import CPIMConfigurationClientConfiguration
class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Will be removed in final version of multiapi azure-core based client
"""
pass
class CPIMConfigurationClient(MultiApiClientMixin, _SDKClient):
"""CPIM Configuration Client.
This ready contains multiple API versions, to help you deal with all of the Azure clouds
(Azure Stack, Azure Government, Azure China, etc.).
By default, it uses the latest API version available on public Azure.
For production, you should stick to a particular api-version and/or profile.
The profile sets a mapping between an operation group and its API version.
The api-version parameter sets the default API version if the operation
group is not described in the profile.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).
:type subscription_id: str
:param str api_version: API version to use if no profile is provided, or if
missing in profile.
:param str base_url: Service URL
:param profile: A profile definition, from KnownProfiles to dict.
:type profile: azure.profiles.KnownProfiles
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""
DEFAULT_API_VERSION = '2020-05-01-preview'
_PROFILE_TAG = "azure.mgmt.azureadb2c.CPIMConfigurationClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION,
'b2_ctenants': '2019-01-01-preview',
}},
_PROFILE_TAG + " latest"
)
def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
api_version=None,
base_url=None,
profile=KnownProfiles.default,
**kwargs # type: Any
):
if not base_url:
base_url = 'https://management.azure.com'
self._config = CPIMConfigurationClientConfiguration(credential, subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(CPIMConfigurationClient, self).__init__(
api_version=api_version,
profile=profile
)
@classmethod
def _models_dict(cls, api_version):
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
@classmethod
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 2019-01-01-preview: :mod:`v2019_01_01_preview.models<azure.mgmt.azureadb2c.v2019_01_01_preview.models>`
* 2020-05-01-preview: :mod:`v2020_05_01_preview.models<azure.mgmt.azureadb2c.v2020_05_01_preview.models>`
"""
if api_version == '2019-01-01-preview':
from .v2019_01_01_preview import models
return models
elif api_version == '2020-05-01-preview':
from .v2020_05_01_preview import models
return models
raise ValueError("API version {} is not available".format(api_version))
@property
def b2_ctenants(self):
"""Instance depends on the API version:
* 2019-01-01-preview: :class:`B2CTenantsOperations<azure.mgmt.azureadb2c.v2019_01_01_preview.operations.B2CTenantsOperations>`
"""
api_version = self._get_api_version('b2_ctenants')
if api_version == '2019-01-01-preview':
from .v2019_01_01_preview.operations import B2CTenantsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'b2_ctenants'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def guest_usages(self):
"""Instance depends on the API version:
* 2020-05-01-preview: :class:`GuestUsagesOperations<azure.mgmt.azureadb2c.v2020_05_01_preview.operations.GuestUsagesOperations>`
"""
api_version = self._get_api_version('guest_usages')
if api_version == '2020-05-01-preview':
from .v2020_05_01_preview.operations import GuestUsagesOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'guest_usages'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def operations(self):
"""Instance depends on the API version:
* 2019-01-01-preview: :class:`Operations<azure.mgmt.azureadb2c.v2019_01_01_preview.operations.Operations>`
* 2020-05-01-preview: :class:`Operations<azure.mgmt.azureadb2c.v2020_05_01_preview.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2019-01-01-preview':
from .v2019_01_01_preview.operations import Operations as OperationClass
elif api_version == '2020-05-01-preview':
from .v2020_05_01_preview.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
def close(self):
self._client.close()
def __enter__(self):
self._client.__enter__()
return self
def __exit__(self, *exc_details):
self._client.__exit__(*exc_details)
|
azure-mgmt-azureadb2c
|
/azure-mgmt-azureadb2c-1.0.0b2.zip/azure-mgmt-azureadb2c-1.0.0b2/azure/mgmt/azureadb2c/_cpim_configuration_client.py
|
_cpim_configuration_client.py
|
from azure.mgmt.core import ARMPipelineClient
from msrest import Serializer, Deserializer
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from ._configuration import CPIMConfigurationClientConfiguration
class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Will be removed in final version of multiapi azure-core based client
"""
pass
class CPIMConfigurationClient(MultiApiClientMixin, _SDKClient):
"""CPIM Configuration Client.
This ready contains multiple API versions, to help you deal with all of the Azure clouds
(Azure Stack, Azure Government, Azure China, etc.).
By default, it uses the latest API version available on public Azure.
For production, you should stick to a particular api-version and/or profile.
The profile sets a mapping between an operation group and its API version.
The api-version parameter sets the default API version if the operation
group is not described in the profile.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).
:type subscription_id: str
:param str api_version: API version to use if no profile is provided, or if
missing in profile.
:param str base_url: Service URL
:param profile: A profile definition, from KnownProfiles to dict.
:type profile: azure.profiles.KnownProfiles
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""
DEFAULT_API_VERSION = '2020-05-01-preview'
_PROFILE_TAG = "azure.mgmt.azureadb2c.CPIMConfigurationClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION,
'b2_ctenants': '2019-01-01-preview',
}},
_PROFILE_TAG + " latest"
)
def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
api_version=None,
base_url=None,
profile=KnownProfiles.default,
**kwargs # type: Any
):
if not base_url:
base_url = 'https://management.azure.com'
self._config = CPIMConfigurationClientConfiguration(credential, subscription_id, **kwargs)
self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(CPIMConfigurationClient, self).__init__(
api_version=api_version,
profile=profile
)
@classmethod
def _models_dict(cls, api_version):
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
@classmethod
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 2019-01-01-preview: :mod:`v2019_01_01_preview.models<azure.mgmt.azureadb2c.v2019_01_01_preview.models>`
* 2020-05-01-preview: :mod:`v2020_05_01_preview.models<azure.mgmt.azureadb2c.v2020_05_01_preview.models>`
"""
if api_version == '2019-01-01-preview':
from .v2019_01_01_preview import models
return models
elif api_version == '2020-05-01-preview':
from .v2020_05_01_preview import models
return models
raise ValueError("API version {} is not available".format(api_version))
@property
def b2_ctenants(self):
"""Instance depends on the API version:
* 2019-01-01-preview: :class:`B2CTenantsOperations<azure.mgmt.azureadb2c.v2019_01_01_preview.operations.B2CTenantsOperations>`
"""
api_version = self._get_api_version('b2_ctenants')
if api_version == '2019-01-01-preview':
from .v2019_01_01_preview.operations import B2CTenantsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'b2_ctenants'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def guest_usages(self):
"""Instance depends on the API version:
* 2020-05-01-preview: :class:`GuestUsagesOperations<azure.mgmt.azureadb2c.v2020_05_01_preview.operations.GuestUsagesOperations>`
"""
api_version = self._get_api_version('guest_usages')
if api_version == '2020-05-01-preview':
from .v2020_05_01_preview.operations import GuestUsagesOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'guest_usages'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def operations(self):
"""Instance depends on the API version:
* 2019-01-01-preview: :class:`Operations<azure.mgmt.azureadb2c.v2019_01_01_preview.operations.Operations>`
* 2020-05-01-preview: :class:`Operations<azure.mgmt.azureadb2c.v2020_05_01_preview.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2019-01-01-preview':
from .v2019_01_01_preview.operations import Operations as OperationClass
elif api_version == '2020-05-01-preview':
from .v2020_05_01_preview.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
def close(self):
self._client.close()
def __enter__(self):
self._client.__enter__()
return self
def __exit__(self, *exc_details):
self._client.__exit__(*exc_details)
| 0.811041 | 0.108048 |
from typing import Any
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
from ._version import VERSION
class CPIMConfigurationClientConfiguration(Configuration):
"""Configuration for CPIMConfigurationClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).
:type subscription_id: str
"""
def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
**kwargs # type: Any
):
# type: (...) -> None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(CPIMConfigurationClientConfiguration, self).__init__(**kwargs)
self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-mgmt-azureadb2c/{}'.format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
|
azure-mgmt-azureadb2c
|
/azure-mgmt-azureadb2c-1.0.0b2.zip/azure-mgmt-azureadb2c-1.0.0b2/azure/mgmt/azureadb2c/_configuration.py
|
_configuration.py
|
from typing import Any
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
from ._version import VERSION
class CPIMConfigurationClientConfiguration(Configuration):
"""Configuration for CPIMConfigurationClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).
:type subscription_id: str
"""
def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
**kwargs # type: Any
):
# type: (...) -> None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(CPIMConfigurationClientConfiguration, self).__init__(**kwargs)
self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-mgmt-azureadb2c/{}'.format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
| 0.822225 | 0.087525 |
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Serializer, Deserializer
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from ._configuration import CPIMConfigurationClientConfiguration
class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Will be removed in final version of multiapi azure-core based client
"""
pass
class CPIMConfigurationClient(MultiApiClientMixin, _SDKClient):
"""CPIM Configuration Client.
This ready contains multiple API versions, to help you deal with all of the Azure clouds
(Azure Stack, Azure Government, Azure China, etc.).
By default, it uses the latest API version available on public Azure.
For production, you should stick to a particular api-version and/or profile.
The profile sets a mapping between an operation group and its API version.
The api-version parameter sets the default API version if the operation
group is not described in the profile.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).
:type subscription_id: str
:param str api_version: API version to use if no profile is provided, or if
missing in profile.
:param str base_url: Service URL
:param profile: A profile definition, from KnownProfiles to dict.
:type profile: azure.profiles.KnownProfiles
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""
DEFAULT_API_VERSION = '2020-05-01-preview'
_PROFILE_TAG = "azure.mgmt.azureadb2c.CPIMConfigurationClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION,
'b2_ctenants': '2019-01-01-preview',
}},
_PROFILE_TAG + " latest"
)
def __init__(
self,
credential, # type: "AsyncTokenCredential"
subscription_id, # type: str
api_version=None,
base_url=None,
profile=KnownProfiles.default,
**kwargs # type: Any
) -> None:
if not base_url:
base_url = 'https://management.azure.com'
self._config = CPIMConfigurationClientConfiguration(credential, subscription_id, **kwargs)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(CPIMConfigurationClient, self).__init__(
api_version=api_version,
profile=profile
)
@classmethod
def _models_dict(cls, api_version):
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
@classmethod
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 2019-01-01-preview: :mod:`v2019_01_01_preview.models<azure.mgmt.azureadb2c.v2019_01_01_preview.models>`
* 2020-05-01-preview: :mod:`v2020_05_01_preview.models<azure.mgmt.azureadb2c.v2020_05_01_preview.models>`
"""
if api_version == '2019-01-01-preview':
from ..v2019_01_01_preview import models
return models
elif api_version == '2020-05-01-preview':
from ..v2020_05_01_preview import models
return models
raise ValueError("API version {} is not available".format(api_version))
@property
def b2_ctenants(self):
"""Instance depends on the API version:
* 2019-01-01-preview: :class:`B2CTenantsOperations<azure.mgmt.azureadb2c.v2019_01_01_preview.aio.operations.B2CTenantsOperations>`
"""
api_version = self._get_api_version('b2_ctenants')
if api_version == '2019-01-01-preview':
from ..v2019_01_01_preview.aio.operations import B2CTenantsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'b2_ctenants'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def guest_usages(self):
"""Instance depends on the API version:
* 2020-05-01-preview: :class:`GuestUsagesOperations<azure.mgmt.azureadb2c.v2020_05_01_preview.aio.operations.GuestUsagesOperations>`
"""
api_version = self._get_api_version('guest_usages')
if api_version == '2020-05-01-preview':
from ..v2020_05_01_preview.aio.operations import GuestUsagesOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'guest_usages'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def operations(self):
"""Instance depends on the API version:
* 2019-01-01-preview: :class:`Operations<azure.mgmt.azureadb2c.v2019_01_01_preview.aio.operations.Operations>`
* 2020-05-01-preview: :class:`Operations<azure.mgmt.azureadb2c.v2020_05_01_preview.aio.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2019-01-01-preview':
from ..v2019_01_01_preview.aio.operations import Operations as OperationClass
elif api_version == '2020-05-01-preview':
from ..v2020_05_01_preview.aio.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
async def close(self):
await self._client.close()
async def __aenter__(self):
await self._client.__aenter__()
return self
async def __aexit__(self, *exc_details):
await self._client.__aexit__(*exc_details)
|
azure-mgmt-azureadb2c
|
/azure-mgmt-azureadb2c-1.0.0b2.zip/azure-mgmt-azureadb2c-1.0.0b2/azure/mgmt/azureadb2c/aio/_cpim_configuration_client.py
|
_cpim_configuration_client.py
|
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Serializer, Deserializer
from azure.profiles import KnownProfiles, ProfileDefinition
from azure.profiles.multiapiclient import MultiApiClientMixin
from ._configuration import CPIMConfigurationClientConfiguration
class _SDKClient(object):
def __init__(self, *args, **kwargs):
"""This is a fake class to support current implemetation of MultiApiClientMixin."
Will be removed in final version of multiapi azure-core based client
"""
pass
class CPIMConfigurationClient(MultiApiClientMixin, _SDKClient):
"""CPIM Configuration Client.
This ready contains multiple API versions, to help you deal with all of the Azure clouds
(Azure Stack, Azure Government, Azure China, etc.).
By default, it uses the latest API version available on public Azure.
For production, you should stick to a particular api-version and/or profile.
The profile sets a mapping between an operation group and its API version.
The api-version parameter sets the default API version if the operation
group is not described in the profile.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).
:type subscription_id: str
:param str api_version: API version to use if no profile is provided, or if
missing in profile.
:param str base_url: Service URL
:param profile: A profile definition, from KnownProfiles to dict.
:type profile: azure.profiles.KnownProfiles
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""
DEFAULT_API_VERSION = '2020-05-01-preview'
_PROFILE_TAG = "azure.mgmt.azureadb2c.CPIMConfigurationClient"
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION,
'b2_ctenants': '2019-01-01-preview',
}},
_PROFILE_TAG + " latest"
)
def __init__(
self,
credential, # type: "AsyncTokenCredential"
subscription_id, # type: str
api_version=None,
base_url=None,
profile=KnownProfiles.default,
**kwargs # type: Any
) -> None:
if not base_url:
base_url = 'https://management.azure.com'
self._config = CPIMConfigurationClientConfiguration(credential, subscription_id, **kwargs)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
super(CPIMConfigurationClient, self).__init__(
api_version=api_version,
profile=profile
)
@classmethod
def _models_dict(cls, api_version):
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
@classmethod
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 2019-01-01-preview: :mod:`v2019_01_01_preview.models<azure.mgmt.azureadb2c.v2019_01_01_preview.models>`
* 2020-05-01-preview: :mod:`v2020_05_01_preview.models<azure.mgmt.azureadb2c.v2020_05_01_preview.models>`
"""
if api_version == '2019-01-01-preview':
from ..v2019_01_01_preview import models
return models
elif api_version == '2020-05-01-preview':
from ..v2020_05_01_preview import models
return models
raise ValueError("API version {} is not available".format(api_version))
@property
def b2_ctenants(self):
"""Instance depends on the API version:
* 2019-01-01-preview: :class:`B2CTenantsOperations<azure.mgmt.azureadb2c.v2019_01_01_preview.aio.operations.B2CTenantsOperations>`
"""
api_version = self._get_api_version('b2_ctenants')
if api_version == '2019-01-01-preview':
from ..v2019_01_01_preview.aio.operations import B2CTenantsOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'b2_ctenants'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def guest_usages(self):
"""Instance depends on the API version:
* 2020-05-01-preview: :class:`GuestUsagesOperations<azure.mgmt.azureadb2c.v2020_05_01_preview.aio.operations.GuestUsagesOperations>`
"""
api_version = self._get_api_version('guest_usages')
if api_version == '2020-05-01-preview':
from ..v2020_05_01_preview.aio.operations import GuestUsagesOperations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'guest_usages'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
@property
def operations(self):
"""Instance depends on the API version:
* 2019-01-01-preview: :class:`Operations<azure.mgmt.azureadb2c.v2019_01_01_preview.aio.operations.Operations>`
* 2020-05-01-preview: :class:`Operations<azure.mgmt.azureadb2c.v2020_05_01_preview.aio.operations.Operations>`
"""
api_version = self._get_api_version('operations')
if api_version == '2019-01-01-preview':
from ..v2019_01_01_preview.aio.operations import Operations as OperationClass
elif api_version == '2020-05-01-preview':
from ..v2020_05_01_preview.aio.operations import Operations as OperationClass
else:
raise ValueError("API version {} does not have operation group 'operations'".format(api_version))
return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)))
async def close(self):
await self._client.close()
async def __aenter__(self):
await self._client.__aenter__()
return self
async def __aexit__(self, *exc_details):
await self._client.__aexit__(*exc_details)
| 0.802981 | 0.111676 |
from typing import Any
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
from .._version import VERSION
class CPIMConfigurationClientConfiguration(Configuration):
"""Configuration for CPIMConfigurationClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).
:type subscription_id: str
"""
def __init__(
self,
credential, # type: "AsyncTokenCredential"
subscription_id, # type: str
**kwargs # type: Any
) -> None:
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(CPIMConfigurationClientConfiguration, self).__init__(**kwargs)
self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-mgmt-azureadb2c/{}'.format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs: Any
) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
|
azure-mgmt-azureadb2c
|
/azure-mgmt-azureadb2c-1.0.0b2.zip/azure-mgmt-azureadb2c-1.0.0b2/azure/mgmt/azureadb2c/aio/_configuration.py
|
_configuration.py
|
from typing import Any
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
from .._version import VERSION
class CPIMConfigurationClientConfiguration(Configuration):
"""Configuration for CPIMConfigurationClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: The Azure subscription ID. This is a GUID-formatted string (e.g. 00000000-0000-0000-0000-000000000000).
:type subscription_id: str
"""
def __init__(
self,
credential, # type: "AsyncTokenCredential"
subscription_id, # type: str
**kwargs # type: Any
) -> None:
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(CPIMConfigurationClientConfiguration, self).__init__(**kwargs)
self.credential = credential
self.subscription_id = subscription_id
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'azure-mgmt-azureadb2c/{}'.format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs: Any
) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
| 0.837487 | 0.088151 |
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 ._configuration import CPIMConfigurationClientConfiguration
from .operations import B2CTenantsOperations
from .operations import Operations
from . import models
class CPIMConfigurationClient(object):
"""CPIM Configuration Client.
:ivar b2_ctenants: B2CTenantsOperations operations
:vartype b2_ctenants: $(python-base-namespace).v2019_01_01_preview.operations.B2CTenantsOperations
:ivar operations: Operations operations
:vartype operations: $(python-base-namespace).v2019_01_01_preview.operations.Operations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
: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
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""
def __init__(
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 = CPIMConfigurationClientConfiguration(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._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.b2_ctenants = B2CTenantsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self._config, self._serialize, self._deserialize)
def close(self):
# type: () -> None
self._client.close()
def __enter__(self):
# type: () -> CPIMConfigurationClient
self._client.__enter__()
return self
def __exit__(self, *exc_details):
# type: (Any) -> None
self._client.__exit__(*exc_details)
|
azure-mgmt-azureadb2c
|
/azure-mgmt-azureadb2c-1.0.0b2.zip/azure-mgmt-azureadb2c-1.0.0b2/azure/mgmt/azureadb2c/v2019_01_01_preview/_cpim_configuration_client.py
|
_cpim_configuration_client.py
|
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 ._configuration import CPIMConfigurationClientConfiguration
from .operations import B2CTenantsOperations
from .operations import Operations
from . import models
class CPIMConfigurationClient(object):
"""CPIM Configuration Client.
:ivar b2_ctenants: B2CTenantsOperations operations
:vartype b2_ctenants: $(python-base-namespace).v2019_01_01_preview.operations.B2CTenantsOperations
:ivar operations: Operations operations
:vartype operations: $(python-base-namespace).v2019_01_01_preview.operations.Operations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
: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
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""
def __init__(
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 = CPIMConfigurationClientConfiguration(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._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.b2_ctenants = B2CTenantsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self._config, self._serialize, self._deserialize)
def close(self):
# type: () -> None
self._client.close()
def __enter__(self):
# type: () -> CPIMConfigurationClient
self._client.__enter__()
return self
def __exit__(self, *exc_details):
# type: (Any) -> None
self._client.__exit__(*exc_details)
| 0.844729 | 0.089534 |
from typing import TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any
from azure.core.credentials import TokenCredential
VERSION = "unknown"
class CPIMConfigurationClientConfiguration(Configuration):
"""Configuration for CPIMConfigurationClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
: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
"""
def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
**kwargs # type: Any
):
# type: (...) -> None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(CPIMConfigurationClientConfiguration, self).__init__(**kwargs)
self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2019-01-01-preview"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-azureadb2c/{}'.format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
|
azure-mgmt-azureadb2c
|
/azure-mgmt-azureadb2c-1.0.0b2.zip/azure-mgmt-azureadb2c-1.0.0b2/azure/mgmt/azureadb2c/v2019_01_01_preview/_configuration.py
|
_configuration.py
|
from typing import TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any
from azure.core.credentials import TokenCredential
VERSION = "unknown"
class CPIMConfigurationClientConfiguration(Configuration):
"""Configuration for CPIMConfigurationClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
: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
"""
def __init__(
self,
credential, # type: "TokenCredential"
subscription_id, # type: str
**kwargs # type: Any
):
# type: (...) -> None
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(CPIMConfigurationClientConfiguration, self).__init__(**kwargs)
self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2019-01-01-preview"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-azureadb2c/{}'.format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs # type: Any
):
# type: (...) -> None
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
| 0.797872 | 0.073863 |
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRequest, HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
class B2CTenantsOperations(object):
"""B2CTenantsOperations operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~$(python-base-namespace).v2019_01_01_preview.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
models = _models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def check_name_availability(
self,
check_name_availability_request_body=None, # type: Optional["_models.CheckNameAvailabilityRequestBody"]
**kwargs # type: Any
):
# type: (...) -> "_models.NameAvailabilityResponse"
"""Checks the availability and validity of a domain name for the tenant.
:param check_name_availability_request_body:
:type check_name_availability_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CheckNameAvailabilityRequestBody
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityResponse, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.NameAvailabilityResponse
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailabilityResponse"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self.check_name_availability.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
if check_name_availability_request_body is not None:
body_content = self._serialize.body(check_name_availability_request_body, 'CheckNameAvailabilityRequestBody')
else:
body_content = None
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('NameAvailabilityResponse', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/checkNameAvailability'} # type: ignore
def list_by_resource_group(
self,
resource_group_name, # type: str
**kwargs # type: Any
):
# type: (...) -> Iterable["_models.B2CTenantResourceList"]
"""Get all the Azure AD B2C tenant resources in a resource group.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either B2CTenantResourceList or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResourceList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_by_resource_group.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
def extract_data(pipeline_response):
deserialized = self._deserialize('B2CTenantResourceList', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(
get_next, extract_data
)
list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore
def list_by_subscription(
self,
**kwargs # type: Any
):
# type: (...) -> Iterable["_models.B2CTenantResourceList"]
"""Get all the Azure AD B2C tenant resources in a subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either B2CTenantResourceList or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResourceList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_by_subscription.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
def extract_data(pipeline_response):
deserialized = self._deserialize('B2CTenantResourceList', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(
get_next, extract_data
)
list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore
def get(
self,
resource_group_name, # type: str
resource_name, # type: str
**kwargs # type: Any
):
# type: (...) -> "_models.B2CTenantResource"
"""Get the Azure AD B2C tenant resource.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: B2CTenantResource, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
# Construct URL
url = self.get.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
def update(
self,
resource_group_name, # type: str
resource_name, # type: str
update_tenant_request_body=None, # type: Optional["_models.B2CTenantUpdateRequest"]
**kwargs # type: Any
):
# type: (...) -> "_models.B2CTenantResource"
"""Update the Azure AD B2C tenant resource.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:param update_tenant_request_body:
:type update_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantUpdateRequest
:keyword callable cls: A custom type or function that will be passed the direct response
:return: B2CTenantResource, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self.update.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
if update_tenant_request_body is not None:
body_content = self._serialize.body(update_tenant_request_body, 'B2CTenantUpdateRequest')
else:
body_content = None
body_content_kwargs['content'] = body_content
request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
def _create_initial(
self,
resource_group_name, # type: str
resource_name, # type: str
create_tenant_request_body=None, # type: Optional["_models.CreateTenantRequestBody"]
**kwargs # type: Any
):
# type: (...) -> Optional["_models.B2CTenantResource"]
cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.B2CTenantResource"]]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self._create_initial.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
if create_tenant_request_body is not None:
body_content = self._serialize.body(create_tenant_request_body, 'CreateTenantRequestBody')
else:
body_content = None
body_content_kwargs['content'] = body_content
request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if response.status_code == 202:
response_headers['Location']=self._deserialize('str', response.headers.get('Location'))
response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After'))
if cls:
return cls(pipeline_response, deserialized, response_headers)
return deserialized
_create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
def begin_create(
self,
resource_group_name, # type: str
resource_name, # type: str
create_tenant_request_body=None, # type: Optional["_models.CreateTenantRequestBody"]
**kwargs # type: Any
):
# type: (...) -> LROPoller["_models.B2CTenantResource"]
"""Initiates an async request to create both the Azure AD B2C tenant and the corresponding Azure
resource linked to a subscription.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:param create_tenant_request_body:
:type create_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CreateTenantRequestBody
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of LROPoller that returns either B2CTenantResource or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = self._create_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
create_tenant_request_body=create_tenant_request_body,
cls=lambda x,y,z: x,
**kwargs
)
kwargs.pop('error_map', None)
kwargs.pop('content_type', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
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'),
}
if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = NoPolling()
else: polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
def _delete_initial(
self,
resource_group_name, # type: str
resource_name, # type: str
**kwargs # type: Any
):
# type: (...) -> None
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
# Construct URL
url = self._delete_initial.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
request = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers['Location']=self._deserialize('str', response.headers.get('Location'))
response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After'))
if cls:
return cls(pipeline_response, None, response_headers)
_delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
def begin_delete(
self,
resource_group_name, # type: str
resource_name, # type: str
**kwargs # type: Any
):
# type: (...) -> LROPoller[None]
"""Initiates an async operation to delete the Azure AD B2C tenant and Azure resource. The resource
deletion can only happen as the last step in `the tenant deletion process
<https://aka.ms/deleteB2Ctenant>`_.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType[None]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
cls=lambda x,y,z: x,
**kwargs
)
kwargs.pop('error_map', None)
kwargs.pop('content_type', None)
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})
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'),
}
if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = NoPolling()
else: polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
|
azure-mgmt-azureadb2c
|
/azure-mgmt-azureadb2c-1.0.0b2.zip/azure-mgmt-azureadb2c-1.0.0b2/azure/mgmt/azureadb2c/v2019_01_01_preview/operations/_b2_ctenants_operations.py
|
_b2_ctenants_operations.py
|
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRequest, HttpResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.arm_polling import ARMPolling
from .. import models as _models
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
class B2CTenantsOperations(object):
"""B2CTenantsOperations operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~$(python-base-namespace).v2019_01_01_preview.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
models = _models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def check_name_availability(
self,
check_name_availability_request_body=None, # type: Optional["_models.CheckNameAvailabilityRequestBody"]
**kwargs # type: Any
):
# type: (...) -> "_models.NameAvailabilityResponse"
"""Checks the availability and validity of a domain name for the tenant.
:param check_name_availability_request_body:
:type check_name_availability_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CheckNameAvailabilityRequestBody
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityResponse, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.NameAvailabilityResponse
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailabilityResponse"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self.check_name_availability.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
if check_name_availability_request_body is not None:
body_content = self._serialize.body(check_name_availability_request_body, 'CheckNameAvailabilityRequestBody')
else:
body_content = None
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('NameAvailabilityResponse', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/checkNameAvailability'} # type: ignore
def list_by_resource_group(
self,
resource_group_name, # type: str
**kwargs # type: Any
):
# type: (...) -> Iterable["_models.B2CTenantResourceList"]
"""Get all the Azure AD B2C tenant resources in a resource group.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either B2CTenantResourceList or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResourceList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_by_resource_group.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
def extract_data(pipeline_response):
deserialized = self._deserialize('B2CTenantResourceList', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(
get_next, extract_data
)
list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore
def list_by_subscription(
self,
**kwargs # type: Any
):
# type: (...) -> Iterable["_models.B2CTenantResourceList"]
"""Get all the Azure AD B2C tenant resources in a subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either B2CTenantResourceList or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResourceList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_by_subscription.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
def extract_data(pipeline_response):
deserialized = self._deserialize('B2CTenantResourceList', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(
get_next, extract_data
)
list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore
def get(
self,
resource_group_name, # type: str
resource_name, # type: str
**kwargs # type: Any
):
# type: (...) -> "_models.B2CTenantResource"
"""Get the Azure AD B2C tenant resource.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: B2CTenantResource, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
# Construct URL
url = self.get.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
def update(
self,
resource_group_name, # type: str
resource_name, # type: str
update_tenant_request_body=None, # type: Optional["_models.B2CTenantUpdateRequest"]
**kwargs # type: Any
):
# type: (...) -> "_models.B2CTenantResource"
"""Update the Azure AD B2C tenant resource.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:param update_tenant_request_body:
:type update_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantUpdateRequest
:keyword callable cls: A custom type or function that will be passed the direct response
:return: B2CTenantResource, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self.update.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
if update_tenant_request_body is not None:
body_content = self._serialize.body(update_tenant_request_body, 'B2CTenantUpdateRequest')
else:
body_content = None
body_content_kwargs['content'] = body_content
request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
def _create_initial(
self,
resource_group_name, # type: str
resource_name, # type: str
create_tenant_request_body=None, # type: Optional["_models.CreateTenantRequestBody"]
**kwargs # type: Any
):
# type: (...) -> Optional["_models.B2CTenantResource"]
cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.B2CTenantResource"]]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self._create_initial.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
if create_tenant_request_body is not None:
body_content = self._serialize.body(create_tenant_request_body, 'CreateTenantRequestBody')
else:
body_content = None
body_content_kwargs['content'] = body_content
request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if response.status_code == 202:
response_headers['Location']=self._deserialize('str', response.headers.get('Location'))
response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After'))
if cls:
return cls(pipeline_response, deserialized, response_headers)
return deserialized
_create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
def begin_create(
self,
resource_group_name, # type: str
resource_name, # type: str
create_tenant_request_body=None, # type: Optional["_models.CreateTenantRequestBody"]
**kwargs # type: Any
):
# type: (...) -> LROPoller["_models.B2CTenantResource"]
"""Initiates an async request to create both the Azure AD B2C tenant and the corresponding Azure
resource linked to a subscription.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:param create_tenant_request_body:
:type create_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CreateTenantRequestBody
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of LROPoller that returns either B2CTenantResource or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = self._create_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
create_tenant_request_body=create_tenant_request_body,
cls=lambda x,y,z: x,
**kwargs
)
kwargs.pop('error_map', None)
kwargs.pop('content_type', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
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'),
}
if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = NoPolling()
else: polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
def _delete_initial(
self,
resource_group_name, # type: str
resource_name, # type: str
**kwargs # type: Any
):
# type: (...) -> None
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
# Construct URL
url = self._delete_initial.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
request = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers['Location']=self._deserialize('str', response.headers.get('Location'))
response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After'))
if cls:
return cls(pipeline_response, None, response_headers)
_delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
def begin_delete(
self,
resource_group_name, # type: str
resource_name, # type: str
**kwargs # type: Any
):
# type: (...) -> LROPoller[None]
"""Initiates an async operation to delete the Azure AD B2C tenant and Azure resource. The resource
deletion can only happen as the last step in `the tenant deletion process
<https://aka.ms/deleteB2Ctenant>`_.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:paramtype polling: bool or ~azure.core.polling.PollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of LROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.LROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType[None]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = self._delete_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
cls=lambda x,y,z: x,
**kwargs
)
kwargs.pop('error_map', None)
kwargs.pop('content_type', None)
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})
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'),
}
if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = NoPolling()
else: polling_method = polling
if cont_token:
return LROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
| 0.813535 | 0.090735 |
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRequest, HttpResponse
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
class Operations(object):
"""Operations operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~$(python-base-namespace).v2019_01_01_preview.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
models = _models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def list(
self,
**kwargs # type: Any
):
# type: (...) -> Iterable["_models.OperationListResult"]
"""Lists the operations available from this provider.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationListResult or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.OperationListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list.metadata['url'] # type: ignore
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
def extract_data(pipeline_response):
deserialized = self._deserialize('OperationListResult', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(
get_next, extract_data
)
list.metadata = {'url': '/providers/Microsoft.AzureActiveDirectory/operations'} # type: ignore
def get_async_status(
self,
operation_id, # type: str
**kwargs # type: Any
):
# type: (...) -> "_models.AsyncOperationStatus"
"""Gets the status of the async operation.
:param operation_id: The operation ID.
:type operation_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AsyncOperationStatus, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.AsyncOperationStatus
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationStatus"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
# Construct URL
url = self.get_async_status.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'operationId': self._serialize.url("operation_id", operation_id, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('AsyncOperationStatus', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_async_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/operations/{operationId}'} # type: ignore
|
azure-mgmt-azureadb2c
|
/azure-mgmt-azureadb2c-1.0.0b2.zip/azure-mgmt-azureadb2c-1.0.0b2/azure/mgmt/azureadb2c/v2019_01_01_preview/operations/_operations.py
|
_operations.py
|
from typing import TYPE_CHECKING
import warnings
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.paging import ItemPaged
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import HttpRequest, HttpResponse
from azure.mgmt.core.exceptions import ARMErrorFormat
from .. import models as _models
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
class Operations(object):
"""Operations operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~$(python-base-namespace).v2019_01_01_preview.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
models = _models
def __init__(self, client, config, serializer, deserializer):
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def list(
self,
**kwargs # type: Any
):
# type: (...) -> Iterable["_models.OperationListResult"]
"""Lists the operations available from this provider.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationListResult or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.OperationListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list.metadata['url'] # type: ignore
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
def extract_data(pipeline_response):
deserialized = self._deserialize('OperationListResult', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, iter(list_of_elem)
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(
get_next, extract_data
)
list.metadata = {'url': '/providers/Microsoft.AzureActiveDirectory/operations'} # type: ignore
def get_async_status(
self,
operation_id, # type: str
**kwargs # type: Any
):
# type: (...) -> "_models.AsyncOperationStatus"
"""Gets the status of the async operation.
:param operation_id: The operation ID.
:type operation_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AsyncOperationStatus, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.AsyncOperationStatus
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationStatus"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
# Construct URL
url = self.get_async_status.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'operationId': self._serialize.url("operation_id", operation_id, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('AsyncOperationStatus', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_async_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/operations/{operationId}'} # type: ignore
| 0.836254 | 0.096323 |
from typing import Any, Optional, TYPE_CHECKING
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
from ._configuration import CPIMConfigurationClientConfiguration
from .operations import B2CTenantsOperations
from .operations import Operations
from .. import models
class CPIMConfigurationClient(object):
"""CPIM Configuration Client.
:ivar b2_ctenants: B2CTenantsOperations operations
:vartype b2_ctenants: $(python-base-namespace).v2019_01_01_preview.aio.operations.B2CTenantsOperations
:ivar operations: Operations operations
:vartype operations: $(python-base-namespace).v2019_01_01_preview.aio.operations.Operations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
: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
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
base_url: Optional[str] = None,
**kwargs: Any
) -> None:
if not base_url:
base_url = 'https://management.azure.com'
self._config = CPIMConfigurationClientConfiguration(credential, subscription_id, **kwargs)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.b2_ctenants = B2CTenantsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self._config, self._serialize, self._deserialize)
async def close(self) -> None:
await self._client.close()
async def __aenter__(self) -> "CPIMConfigurationClient":
await self._client.__aenter__()
return self
async def __aexit__(self, *exc_details) -> None:
await self._client.__aexit__(*exc_details)
|
azure-mgmt-azureadb2c
|
/azure-mgmt-azureadb2c-1.0.0b2.zip/azure-mgmt-azureadb2c-1.0.0b2/azure/mgmt/azureadb2c/v2019_01_01_preview/aio/_cpim_configuration_client.py
|
_cpim_configuration_client.py
|
from typing import Any, Optional, TYPE_CHECKING
from azure.mgmt.core import AsyncARMPipelineClient
from msrest import Deserializer, Serializer
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
from ._configuration import CPIMConfigurationClientConfiguration
from .operations import B2CTenantsOperations
from .operations import Operations
from .. import models
class CPIMConfigurationClient(object):
"""CPIM Configuration Client.
:ivar b2_ctenants: B2CTenantsOperations operations
:vartype b2_ctenants: $(python-base-namespace).v2019_01_01_preview.aio.operations.B2CTenantsOperations
:ivar operations: Operations operations
:vartype operations: $(python-base-namespace).v2019_01_01_preview.aio.operations.Operations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
: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
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
"""
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
base_url: Optional[str] = None,
**kwargs: Any
) -> None:
if not base_url:
base_url = 'https://management.azure.com'
self._config = CPIMConfigurationClientConfiguration(credential, subscription_id, **kwargs)
self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
self.b2_ctenants = B2CTenantsOperations(
self._client, self._config, self._serialize, self._deserialize)
self.operations = Operations(
self._client, self._config, self._serialize, self._deserialize)
async def close(self) -> None:
await self._client.close()
async def __aenter__(self) -> "CPIMConfigurationClient":
await self._client.__aenter__()
return self
async def __aexit__(self, *exc_details) -> None:
await self._client.__aexit__(*exc_details)
| 0.852905 | 0.103115 |
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
VERSION = "unknown"
class CPIMConfigurationClientConfiguration(Configuration):
"""Configuration for CPIMConfigurationClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
: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
"""
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(CPIMConfigurationClientConfiguration, self).__init__(**kwargs)
self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2019-01-01-preview"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-azureadb2c/{}'.format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs: Any
) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
|
azure-mgmt-azureadb2c
|
/azure-mgmt-azureadb2c-1.0.0b2.zip/azure-mgmt-azureadb2c-1.0.0b2/azure/mgmt/azureadb2c/v2019_01_01_preview/aio/_configuration.py
|
_configuration.py
|
from typing import Any, TYPE_CHECKING
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from azure.mgmt.core.policies import ARMHttpLoggingPolicy
if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials_async import AsyncTokenCredential
VERSION = "unknown"
class CPIMConfigurationClientConfiguration(Configuration):
"""Configuration for CPIMConfigurationClient.
Note that all parameters used to create this instance are saved as instance
attributes.
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
: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
"""
def __init__(
self,
credential: "AsyncTokenCredential",
subscription_id: str,
**kwargs: Any
) -> None:
if credential is None:
raise ValueError("Parameter 'credential' must not be None.")
if subscription_id is None:
raise ValueError("Parameter 'subscription_id' must not be None.")
super(CPIMConfigurationClientConfiguration, self).__init__(**kwargs)
self.credential = credential
self.subscription_id = subscription_id
self.api_version = "2019-01-01-preview"
self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default'])
kwargs.setdefault('sdk_moniker', 'mgmt-azureadb2c/{}'.format(VERSION))
self._configure(**kwargs)
def _configure(
self,
**kwargs: Any
) -> None:
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get('authentication_policy')
if self.credential and not self.authentication_policy:
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
| 0.824497 | 0.072014 |
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class B2CTenantsOperations:
"""B2CTenantsOperations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~$(python-base-namespace).v2019_01_01_preview.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
models = _models
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
async def check_name_availability(
self,
check_name_availability_request_body: Optional["_models.CheckNameAvailabilityRequestBody"] = None,
**kwargs
) -> "_models.NameAvailabilityResponse":
"""Checks the availability and validity of a domain name for the tenant.
:param check_name_availability_request_body:
:type check_name_availability_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CheckNameAvailabilityRequestBody
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityResponse, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.NameAvailabilityResponse
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailabilityResponse"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self.check_name_availability.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
if check_name_availability_request_body is not None:
body_content = self._serialize.body(check_name_availability_request_body, 'CheckNameAvailabilityRequestBody')
else:
body_content = None
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('NameAvailabilityResponse', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/checkNameAvailability'} # type: ignore
def list_by_resource_group(
self,
resource_group_name: str,
**kwargs
) -> AsyncIterable["_models.B2CTenantResourceList"]:
"""Get all the Azure AD B2C tenant resources in a resource group.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either B2CTenantResourceList or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResourceList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_by_resource_group.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize('B2CTenantResourceList', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore
def list_by_subscription(
self,
**kwargs
) -> AsyncIterable["_models.B2CTenantResourceList"]:
"""Get all the Azure AD B2C tenant resources in a subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either B2CTenantResourceList or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResourceList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_by_subscription.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize('B2CTenantResourceList', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore
async def get(
self,
resource_group_name: str,
resource_name: str,
**kwargs
) -> "_models.B2CTenantResource":
"""Get the Azure AD B2C tenant resource.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: B2CTenantResource, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
# Construct URL
url = self.get.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
async def update(
self,
resource_group_name: str,
resource_name: str,
update_tenant_request_body: Optional["_models.B2CTenantUpdateRequest"] = None,
**kwargs
) -> "_models.B2CTenantResource":
"""Update the Azure AD B2C tenant resource.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:param update_tenant_request_body:
:type update_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantUpdateRequest
:keyword callable cls: A custom type or function that will be passed the direct response
:return: B2CTenantResource, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self.update.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
if update_tenant_request_body is not None:
body_content = self._serialize.body(update_tenant_request_body, 'B2CTenantUpdateRequest')
else:
body_content = None
body_content_kwargs['content'] = body_content
request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
async def _create_initial(
self,
resource_group_name: str,
resource_name: str,
create_tenant_request_body: Optional["_models.CreateTenantRequestBody"] = None,
**kwargs
) -> Optional["_models.B2CTenantResource"]:
cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.B2CTenantResource"]]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self._create_initial.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
if create_tenant_request_body is not None:
body_content = self._serialize.body(create_tenant_request_body, 'CreateTenantRequestBody')
else:
body_content = None
body_content_kwargs['content'] = body_content
request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if response.status_code == 202:
response_headers['Location']=self._deserialize('str', response.headers.get('Location'))
response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After'))
if cls:
return cls(pipeline_response, deserialized, response_headers)
return deserialized
_create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
async def begin_create(
self,
resource_group_name: str,
resource_name: str,
create_tenant_request_body: Optional["_models.CreateTenantRequestBody"] = None,
**kwargs
) -> AsyncLROPoller["_models.B2CTenantResource"]:
"""Initiates an async request to create both the Azure AD B2C tenant and the corresponding Azure
resource linked to a subscription.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:param create_tenant_request_body:
:type create_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CreateTenantRequestBody
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either B2CTenantResource or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._create_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
create_tenant_request_body=create_tenant_request_body,
cls=lambda x,y,z: x,
**kwargs
)
kwargs.pop('error_map', None)
kwargs.pop('content_type', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
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'),
}
if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
async def _delete_initial(
self,
resource_group_name: str,
resource_name: str,
**kwargs
) -> None:
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
# Construct URL
url = self._delete_initial.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
request = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers['Location']=self._deserialize('str', response.headers.get('Location'))
response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After'))
if cls:
return cls(pipeline_response, None, response_headers)
_delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
async def begin_delete(
self,
resource_group_name: str,
resource_name: str,
**kwargs
) -> AsyncLROPoller[None]:
"""Initiates an async operation to delete the Azure AD B2C tenant and Azure resource. The resource
deletion can only happen as the last step in `the tenant deletion process
<https://aka.ms/deleteB2Ctenant>`_.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType[None]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
cls=lambda x,y,z: x,
**kwargs
)
kwargs.pop('error_map', None)
kwargs.pop('content_type', None)
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})
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'),
}
if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
|
azure-mgmt-azureadb2c
|
/azure-mgmt-azureadb2c-1.0.0b2.zip/azure-mgmt-azureadb2c-1.0.0b2/azure/mgmt/azureadb2c/v2019_01_01_preview/aio/operations/_b2_ctenants_operations.py
|
_b2_ctenants_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class B2CTenantsOperations:
"""B2CTenantsOperations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~$(python-base-namespace).v2019_01_01_preview.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
models = _models
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
async def check_name_availability(
self,
check_name_availability_request_body: Optional["_models.CheckNameAvailabilityRequestBody"] = None,
**kwargs
) -> "_models.NameAvailabilityResponse":
"""Checks the availability and validity of a domain name for the tenant.
:param check_name_availability_request_body:
:type check_name_availability_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CheckNameAvailabilityRequestBody
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailabilityResponse, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.NameAvailabilityResponse
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.NameAvailabilityResponse"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self.check_name_availability.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
if check_name_availability_request_body is not None:
body_content = self._serialize.body(check_name_availability_request_body, 'CheckNameAvailabilityRequestBody')
else:
body_content = None
body_content_kwargs['content'] = body_content
request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('NameAvailabilityResponse', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/checkNameAvailability'} # type: ignore
def list_by_resource_group(
self,
resource_group_name: str,
**kwargs
) -> AsyncIterable["_models.B2CTenantResourceList"]:
"""Get all the Azure AD B2C tenant resources in a resource group.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either B2CTenantResourceList or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResourceList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_by_resource_group.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize('B2CTenantResourceList', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore
def list_by_subscription(
self,
**kwargs
) -> AsyncIterable["_models.B2CTenantResourceList"]:
"""Get all the Azure AD B2C tenant resources in a subscription.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either B2CTenantResourceList or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResourceList]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResourceList"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list_by_subscription.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize('B2CTenantResourceList', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/b2cDirectories'} # type: ignore
async def get(
self,
resource_group_name: str,
resource_name: str,
**kwargs
) -> "_models.B2CTenantResource":
"""Get the Azure AD B2C tenant resource.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: B2CTenantResource, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
# Construct URL
url = self.get.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
async def update(
self,
resource_group_name: str,
resource_name: str,
update_tenant_request_body: Optional["_models.B2CTenantUpdateRequest"] = None,
**kwargs
) -> "_models.B2CTenantResource":
"""Update the Azure AD B2C tenant resource.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:param update_tenant_request_body:
:type update_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantUpdateRequest
:keyword callable cls: A custom type or function that will be passed the direct response
:return: B2CTenantResource, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self.update.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
if update_tenant_request_body is not None:
body_content = self._serialize.body(update_tenant_request_body, 'B2CTenantUpdateRequest')
else:
body_content = None
body_content_kwargs['content'] = body_content
request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
async def _create_initial(
self,
resource_group_name: str,
resource_name: str,
create_tenant_request_body: Optional["_models.CreateTenantRequestBody"] = None,
**kwargs
) -> Optional["_models.B2CTenantResource"]:
cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.B2CTenantResource"]]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
content_type = kwargs.pop("content_type", "application/json")
accept = "application/json"
# Construct URL
url = self._create_initial.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str')
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
body_content_kwargs = {} # type: Dict[str, Any]
if create_tenant_request_body is not None:
body_content = self._serialize.body(create_tenant_request_body, 'CreateTenantRequestBody')
else:
body_content = None
body_content_kwargs['content'] = body_content
request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200, 201, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
deserialized = None
if response.status_code == 200:
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if response.status_code == 201:
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if response.status_code == 202:
response_headers['Location']=self._deserialize('str', response.headers.get('Location'))
response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After'))
if cls:
return cls(pipeline_response, deserialized, response_headers)
return deserialized
_create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
async def begin_create(
self,
resource_group_name: str,
resource_name: str,
create_tenant_request_body: Optional["_models.CreateTenantRequestBody"] = None,
**kwargs
) -> AsyncLROPoller["_models.B2CTenantResource"]:
"""Initiates an async request to create both the Azure AD B2C tenant and the corresponding Azure
resource linked to a subscription.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:param create_tenant_request_body:
:type create_tenant_request_body: ~$(python-base-namespace).v2019_01_01_preview.models.CreateTenantRequestBody
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either B2CTenantResource or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[~$(python-base-namespace).v2019_01_01_preview.models.B2CTenantResource]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType["_models.B2CTenantResource"]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._create_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
create_tenant_request_body=create_tenant_request_body,
cls=lambda x,y,z: x,
**kwargs
)
kwargs.pop('error_map', None)
kwargs.pop('content_type', None)
def get_long_running_output(pipeline_response):
deserialized = self._deserialize('B2CTenantResource', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
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'),
}
if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
async def _delete_initial(
self,
resource_group_name: str,
resource_name: str,
**kwargs
) -> None:
cls = kwargs.pop('cls', None) # type: ClsType[None]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
# Construct URL
url = self._delete_initial.metadata['url'] # type: ignore
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 = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
request = self._client.delete(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200, 202, 204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
response_headers = {}
if response.status_code == 202:
response_headers['Location']=self._deserialize('str', response.headers.get('Location'))
response_headers['Retry-After']=self._deserialize('str', response.headers.get('Retry-After'))
if cls:
return cls(pipeline_response, None, response_headers)
_delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
async def begin_delete(
self,
resource_group_name: str,
resource_name: str,
**kwargs
) -> AsyncLROPoller[None]:
"""Initiates an async operation to delete the Azure AD B2C tenant and Azure resource. The resource
deletion can only happen as the last step in `the tenant deletion process
<https://aka.ms/deleteB2Ctenant>`_.
:param resource_group_name: The name of the resource group.
:type resource_group_name: str
:param resource_name: The initial domain name of the B2C tenant.
:type resource_name: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: True for ARMPolling, False for no polling, or a
polling object for personal polling strategy
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
cls = kwargs.pop('cls', None) # type: ClsType[None]
lro_delay = kwargs.pop(
'polling_interval',
self._config.polling_interval
)
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
if cont_token is None:
raw_result = await self._delete_initial(
resource_group_name=resource_group_name,
resource_name=resource_name,
cls=lambda x,y,z: x,
**kwargs
)
kwargs.pop('error_map', None)
kwargs.pop('content_type', None)
def get_long_running_output(pipeline_response):
if cls:
return cls(pipeline_response, None, {})
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'),
}
if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs)
elif polling is False: polling_method = AsyncNoPolling()
else: polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output
)
else:
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AzureActiveDirectory/b2cDirectories/{resourceName}'} # type: ignore
| 0.858526 | 0.111386 |
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class Operations:
"""Operations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~$(python-base-namespace).v2019_01_01_preview.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
models = _models
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def list(
self,
**kwargs
) -> AsyncIterable["_models.OperationListResult"]:
"""Lists the operations available from this provider.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationListResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.OperationListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list.metadata['url'] # type: ignore
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize('OperationListResult', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list.metadata = {'url': '/providers/Microsoft.AzureActiveDirectory/operations'} # type: ignore
async def get_async_status(
self,
operation_id: str,
**kwargs
) -> "_models.AsyncOperationStatus":
"""Gets the status of the async operation.
:param operation_id: The operation ID.
:type operation_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AsyncOperationStatus, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.AsyncOperationStatus
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationStatus"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
# Construct URL
url = self.get_async_status.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'operationId': self._serialize.url("operation_id", operation_id, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('AsyncOperationStatus', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_async_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/operations/{operationId}'} # type: ignore
|
azure-mgmt-azureadb2c
|
/azure-mgmt-azureadb2c-1.0.0b2.zip/azure-mgmt-azureadb2c-1.0.0b2/azure/mgmt/azureadb2c/v2019_01_01_preview/aio/operations/_operations.py
|
_operations.py
|
from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar
import warnings
from azure.core.async_paging import AsyncItemPaged, AsyncList
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
from azure.mgmt.core.exceptions import ARMErrorFormat
from ... import models as _models
T = TypeVar('T')
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class Operations:
"""Operations async operations.
You should not instantiate this class directly. Instead, you should create a Client instance that
instantiates it for you and attaches it as an attribute.
:ivar models: Alias to model classes used in this operation group.
:type models: ~$(python-base-namespace).v2019_01_01_preview.models
:param client: Client for service requests.
:param config: Configuration of service client.
:param serializer: An object model serializer.
:param deserializer: An object model deserializer.
"""
models = _models
def __init__(self, client, config, serializer, deserializer) -> None:
self._client = client
self._serialize = serializer
self._deserialize = deserializer
self._config = config
def list(
self,
**kwargs
) -> AsyncIterable["_models.OperationListResult"]:
"""Lists the operations available from this provider.
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either OperationListResult or the result of cls(response)
:rtype: ~azure.core.async_paging.AsyncItemPaged[~$(python-base-namespace).v2019_01_01_preview.models.OperationListResult]
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
def prepare_request(next_link=None):
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
if not next_link:
# Construct URL
url = self.list.metadata['url'] # type: ignore
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {} # type: Dict[str, Any]
request = self._client.get(url, query_parameters, header_parameters)
return request
async def extract_data(pipeline_response):
deserialized = self._deserialize('OperationListResult', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return None, AsyncList(list_of_elem)
async def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return AsyncItemPaged(
get_next, extract_data
)
list.metadata = {'url': '/providers/Microsoft.AzureActiveDirectory/operations'} # type: ignore
async def get_async_status(
self,
operation_id: str,
**kwargs
) -> "_models.AsyncOperationStatus":
"""Gets the status of the async operation.
:param operation_id: The operation ID.
:type operation_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: AsyncOperationStatus, or the result of cls(response)
:rtype: ~$(python-base-namespace).v2019_01_01_preview.models.AsyncOperationStatus
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["_models.AsyncOperationStatus"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2019-01-01-preview"
accept = "application/json"
# Construct URL
url = self.get_async_status.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'operationId': self._serialize.url("operation_id", operation_id, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
query_parameters = {} # type: Dict[str, Any]
query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str')
# Construct headers
header_parameters = {} # type: Dict[str, Any]
header_parameters['Accept'] = self._serialize.header("accept", accept, 'str')
request = self._client.get(url, query_parameters, header_parameters)
pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
deserialized = self._deserialize('AsyncOperationStatus', pipeline_response)
if cls:
return cls(pipeline_response, deserialized, {})
return deserialized
get_async_status.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.AzureActiveDirectory/operations/{operationId}'} # type: ignore
| 0.866048 | 0.117572 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.