Skip to content

Commit

Permalink
Generated from af3fae7cd65f1b4588fdbb5ff9dc8f662e0e0776
Browse files Browse the repository at this point in the history
  • Loading branch information
SDK Automation committed Nov 5, 2020
1 parent 05c65a8 commit 83893ca
Show file tree
Hide file tree
Showing 13 changed files with 296 additions and 30 deletions.
10 changes: 8 additions & 2 deletions sdk/communication/azure-mgmt-communication/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ For a more complete view of Azure libraries, see the [azure sdk python release](

# Usage

For code examples, see [Communication Management](https://docs.microsoft.com/python/api/overview/azure/)
on docs.microsoft.com.

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 [Communication Management](https://docs.microsoft.com/samples/azure-samples/azure-samples-python-management/) 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CommunicationServiceManagementClient(object):
:vartype operation_statuses: communication_service_management_client.operations.OperationStatusesOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Gets subscription ID which uniquely identifies the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class CommunicationServiceManagementClientConfiguration(Configuration):
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param subscription_id: Gets subscription ID which uniquely identifies the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"subscription_id": {
"method_signature": "subscription_id, # type: str",
"description": "Gets subscription ID which uniquely identifies the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
"description": "The ID of the target subscription.",
"docstring_type": "str",
"required": true
}
Expand All @@ -34,7 +34,7 @@
},
"subscription_id": {
"method_signature": "subscription_id, # type: str",
"description": "Gets subscription ID which uniquely identifies the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.",
"description": "The ID of the target subscription.",
"docstring_type": "str",
"required": true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

VERSION = "1.0.0b3"
VERSION = "1.0.0rc1"
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CommunicationServiceManagementClient(object):
:vartype operation_statuses: communication_service_management_client.aio.operations.OperationStatusesOperations
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Gets subscription ID which uniquely identifies the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
:param str base_url: Service URL
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class CommunicationServiceManagementClientConfiguration(Configuration):
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
:param subscription_id: Gets subscription ID which uniquely identifies the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.
:param subscription_id: The ID of the target subscription.
:type subscription_id: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,70 @@ def __init__(self, client, config, serializer, deserializer) -> None:
self._deserialize = deserializer
self._config = config

async def check_name_availability(
self,
name_availability_parameters: Optional["models.NameAvailabilityParameters"] = None,
**kwargs
) -> "models.NameAvailability":
"""Check Name Availability.
Checks that the CommunicationService name is valid and is not already in use.
:param name_availability_parameters: Parameters supplied to the operation.
:type name_availability_parameters: ~communication_service_management_client.models.NameAvailabilityParameters
:keyword callable cls: A custom type or function that will be passed the direct response
:return: NameAvailability, or the result of cls(response)
:rtype: ~communication_service_management_client.models.NameAvailability
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType["models.NameAvailability"]
error_map = {
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
}
error_map.update(kwargs.pop('error_map', {}))
api_version = "2020-08-20-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', min_length=1),
}
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 name_availability_parameters is not None:
body_content = self._serialize.body(name_availability_parameters, 'NameAvailabilityParameters')
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)
error = self._deserialize(models.ErrorResponse, response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)

deserialized = self._deserialize('NameAvailability', pipeline_response)

if cls:
return cls(pipeline_response, deserialized, {})

return deserialized
check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Communication/checkNameAvailability'} # type: ignore

async def link_notification_hub(
self,
resource_group_name: str,
Expand Down Expand Up @@ -78,7 +142,7 @@ async def link_notification_hub(
# Construct URL
url = self.link_notification_hub.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'),
}
Expand Down Expand Up @@ -146,7 +210,7 @@ def prepare_request(next_link=None):
# 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'),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
}
url = self._client.format_url(url, **path_format_arguments)
# Construct parameters
Expand Down Expand Up @@ -219,7 +283,7 @@ def prepare_request(next_link=None):
# 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'),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
}
url = self._client.format_url(url, **path_format_arguments)
Expand Down Expand Up @@ -294,7 +358,7 @@ async def update(
# 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'),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'),
}
Expand Down Expand Up @@ -363,7 +427,7 @@ async def get(
# 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'),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'),
}
Expand Down Expand Up @@ -413,7 +477,7 @@ async def _create_or_update_initial(
# Construct URL
url = self._create_or_update_initial.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'),
}
Expand Down Expand Up @@ -545,7 +609,7 @@ async def _delete_initial(
# 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'),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'),
}
Expand Down Expand Up @@ -669,7 +733,7 @@ async def list_keys(
# Construct URL
url = self.list_keys.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'),
}
Expand Down Expand Up @@ -736,7 +800,7 @@ async def regenerate_key(
# Construct URL
url = self.regenerate_key.metadata['url'] # type: ignore
path_format_arguments = {
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'),
'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', min_length=1),
'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'),
'communicationServiceName': self._serialize.url("communication_service_name", communication_service_name, 'str'),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
from ._models_py3 import LinkedNotificationHub
from ._models_py3 import LocationResource
from ._models_py3 import MetricSpecification
from ._models_py3 import NameAvailability
from ._models_py3 import NameAvailabilityParameters
from ._models_py3 import Operation
from ._models_py3 import OperationDisplay
from ._models_py3 import OperationList
Expand All @@ -37,6 +39,8 @@
from ._models import LinkedNotificationHub # type: ignore
from ._models import LocationResource # type: ignore
from ._models import MetricSpecification # type: ignore
from ._models import NameAvailability # type: ignore
from ._models import NameAvailabilityParameters # type: ignore
from ._models import Operation # type: ignore
from ._models import OperationDisplay # type: ignore
from ._models import OperationList # type: ignore
Expand Down Expand Up @@ -65,6 +69,8 @@
'LinkedNotificationHub',
'LocationResource',
'MetricSpecification',
'NameAvailability',
'NameAvailabilityParameters',
'Operation',
'OperationDisplay',
'OperationList',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,65 @@ def __init__(
self.dimensions = kwargs.get('dimensions', None)


class NameAvailability(msrest.serialization.Model):
"""Result of the request to check name availability. It contains a flag and possible reason of failure.
:param name_available: Indicates whether the name is available or not.
:type name_available: bool
:param reason: The reason of the availability. Required if name is not available.
:type reason: str
:param message: The message of the operation.
:type message: str
"""

_attribute_map = {
'name_available': {'key': 'nameAvailable', 'type': 'bool'},
'reason': {'key': 'reason', 'type': 'str'},
'message': {'key': 'message', 'type': 'str'},
}

def __init__(
self,
**kwargs
):
super(NameAvailability, self).__init__(**kwargs)
self.name_available = kwargs.get('name_available', None)
self.reason = kwargs.get('reason', None)
self.message = kwargs.get('message', None)


class NameAvailabilityParameters(msrest.serialization.Model):
"""Data POST-ed to the nameAvailability action.
All required parameters must be populated in order to send to Azure.
:param type: Required. The resource type. Should be always
"Microsoft.Communication/CommunicationServices".
:type type: str
:param name: Required. The CommunicationService name to validate. e.g."my-CommunicationService-
name-here".
:type name: str
"""

_validation = {
'type': {'required': True},
'name': {'required': True},
}

_attribute_map = {
'type': {'key': 'type', 'type': 'str'},
'name': {'key': 'name', 'type': 'str'},
}

def __init__(
self,
**kwargs
):
super(NameAvailabilityParameters, self).__init__(**kwargs)
self.type = kwargs['type']
self.name = kwargs['name']


class Operation(msrest.serialization.Model):
"""REST API operation supported by CommunicationService resource provider.
Expand Down Expand Up @@ -526,7 +585,7 @@ class OperationStatus(msrest.serialization.Model):
Variables are only populated by the server, and will be ignored when sending a request.
:ivar id: The operation Id.
:ivar id: Fully qualified ID for the operation status.
:vartype id: str
:ivar status: Provisioning state of the resource. Possible values include: "Succeeded",
"Failed", "Canceled", "Creating", "Deleting", "Moving".
Expand Down
Loading

0 comments on commit 83893ca

Please sign in to comment.