From 8099035808ae71635169ef311b1455c171d17892 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 12 Jan 2021 03:01:18 +0000 Subject: [PATCH] CodeGen from PR 12379 in Azure/azure-rest-api-specs Merge 2a420ffc8c17899282ee618af65815e9685c18a9 into 561bb284631497765f1e48aced100e15a1ed7b96 --- .../signalr/_signal_rmanagement_client.py | 12 +- .../azure/mgmt/signalr/models/__init__.py | 41 ++- .../azure/mgmt/signalr/models/_models.py | 169 ++++++++-- .../azure/mgmt/signalr/models/_models_py3.py | 177 +++++++++-- .../mgmt/signalr/models/_paged_models.py | 16 +- .../_signal_rmanagement_client_enums.py | 69 ++-- .../azure/mgmt/signalr/operations/__init__.py | 4 +- .../mgmt/signalr/operations/_operations.py | 4 +- .../signalr/operations/_signal_roperations.py | 300 +++++++++--------- ...private_endpoint_connections_operations.py | 4 +- ...gnal_rprivate_link_resources_operations.py | 4 +- .../signalr/operations/_usages_operations.py | 4 +- 12 files changed, 547 insertions(+), 257 deletions(-) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py index 246e90ae7efb..d78e5b4c1cee 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/_signal_rmanagement_client.py @@ -15,9 +15,9 @@ from ._configuration import SignalRManagementClientConfiguration from .operations import Operations from .operations import SignalROperations +from .operations import UsagesOperations from .operations import SignalRPrivateEndpointConnectionsOperations from .operations import SignalRPrivateLinkResourcesOperations -from .operations import UsagesOperations from . import models @@ -31,12 +31,12 @@ class SignalRManagementClient(SDKClient): :vartype operations: azure.mgmt.signalr.operations.Operations :ivar signal_r: SignalR operations :vartype signal_r: azure.mgmt.signalr.operations.SignalROperations + :ivar usages: Usages operations + :vartype usages: azure.mgmt.signalr.operations.UsagesOperations :ivar signal_rprivate_endpoint_connections: SignalRPrivateEndpointConnections operations :vartype signal_rprivate_endpoint_connections: azure.mgmt.signalr.operations.SignalRPrivateEndpointConnectionsOperations :ivar signal_rprivate_link_resources: SignalRPrivateLinkResources operations :vartype signal_rprivate_link_resources: azure.mgmt.signalr.operations.SignalRPrivateLinkResourcesOperations - :ivar usages: Usages operations - :vartype usages: azure.mgmt.signalr.operations.UsagesOperations :param credentials: Credentials needed for the client to connect to Azure. :type credentials: :mod:`A msrestazure Credentials @@ -55,7 +55,7 @@ def __init__( super(SignalRManagementClient, self).__init__(self.config.credentials, self.config) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} - self.api_version = '2020-05-01' + self.api_version = '2020-07-01-preview' self._serialize = Serializer(client_models) self._deserialize = Deserializer(client_models) @@ -63,9 +63,9 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.signal_r = SignalROperations( self._client, self.config, self._serialize, self._deserialize) + self.usages = UsagesOperations( + self._client, self.config, self._serialize, self._deserialize) self.signal_rprivate_endpoint_connections = SignalRPrivateEndpointConnectionsOperations( self._client, self.config, self._serialize, self._deserialize) self.signal_rprivate_link_resources = SignalRPrivateLinkResourcesOperations( self._client, self.config, self._serialize, self._deserialize) - self.usages = UsagesOperations( - self._client, self.config, self._serialize, self._deserialize) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py index a2612c3664be..677a42a208c1 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/__init__.py @@ -14,6 +14,8 @@ from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import ErrorResponseBody from ._models_py3 import LogSpecification + from ._models_py3 import ManagedIdentity + from ._models_py3 import ManagedIdentitySettings from ._models_py3 import MetricSpecification from ._models_py3 import NameAvailability from ._models_py3 import NameAvailabilityParameters @@ -38,15 +40,20 @@ from ._models_py3 import SignalRKeys from ._models_py3 import SignalRNetworkACLs from ._models_py3 import SignalRResource + from ._models_py3 import SignalRTlsSettings from ._models_py3 import SignalRUsage from ._models_py3 import SignalRUsageName from ._models_py3 import TrackedResource + from ._models_py3 import UpstreamAuthSettings from ._models_py3 import UpstreamTemplate + from ._models_py3 import UserAssignedIdentityProperty except (SyntaxError, ImportError): from ._models import Dimension from ._models import ErrorResponse, ErrorResponseException from ._models import ErrorResponseBody from ._models import LogSpecification + from ._models import ManagedIdentity + from ._models import ManagedIdentitySettings from ._models import MetricSpecification from ._models import NameAvailability from ._models import NameAvailabilityParameters @@ -71,23 +78,28 @@ from ._models import SignalRKeys from ._models import SignalRNetworkACLs from ._models import SignalRResource + from ._models import SignalRTlsSettings from ._models import SignalRUsage from ._models import SignalRUsageName from ._models import TrackedResource + from ._models import UpstreamAuthSettings from ._models import UpstreamTemplate + from ._models import UserAssignedIdentityProperty from ._paged_models import OperationPaged from ._paged_models import PrivateLinkResourcePaged from ._paged_models import SignalRResourcePaged from ._paged_models import SignalRUsagePaged from ._signal_rmanagement_client_enums import ( - SignalRSkuTier, + ACLAction, + FeatureFlags, + KeyType, + ManagedIdentityType, + SignalRRequestType, ProvisioningState, PrivateLinkServiceConnectionStatus, + SignalRSkuTier, + UpstreamAuthType, ServiceKind, - FeatureFlags, - ACLAction, - SignalRRequestType, - KeyType, ) __all__ = [ @@ -95,6 +107,8 @@ 'ErrorResponse', 'ErrorResponseException', 'ErrorResponseBody', 'LogSpecification', + 'ManagedIdentity', + 'ManagedIdentitySettings', 'MetricSpecification', 'NameAvailability', 'NameAvailabilityParameters', @@ -119,20 +133,25 @@ 'SignalRKeys', 'SignalRNetworkACLs', 'SignalRResource', + 'SignalRTlsSettings', 'SignalRUsage', 'SignalRUsageName', 'TrackedResource', + 'UpstreamAuthSettings', 'UpstreamTemplate', + 'UserAssignedIdentityProperty', 'OperationPaged', 'SignalRResourcePaged', - 'PrivateLinkResourcePaged', 'SignalRUsagePaged', - 'SignalRSkuTier', + 'PrivateLinkResourcePaged', + 'ACLAction', + 'FeatureFlags', + 'KeyType', + 'ManagedIdentityType', + 'SignalRRequestType', 'ProvisioningState', 'PrivateLinkServiceConnectionStatus', + 'SignalRSkuTier', + 'UpstreamAuthType', 'ServiceKind', - 'FeatureFlags', - 'ACLAction', - 'SignalRRequestType', - 'KeyType', ] diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models.py index 875bc362b9ee..ae08dbbe0167 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models.py @@ -138,6 +138,64 @@ def __init__(self, **kwargs): self.display_name = kwargs.get('display_name', None) +class ManagedIdentity(Model): + """A class represent managed identities used for request and response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param type: Represent the identity type: systemAssigned, userAssigned, + None. Possible values include: 'None', 'SystemAssigned', 'UserAssigned' + :type type: str or ~azure.mgmt.signalr.models.ManagedIdentityType + :param user_assigned_identities: Get or set the user assigned identities + :type user_assigned_identities: dict[str, + ~azure.mgmt.signalr.models.UserAssignedIdentityProperty] + :ivar principal_id: Get the principal id for the system assigned identity. + Only be used in response. + :vartype principal_id: str + :ivar tenant_id: Get the tenant id for the system assigned identity. + Only be used in response + :vartype tenant_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentityProperty}'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManagedIdentity, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + self.principal_id = None + self.tenant_id = None + + +class ManagedIdentitySettings(Model): + """Managed identity settings for upstream. + + :param resource: The Resource indicating the App ID URI of the target + resource. + It also appears in the aud (audience) claim of the issued token. + :type resource: str + """ + + _attribute_map = { + 'resource': {'key': 'resource', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ManagedIdentitySettings, self).__init__(**kwargs) + self.resource = kwargs.get('resource', None) + + class MetricSpecification(Model): """Specifications of the Metrics for Azure Monitoring. @@ -599,6 +657,9 @@ def __init__(self, **kwargs): class ResourceSku(Model): """The billing information of the SignalR 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. :param name: Required. The name of the SKU. Required. @@ -608,10 +669,10 @@ class ResourceSku(Model): `Basic` is deprecated, use `Standard` instead. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' :type tier: str or ~azure.mgmt.signalr.models.SignalRSkuTier - :param size: Optional string. For future use. - :type size: str - :param family: Optional string. For future use. - :type family: str + :ivar size: Not used. Retained for future use. + :vartype size: str + :ivar family: Not used. Retained for future use. + :vartype family: str :param capacity: Optional, integer. The unit count of SignalR resource. 1 by default. If present, following values are allowed: @@ -622,6 +683,8 @@ class ResourceSku(Model): _validation = { 'name': {'required': True}, + 'size': {'readonly': True}, + 'family': {'readonly': True}, } _attribute_map = { @@ -636,8 +699,8 @@ def __init__(self, **kwargs): super(ResourceSku, self).__init__(**kwargs) self.name = kwargs.get('name', None) self.tier = kwargs.get('tier', None) - self.size = kwargs.get('size', None) - self.family = kwargs.get('family', None) + self.size = None + self.family = None self.capacity = kwargs.get('capacity', None) @@ -705,11 +768,6 @@ def __init__(self, **kwargs): class SignalRCreateOrUpdateProperties(Model): """Settings used to provision or configure the resource. - :param host_name_prefix: Prefix for the hostName of the SignalR service. - Retained for future use. - The hostname will be of format: - <hostNamePrefix>.service.signalr.net. - :type host_name_prefix: str :param features: List of SignalR featureFlags. e.g. ServiceMode. FeatureFlags that are not included in the parameters for the update operation will not be modified. @@ -729,7 +787,6 @@ class SignalRCreateOrUpdateProperties(Model): """ _attribute_map = { - 'host_name_prefix': {'key': 'hostNamePrefix', 'type': 'str'}, 'features': {'key': 'features', 'type': '[SignalRFeature]'}, 'cors': {'key': 'cors', 'type': 'SignalRCorsSettings'}, 'upstream': {'key': 'upstream', 'type': 'ServerlessUpstreamSettings'}, @@ -738,7 +795,6 @@ class SignalRCreateOrUpdateProperties(Model): def __init__(self, **kwargs): super(SignalRCreateOrUpdateProperties, self).__init__(**kwargs) - self.host_name_prefix = kwargs.get('host_name_prefix', None) self.features = kwargs.get('features', None) self.cors = kwargs.get('cors', None) self.upstream = kwargs.get('upstream', None) @@ -905,11 +961,6 @@ class SignalRResource(TrackedResource): :type tags: dict[str, str] :param sku: The billing information of the resource.(e.g. Free, Standard) :type sku: ~azure.mgmt.signalr.models.ResourceSku - :param host_name_prefix: Prefix for the hostName of the SignalR service. - Retained for future use. - The hostname will be of format: - <hostNamePrefix>.service.signalr.net. - :type host_name_prefix: str :param features: List of SignalR featureFlags. e.g. ServiceMode. FeatureFlags that are not included in the parameters for the update operation will not be modified. @@ -949,10 +1000,14 @@ class SignalRResource(TrackedResource): SignalR resource. :vartype private_endpoint_connections: list[~azure.mgmt.signalr.models.PrivateEndpointConnection] + :param tls: TLS settings. + :type tls: ~azure.mgmt.signalr.models.SignalRTlsSettings :param kind: The kind of the service - e.g. "SignalR", or "RawWebSockets" for "Microsoft.SignalRService/SignalR". Possible values include: 'SignalR', 'RawWebSockets' :type kind: str or ~azure.mgmt.signalr.models.ServiceKind + :param identity: The managed identity response + :type identity: ~azure.mgmt.signalr.models.ManagedIdentity """ _validation = { @@ -975,7 +1030,6 @@ class SignalRResource(TrackedResource): 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'ResourceSku'}, - 'host_name_prefix': {'key': 'properties.hostNamePrefix', 'type': 'str'}, 'features': {'key': 'properties.features', 'type': '[SignalRFeature]'}, 'cors': {'key': 'properties.cors', 'type': 'SignalRCorsSettings'}, 'upstream': {'key': 'properties.upstream', 'type': 'ServerlessUpstreamSettings'}, @@ -987,13 +1041,14 @@ class SignalRResource(TrackedResource): 'server_port': {'key': 'properties.serverPort', 'type': 'int'}, 'version': {'key': 'properties.version', 'type': 'str'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'tls': {'key': 'properties.tls', 'type': 'SignalRTlsSettings'}, 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, } def __init__(self, **kwargs): super(SignalRResource, self).__init__(**kwargs) self.sku = kwargs.get('sku', None) - self.host_name_prefix = kwargs.get('host_name_prefix', None) self.features = kwargs.get('features', None) self.cors = kwargs.get('cors', None) self.upstream = kwargs.get('upstream', None) @@ -1005,7 +1060,26 @@ def __init__(self, **kwargs): self.server_port = None self.version = None self.private_endpoint_connections = None + self.tls = kwargs.get('tls', None) self.kind = kwargs.get('kind', None) + self.identity = kwargs.get('identity', None) + + +class SignalRTlsSettings(Model): + """TLS settings for SignalR. + + :param client_cert_enabled: Request client certificate during TLS + handshake if enabled + :type client_cert_enabled: bool + """ + + _attribute_map = { + 'client_cert_enabled': {'key': 'clientCertEnabled', 'type': 'bool'}, + } + + def __init__(self, **kwargs): + super(SignalRTlsSettings, self).__init__(**kwargs) + self.client_cert_enabled = kwargs.get('client_cert_enabled', None) class SignalRUsage(Model): @@ -1063,6 +1137,28 @@ def __init__(self, **kwargs): self.localized_value = kwargs.get('localized_value', None) +class UpstreamAuthSettings(Model): + """Upstream auth settings. + + :param type: Gets or sets the type of auth. None or ManagedIdentity is + supported now. Possible values include: 'None', 'ManagedIdentity' + :type type: str or ~azure.mgmt.signalr.models.UpstreamAuthType + :param managed_identity: Gets or sets the managed identity settings. It's + required if the auth type is set to ManagedIdentity. + :type managed_identity: ~azure.mgmt.signalr.models.ManagedIdentitySettings + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'managed_identity': {'key': 'managedIdentity', 'type': 'ManagedIdentitySettings'}, + } + + def __init__(self, **kwargs): + super(UpstreamAuthSettings, self).__init__(**kwargs) + self.type = kwargs.get('type', None) + self.managed_identity = kwargs.get('managed_identity', None) + + class UpstreamTemplate(Model): """Upstream template item settings. It defines the Upstream URL of the incoming requests. @@ -1104,6 +1200,9 @@ class UpstreamTemplate(Model): with a client request from hub `chat` connects, it will first POST to this URL: `http://example.com/chat/api/connect`. :type url_template: str + :param auth: Gets or sets the auth settings for an upstream. If not set, + no auth is used for upstream messages. + :type auth: ~azure.mgmt.signalr.models.UpstreamAuthSettings """ _validation = { @@ -1115,6 +1214,7 @@ class UpstreamTemplate(Model): 'event_pattern': {'key': 'eventPattern', 'type': 'str'}, 'category_pattern': {'key': 'categoryPattern', 'type': 'str'}, 'url_template': {'key': 'urlTemplate', 'type': 'str'}, + 'auth': {'key': 'auth', 'type': 'UpstreamAuthSettings'}, } def __init__(self, **kwargs): @@ -1123,3 +1223,32 @@ def __init__(self, **kwargs): self.event_pattern = kwargs.get('event_pattern', None) self.category_pattern = kwargs.get('category_pattern', None) self.url_template = kwargs.get('url_template', None) + self.auth = kwargs.get('auth', None) + + +class UserAssignedIdentityProperty(Model): + """Properties of user assigned identity. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar principal_id: Get the principal id for the user assigned identity + :vartype principal_id: str + :ivar client_id: Get the client id for the 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(UserAssignedIdentityProperty, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py index bb2cfe47dc0d..856bfeeed29a 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_models_py3.py @@ -138,6 +138,64 @@ def __init__(self, *, name: str=None, display_name: str=None, **kwargs) -> None: self.display_name = display_name +class ManagedIdentity(Model): + """A class represent managed identities used for request and response. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :param type: Represent the identity type: systemAssigned, userAssigned, + None. Possible values include: 'None', 'SystemAssigned', 'UserAssigned' + :type type: str or ~azure.mgmt.signalr.models.ManagedIdentityType + :param user_assigned_identities: Get or set the user assigned identities + :type user_assigned_identities: dict[str, + ~azure.mgmt.signalr.models.UserAssignedIdentityProperty] + :ivar principal_id: Get the principal id for the system assigned identity. + Only be used in response. + :vartype principal_id: str + :ivar tenant_id: Get the tenant id for the system assigned identity. + Only be used in response + :vartype tenant_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentityProperty}'}, + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + } + + def __init__(self, *, type=None, user_assigned_identities=None, **kwargs) -> None: + super(ManagedIdentity, self).__init__(**kwargs) + self.type = type + self.user_assigned_identities = user_assigned_identities + self.principal_id = None + self.tenant_id = None + + +class ManagedIdentitySettings(Model): + """Managed identity settings for upstream. + + :param resource: The Resource indicating the App ID URI of the target + resource. + It also appears in the aud (audience) claim of the issued token. + :type resource: str + """ + + _attribute_map = { + 'resource': {'key': 'resource', 'type': 'str'}, + } + + def __init__(self, *, resource: str=None, **kwargs) -> None: + super(ManagedIdentitySettings, self).__init__(**kwargs) + self.resource = resource + + class MetricSpecification(Model): """Specifications of the Metrics for Azure Monitoring. @@ -599,6 +657,9 @@ def __init__(self, *, key_type=None, **kwargs) -> None: class ResourceSku(Model): """The billing information of the SignalR 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. :param name: Required. The name of the SKU. Required. @@ -608,10 +669,10 @@ class ResourceSku(Model): `Basic` is deprecated, use `Standard` instead. Possible values include: 'Free', 'Basic', 'Standard', 'Premium' :type tier: str or ~azure.mgmt.signalr.models.SignalRSkuTier - :param size: Optional string. For future use. - :type size: str - :param family: Optional string. For future use. - :type family: str + :ivar size: Not used. Retained for future use. + :vartype size: str + :ivar family: Not used. Retained for future use. + :vartype family: str :param capacity: Optional, integer. The unit count of SignalR resource. 1 by default. If present, following values are allowed: @@ -622,6 +683,8 @@ class ResourceSku(Model): _validation = { 'name': {'required': True}, + 'size': {'readonly': True}, + 'family': {'readonly': True}, } _attribute_map = { @@ -632,12 +695,12 @@ class ResourceSku(Model): 'capacity': {'key': 'capacity', 'type': 'int'}, } - def __init__(self, *, name: str, tier=None, size: str=None, family: str=None, capacity: int=None, **kwargs) -> None: + def __init__(self, *, name: str, tier=None, capacity: int=None, **kwargs) -> None: super(ResourceSku, self).__init__(**kwargs) self.name = name self.tier = tier - self.size = size - self.family = family + self.size = None + self.family = None self.capacity = capacity @@ -705,11 +768,6 @@ def __init__(self, *, allowed_origins=None, **kwargs) -> None: class SignalRCreateOrUpdateProperties(Model): """Settings used to provision or configure the resource. - :param host_name_prefix: Prefix for the hostName of the SignalR service. - Retained for future use. - The hostname will be of format: - <hostNamePrefix>.service.signalr.net. - :type host_name_prefix: str :param features: List of SignalR featureFlags. e.g. ServiceMode. FeatureFlags that are not included in the parameters for the update operation will not be modified. @@ -729,16 +787,14 @@ class SignalRCreateOrUpdateProperties(Model): """ _attribute_map = { - 'host_name_prefix': {'key': 'hostNamePrefix', 'type': 'str'}, 'features': {'key': 'features', 'type': '[SignalRFeature]'}, 'cors': {'key': 'cors', 'type': 'SignalRCorsSettings'}, 'upstream': {'key': 'upstream', 'type': 'ServerlessUpstreamSettings'}, 'network_ac_ls': {'key': 'networkACLs', 'type': 'SignalRNetworkACLs'}, } - def __init__(self, *, host_name_prefix: str=None, features=None, cors=None, upstream=None, network_ac_ls=None, **kwargs) -> None: + def __init__(self, *, features=None, cors=None, upstream=None, network_ac_ls=None, **kwargs) -> None: super(SignalRCreateOrUpdateProperties, self).__init__(**kwargs) - self.host_name_prefix = host_name_prefix self.features = features self.cors = cors self.upstream = upstream @@ -905,11 +961,6 @@ class SignalRResource(TrackedResource): :type tags: dict[str, str] :param sku: The billing information of the resource.(e.g. Free, Standard) :type sku: ~azure.mgmt.signalr.models.ResourceSku - :param host_name_prefix: Prefix for the hostName of the SignalR service. - Retained for future use. - The hostname will be of format: - <hostNamePrefix>.service.signalr.net. - :type host_name_prefix: str :param features: List of SignalR featureFlags. e.g. ServiceMode. FeatureFlags that are not included in the parameters for the update operation will not be modified. @@ -949,10 +1000,14 @@ class SignalRResource(TrackedResource): SignalR resource. :vartype private_endpoint_connections: list[~azure.mgmt.signalr.models.PrivateEndpointConnection] + :param tls: TLS settings. + :type tls: ~azure.mgmt.signalr.models.SignalRTlsSettings :param kind: The kind of the service - e.g. "SignalR", or "RawWebSockets" for "Microsoft.SignalRService/SignalR". Possible values include: 'SignalR', 'RawWebSockets' :type kind: str or ~azure.mgmt.signalr.models.ServiceKind + :param identity: The managed identity response + :type identity: ~azure.mgmt.signalr.models.ManagedIdentity """ _validation = { @@ -975,7 +1030,6 @@ class SignalRResource(TrackedResource): 'location': {'key': 'location', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'sku': {'key': 'sku', 'type': 'ResourceSku'}, - 'host_name_prefix': {'key': 'properties.hostNamePrefix', 'type': 'str'}, 'features': {'key': 'properties.features', 'type': '[SignalRFeature]'}, 'cors': {'key': 'properties.cors', 'type': 'SignalRCorsSettings'}, 'upstream': {'key': 'properties.upstream', 'type': 'ServerlessUpstreamSettings'}, @@ -987,13 +1041,14 @@ class SignalRResource(TrackedResource): 'server_port': {'key': 'properties.serverPort', 'type': 'int'}, 'version': {'key': 'properties.version', 'type': 'str'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, + 'tls': {'key': 'properties.tls', 'type': 'SignalRTlsSettings'}, 'kind': {'key': 'kind', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, } - def __init__(self, *, location: str=None, tags=None, sku=None, host_name_prefix: str=None, features=None, cors=None, upstream=None, network_ac_ls=None, kind=None, **kwargs) -> None: + def __init__(self, *, location: str=None, tags=None, sku=None, features=None, cors=None, upstream=None, network_ac_ls=None, tls=None, kind=None, identity=None, **kwargs) -> None: super(SignalRResource, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku - self.host_name_prefix = host_name_prefix self.features = features self.cors = cors self.upstream = upstream @@ -1005,7 +1060,26 @@ def __init__(self, *, location: str=None, tags=None, sku=None, host_name_prefix: self.server_port = None self.version = None self.private_endpoint_connections = None + self.tls = tls self.kind = kind + self.identity = identity + + +class SignalRTlsSettings(Model): + """TLS settings for SignalR. + + :param client_cert_enabled: Request client certificate during TLS + handshake if enabled + :type client_cert_enabled: bool + """ + + _attribute_map = { + 'client_cert_enabled': {'key': 'clientCertEnabled', 'type': 'bool'}, + } + + def __init__(self, *, client_cert_enabled: bool=None, **kwargs) -> None: + super(SignalRTlsSettings, self).__init__(**kwargs) + self.client_cert_enabled = client_cert_enabled class SignalRUsage(Model): @@ -1063,6 +1137,28 @@ def __init__(self, *, value: str=None, localized_value: str=None, **kwargs) -> N self.localized_value = localized_value +class UpstreamAuthSettings(Model): + """Upstream auth settings. + + :param type: Gets or sets the type of auth. None or ManagedIdentity is + supported now. Possible values include: 'None', 'ManagedIdentity' + :type type: str or ~azure.mgmt.signalr.models.UpstreamAuthType + :param managed_identity: Gets or sets the managed identity settings. It's + required if the auth type is set to ManagedIdentity. + :type managed_identity: ~azure.mgmt.signalr.models.ManagedIdentitySettings + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'managed_identity': {'key': 'managedIdentity', 'type': 'ManagedIdentitySettings'}, + } + + def __init__(self, *, type=None, managed_identity=None, **kwargs) -> None: + super(UpstreamAuthSettings, self).__init__(**kwargs) + self.type = type + self.managed_identity = managed_identity + + class UpstreamTemplate(Model): """Upstream template item settings. It defines the Upstream URL of the incoming requests. @@ -1104,6 +1200,9 @@ class UpstreamTemplate(Model): with a client request from hub `chat` connects, it will first POST to this URL: `http://example.com/chat/api/connect`. :type url_template: str + :param auth: Gets or sets the auth settings for an upstream. If not set, + no auth is used for upstream messages. + :type auth: ~azure.mgmt.signalr.models.UpstreamAuthSettings """ _validation = { @@ -1115,11 +1214,41 @@ class UpstreamTemplate(Model): 'event_pattern': {'key': 'eventPattern', 'type': 'str'}, 'category_pattern': {'key': 'categoryPattern', 'type': 'str'}, 'url_template': {'key': 'urlTemplate', 'type': 'str'}, + 'auth': {'key': 'auth', 'type': 'UpstreamAuthSettings'}, } - def __init__(self, *, url_template: str, hub_pattern: str=None, event_pattern: str=None, category_pattern: str=None, **kwargs) -> None: + def __init__(self, *, url_template: str, hub_pattern: str=None, event_pattern: str=None, category_pattern: str=None, auth=None, **kwargs) -> None: super(UpstreamTemplate, self).__init__(**kwargs) self.hub_pattern = hub_pattern self.event_pattern = event_pattern self.category_pattern = category_pattern self.url_template = url_template + self.auth = auth + + +class UserAssignedIdentityProperty(Model): + """Properties of user assigned identity. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar principal_id: Get the principal id for the user assigned identity + :vartype principal_id: str + :ivar client_id: Get the client id for the 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) -> None: + super(UserAssignedIdentityProperty, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_paged_models.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_paged_models.py index dfd570281168..b1ecee6e4095 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_paged_models.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_paged_models.py @@ -38,29 +38,29 @@ class SignalRResourcePaged(Paged): def __init__(self, *args, **kwargs): super(SignalRResourcePaged, self).__init__(*args, **kwargs) -class PrivateLinkResourcePaged(Paged): +class SignalRUsagePaged(Paged): """ - A paging container for iterating over a list of :class:`PrivateLinkResource ` object + A paging container for iterating over a list of :class:`SignalRUsage ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[PrivateLinkResource]'} + 'current_page': {'key': 'value', 'type': '[SignalRUsage]'} } def __init__(self, *args, **kwargs): - super(PrivateLinkResourcePaged, self).__init__(*args, **kwargs) -class SignalRUsagePaged(Paged): + super(SignalRUsagePaged, self).__init__(*args, **kwargs) +class PrivateLinkResourcePaged(Paged): """ - A paging container for iterating over a list of :class:`SignalRUsage ` object + A paging container for iterating over a list of :class:`PrivateLinkResource ` object """ _attribute_map = { 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SignalRUsage]'} + 'current_page': {'key': 'value', 'type': '[PrivateLinkResource]'} } def __init__(self, *args, **kwargs): - super(SignalRUsagePaged, self).__init__(*args, **kwargs) + super(PrivateLinkResourcePaged, self).__init__(*args, **kwargs) diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_signal_rmanagement_client_enums.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_signal_rmanagement_client_enums.py index 429b7949f666..e950dc9c96cb 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_signal_rmanagement_client_enums.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/models/_signal_rmanagement_client_enums.py @@ -12,12 +12,37 @@ from enum import Enum -class SignalRSkuTier(str, Enum): +class ACLAction(str, Enum): - free = "Free" - basic = "Basic" - standard = "Standard" - premium = "Premium" + allow = "Allow" + deny = "Deny" + + +class FeatureFlags(str, Enum): + + service_mode = "ServiceMode" + enable_connectivity_logs = "EnableConnectivityLogs" + enable_messaging_logs = "EnableMessagingLogs" + + +class KeyType(str, Enum): + + primary = "Primary" + secondary = "Secondary" + + +class ManagedIdentityType(str, Enum): + + none = "None" + system_assigned = "SystemAssigned" + user_assigned = "UserAssigned" + + +class SignalRRequestType(str, Enum): + + client_connection = "ClientConnection" + server_connection = "ServerConnection" + restapi = "RESTAPI" class ProvisioningState(str, Enum): @@ -41,33 +66,21 @@ class PrivateLinkServiceConnectionStatus(str, Enum): disconnected = "Disconnected" -class ServiceKind(str, Enum): - - signal_r = "SignalR" - raw_web_sockets = "RawWebSockets" - - -class FeatureFlags(str, Enum): - - service_mode = "ServiceMode" - enable_connectivity_logs = "EnableConnectivityLogs" - enable_messaging_logs = "EnableMessagingLogs" - - -class ACLAction(str, Enum): +class SignalRSkuTier(str, Enum): - allow = "Allow" - deny = "Deny" + free = "Free" + basic = "Basic" + standard = "Standard" + premium = "Premium" -class SignalRRequestType(str, Enum): +class UpstreamAuthType(str, Enum): - client_connection = "ClientConnection" - server_connection = "ServerConnection" - restapi = "RESTAPI" + none = "None" + managed_identity = "ManagedIdentity" -class KeyType(str, Enum): +class ServiceKind(str, Enum): - primary = "Primary" - secondary = "Secondary" + signal_r = "SignalR" + raw_web_sockets = "RawWebSockets" diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py index 7c73aef2e2c1..ffe5965b3a1b 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/__init__.py @@ -11,14 +11,14 @@ from ._operations import Operations from ._signal_roperations import SignalROperations +from ._usages_operations import UsagesOperations from ._signal_rprivate_endpoint_connections_operations import SignalRPrivateEndpointConnectionsOperations from ._signal_rprivate_link_resources_operations import SignalRPrivateLinkResourcesOperations -from ._usages_operations import UsagesOperations __all__ = [ 'Operations', 'SignalROperations', + 'UsagesOperations', 'SignalRPrivateEndpointConnectionsOperations', 'SignalRPrivateLinkResourcesOperations', - 'UsagesOperations', ] diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py index c14d0227a4b2..d6270ed6b1fc 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_operations.py @@ -24,7 +24,7 @@ class Operations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-05-01". + :ivar api_version: Client Api Version. Constant value: "2020-07-01-preview". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-05-01" + self.api_version = "2020-07-01-preview" self.config = config diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_roperations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_roperations.py index 054b4fbd8f37..28506ec174e8 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_roperations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_roperations.py @@ -26,7 +26,7 @@ class SignalROperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-05-01". + :ivar api_version: Client Api Version. Constant value: "2020-07-01-preview". """ models = models @@ -36,7 +36,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-05-01" + self.api_version = "2020-07-01-preview" self.config = config @@ -249,9 +249,9 @@ def internal_paging(next_link=None): return deserialized list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR'} - def list_keys( + def get( self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): - """Get the access keys of the SignalR resource. + """Get the SignalR service and its properties. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -264,14 +264,14 @@ def list_keys( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: SignalRKeys or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.signalr.models.SignalRKeys or + :return: SignalRResource or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.signalr.models.SignalRResource or ~msrest.pipeline.ClientRawResponse :raises: :class:`ErrorResponseException` """ # Construct URL - url = self.list_keys.metadata['url'] + url = self.get.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -294,7 +294,7 @@ def list_keys( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.post(url, query_parameters, header_parameters) + request = self._client.get(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) if response.status_code not in [200]: @@ -302,24 +302,20 @@ def list_keys( deserialized = None if response.status_code == 200: - deserialized = self._deserialize('SignalRKeys', response) + deserialized = self._deserialize('SignalRResource', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response return deserialized - list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/listKeys'} + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} - def _regenerate_key_initial( - self, resource_group_name, resource_name, key_type=None, custom_headers=None, raw=False, **operation_config): - parameters = None - if key_type is not None: - parameters = models.RegenerateKeyParameters(key_type=key_type) - + def _create_or_update_initial( + self, resource_group_name, resource_name, parameters=None, custom_headers=None, raw=False, **operation_config): # Construct URL - url = self.regenerate_key.metadata['url'] + url = self.create_or_update.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -344,21 +340,23 @@ def _regenerate_key_initial( # Construct body if parameters is not None: - body_content = self._serialize.body(parameters, 'RegenerateKeyParameters') + body_content = self._serialize.body(parameters, 'SignalRResource') else: body_content = None # Construct and send request - request = self._client.post(url, query_parameters, header_parameters, body_content) + request = self._client.put(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [201]: + if response.status_code not in [200, 201, 202]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SignalRResource', response) if response.status_code == 201: - deserialized = self._deserialize('SignalRKeys', response) + deserialized = self._deserialize('SignalRResource', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -366,10 +364,9 @@ def _regenerate_key_initial( return deserialized - def regenerate_key( - self, resource_group_name, resource_name, key_type=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Regenerate SignalR service access key. PrimaryKey and SecondaryKey - cannot be regenerated at the same time. + def create_or_update( + self, resource_group_name, resource_name, parameters=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Create a new SignalR service and update an exiting SignalR service. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -377,35 +374,33 @@ def regenerate_key( :type resource_group_name: str :param resource_name: The name of the SignalR resource. :type resource_name: str - :param key_type: The keyType to regenerate. Must be either 'primary' - or 'secondary'(case-insensitive). Possible values include: 'Primary', - 'Secondary' - :type key_type: str or ~azure.mgmt.signalr.models.KeyType + :param parameters: Parameters for the create or update operation + :type parameters: ~azure.mgmt.signalr.models.SignalRResource :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SignalRKeys or - ClientRawResponse if raw==True + :return: An instance of LROPoller that returns SignalRResource or + ClientRawResponse if raw==True :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.signalr.models.SignalRKeys] + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.signalr.models.SignalRResource] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.signalr.models.SignalRKeys]] + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.signalr.models.SignalRResource]] :raises: :class:`ErrorResponseException` """ - raw_result = self._regenerate_key_initial( + raw_result = self._create_or_update_initial( resource_group_name=resource_group_name, resource_name=resource_name, - key_type=key_type, + parameters=parameters, custom_headers=custom_headers, raw=True, **operation_config ) def get_long_running_output(response): - deserialized = self._deserialize('SignalRKeys', response) + deserialized = self._deserialize('SignalRResource', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -416,35 +411,17 @@ def get_long_running_output(response): lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey'} + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} - def get( - self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): - """Get the SignalR service and its properties. - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param resource_name: The name of the SignalR resource. - :type resource_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: returns the direct response alongside the - deserialized response - :param operation_config: :ref:`Operation configuration - overrides`. - :return: SignalRResource or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.signalr.models.SignalRResource or - ~msrest.pipeline.ClientRawResponse - :raises: - :class:`ErrorResponseException` - """ + def _delete_initial( + self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): # Construct URL - url = self.get.metadata['url'] + url = self.delete.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -458,7 +435,6 @@ def get( # Construct headers header_parameters = {} - header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -467,28 +443,65 @@ def get( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) + request = self._client.delete(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200]: + if response.status_code not in [202, 204]: raise models.ErrorResponseException(self._deserialize, response) - deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SignalRResource', response) - if raw: - client_raw_response = ClientRawResponse(deserialized, response) + client_raw_response = ClientRawResponse(None, response) return client_raw_response - return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} + def delete( + self, resource_group_name, resource_name, custom_headers=None, raw=False, polling=True, **operation_config): + """Operation to delete a SignalR service. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the SignalR resource. + :type resource_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns None or + ClientRawResponse if raw==True + :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] + :raises: + :class:`ErrorResponseException` + """ + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + resource_name=resource_name, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + def get_long_running_output(response): + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response - def _create_or_update_initial( + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} + + + def _update_initial( self, resource_group_name, resource_name, parameters=None, custom_headers=None, raw=False, **operation_config): # Construct URL - url = self.create_or_update.metadata['url'] + url = self.update.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -518,18 +531,16 @@ def _create_or_update_initial( body_content = None # Construct and send request - request = self._client.put(url, query_parameters, header_parameters, body_content) + request = self._client.patch(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200, 201, 202]: + if response.status_code not in [200, 202]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None if response.status_code == 200: deserialized = self._deserialize('SignalRResource', response) - if response.status_code == 201: - deserialized = self._deserialize('SignalRResource', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -537,9 +548,9 @@ def _create_or_update_initial( return deserialized - def create_or_update( + def update( self, resource_group_name, resource_name, parameters=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Create a new SignalR service and update an exiting SignalR service. + """Operation to update an exiting SignalR service. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -547,7 +558,7 @@ def create_or_update( :type resource_group_name: str :param resource_name: The name of the SignalR resource. :type resource_name: str - :param parameters: Parameters for the create or update operation + :param parameters: Parameters for the update operation :type parameters: ~azure.mgmt.signalr.models.SignalRResource :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the @@ -563,7 +574,7 @@ def create_or_update( :raises: :class:`ErrorResponseException` """ - raw_result = self._create_or_update_initial( + raw_result = self._update_initial( resource_group_name=resource_group_name, resource_name=resource_name, parameters=parameters, @@ -588,13 +599,31 @@ def get_long_running_output(response): elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} - + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} - def _delete_initial( + def list_keys( self, resource_group_name, resource_name, custom_headers=None, raw=False, **operation_config): + """Get the access keys of the SignalR resource. + + :param resource_group_name: The name of the resource group that + contains the resource. You can obtain this value from the Azure + Resource Manager API or the portal. + :type resource_group_name: str + :param resource_name: The name of the SignalR resource. + :type resource_name: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: SignalRKeys or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.signalr.models.SignalRKeys or + ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ # Construct URL - url = self.delete.metadata['url'] + url = self.list_keys.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -608,6 +637,7 @@ def _delete_initial( # Construct headers header_parameters = {} + header_parameters['Accept'] = 'application/json' if self.config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) if custom_headers: @@ -616,65 +646,32 @@ def _delete_initial( header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') # Construct and send request - request = self._client.delete(url, query_parameters, header_parameters) + request = self._client.post(url, query_parameters, header_parameters) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [202, 204]: + if response.status_code not in [200]: raise models.ErrorResponseException(self._deserialize, response) + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('SignalRKeys', response) + if raw: - client_raw_response = ClientRawResponse(None, response) + client_raw_response = ClientRawResponse(deserialized, response) return client_raw_response - def delete( - self, resource_group_name, resource_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Operation to delete a SignalR service. - - :param resource_group_name: The name of the resource group that - contains the resource. You can obtain this value from the Azure - Resource Manager API or the portal. - :type resource_group_name: str - :param resource_name: The name of the SignalR resource. - :type resource_name: str - :param dict custom_headers: headers that will be added to the request - :param bool raw: The poller return type is ClientRawResponse, the - direct response alongside the deserialized response - :param polling: True for ARMPolling, False for no polling, or a - polling object for personal polling strategy - :return: An instance of LROPoller that returns None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`ErrorResponseException` - """ - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - resource_name=resource_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response + return deserialized + list_keys.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/listKeys'} - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) - elif polling is False: polling_method = NoPolling() - else: polling_method = polling - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} + def _regenerate_key_initial( + self, resource_group_name, resource_name, key_type=None, custom_headers=None, raw=False, **operation_config): + parameters = None + if key_type is not None: + parameters = models.RegenerateKeyParameters(key_type=key_type) - def _update_initial( - self, resource_group_name, resource_name, parameters=None, custom_headers=None, raw=False, **operation_config): # Construct URL - url = self.update.metadata['url'] + url = self.regenerate_key.metadata['url'] path_format_arguments = { 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), @@ -699,21 +696,21 @@ def _update_initial( # Construct body if parameters is not None: - body_content = self._serialize.body(parameters, 'SignalRResource') + body_content = self._serialize.body(parameters, 'RegenerateKeyParameters') else: body_content = None # Construct and send request - request = self._client.patch(url, query_parameters, header_parameters, body_content) + request = self._client.post(url, query_parameters, header_parameters, body_content) response = self._client.send(request, stream=False, **operation_config) - if response.status_code not in [200, 202]: + if response.status_code not in [201]: raise models.ErrorResponseException(self._deserialize, response) deserialized = None - if response.status_code == 200: - deserialized = self._deserialize('SignalRResource', response) + if response.status_code == 201: + deserialized = self._deserialize('SignalRKeys', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -721,9 +718,10 @@ def _update_initial( return deserialized - def update( - self, resource_group_name, resource_name, parameters=None, custom_headers=None, raw=False, polling=True, **operation_config): - """Operation to update an exiting SignalR service. + def regenerate_key( + self, resource_group_name, resource_name, key_type=None, custom_headers=None, raw=False, polling=True, **operation_config): + """Regenerate SignalR service access key. PrimaryKey and SecondaryKey + cannot be regenerated at the same time. :param resource_group_name: The name of the resource group that contains the resource. You can obtain this value from the Azure @@ -731,33 +729,35 @@ def update( :type resource_group_name: str :param resource_name: The name of the SignalR resource. :type resource_name: str - :param parameters: Parameters for the update operation - :type parameters: ~azure.mgmt.signalr.models.SignalRResource + :param key_type: The keyType to regenerate. Must be either 'primary' + or 'secondary'(case-insensitive). Possible values include: 'Primary', + 'Secondary' + :type key_type: str or ~azure.mgmt.signalr.models.KeyType :param dict custom_headers: headers that will be added to the request :param bool raw: The poller return type is ClientRawResponse, the direct response alongside the deserialized response :param polling: True for ARMPolling, False for no polling, or a polling object for personal polling strategy - :return: An instance of LROPoller that returns SignalRResource or - ClientRawResponse if raw==True + :return: An instance of LROPoller that returns SignalRKeys or + ClientRawResponse if raw==True :rtype: - ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.signalr.models.SignalRResource] + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.signalr.models.SignalRKeys] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.signalr.models.SignalRResource]] + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.signalr.models.SignalRKeys]] :raises: :class:`ErrorResponseException` """ - raw_result = self._update_initial( + raw_result = self._regenerate_key_initial( resource_group_name=resource_group_name, resource_name=resource_name, - parameters=parameters, + key_type=key_type, custom_headers=custom_headers, raw=True, **operation_config ) def get_long_running_output(response): - deserialized = self._deserialize('SignalRResource', response) + deserialized = self._deserialize('SignalRKeys', response) if raw: client_raw_response = ClientRawResponse(deserialized, response) @@ -768,11 +768,11 @@ def get_long_running_output(response): lro_delay = operation_config.get( 'long_running_operation_timeout', self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **operation_config) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **operation_config) elif polling is False: polling_method = NoPolling() else: polling_method = polling return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}'} + regenerate_key.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/regenerateKey'} def _restart_initial( diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_operations.py index 73c157337a8d..f0c13ef031b1 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_endpoint_connections_operations.py @@ -26,7 +26,7 @@ class SignalRPrivateEndpointConnectionsOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-05-01". + :ivar api_version: Client Api Version. Constant value: "2020-07-01-preview". """ models = models @@ -36,7 +36,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-05-01" + self.api_version = "2020-07-01-preview" self.config = config diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py index 53a713abf289..a31443861745 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_signal_rprivate_link_resources_operations.py @@ -24,7 +24,7 @@ class SignalRPrivateLinkResourcesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-05-01". + :ivar api_version: Client Api Version. Constant value: "2020-07-01-preview". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-05-01" + self.api_version = "2020-07-01-preview" self.config = config diff --git a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py index afe9a3f4c2fd..c94194b3e3b5 100644 --- a/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py +++ b/sdk/signalr/azure-mgmt-signalr/azure/mgmt/signalr/operations/_usages_operations.py @@ -24,7 +24,7 @@ class UsagesOperations(object): :param config: Configuration of service client. :param serializer: An object model serializer. :param deserializer: An object model deserializer. - :ivar api_version: Client Api Version. Constant value: "2020-05-01". + :ivar api_version: Client Api Version. Constant value: "2020-07-01-preview". """ models = models @@ -34,7 +34,7 @@ def __init__(self, client, config, serializer, deserializer): self._client = client self._serialize = serializer self._deserialize = deserializer - self.api_version = "2020-05-01" + self.api_version = "2020-07-01-preview" self.config = config