diff --git a/src/SDKs/SignalR/AzSdk.RP.props b/src/SDKs/SignalR/AzSdk.RP.props index 3f29983d6fd6..67178597a08b 100644 --- a/src/SDKs/SignalR/AzSdk.RP.props +++ b/src/SDKs/SignalR/AzSdk.RP.props @@ -1,7 +1,7 @@  - SignalRService_2018-03-01-preview; + SignalRService_2018-10-01; $(PackageTags);$(CommonTags);$(AzureApiTag); \ No newline at end of file diff --git a/src/SDKs/SignalR/Management.SignalR/Generated/ISignalRManagementClient.cs b/src/SDKs/SignalR/Management.SignalR/Generated/ISignalRManagementClient.cs index c166e76a4718..d774295a2665 100644 --- a/src/SDKs/SignalR/Management.SignalR/Generated/ISignalRManagementClient.cs +++ b/src/SDKs/SignalR/Management.SignalR/Generated/ISignalRManagementClient.cs @@ -41,7 +41,8 @@ public partial interface ISignalRManagementClient : System.IDisposable ServiceClientCredentials Credentials { get; } /// - /// Client Api Version. + /// Client Api Version. Possible values include: '2018-03-01-preview', + /// '2018-10-01' /// string ApiVersion { get; } diff --git a/src/SDKs/SignalR/Management.SignalR/Generated/ISignalROperations.cs b/src/SDKs/SignalR/Management.SignalR/Generated/ISignalROperations.cs index 0ea8083171b1..e11e05afe388 100644 --- a/src/SDKs/SignalR/Management.SignalR/Generated/ISignalROperations.cs +++ b/src/SDKs/SignalR/Management.SignalR/Generated/ISignalROperations.cs @@ -261,6 +261,30 @@ public partial interface ISignalROperations /// Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, SignalRUpdateParameters parameters = default(SignalRUpdateParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Operation to restart a SignalR service. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the SignalR resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task RestartWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Regenerate SignalR service access key. PrimaryKey and SecondaryKey /// cannot be regenerated at the same time. /// @@ -376,6 +400,30 @@ public partial interface ISignalROperations /// Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, SignalRUpdateParameters parameters = default(SignalRUpdateParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Operation to restart a SignalR service. + /// + /// + /// The name of the resource group that contains the resource. You can + /// obtain this value from the Azure Resource Manager API or the + /// portal. + /// + /// + /// The name of the SignalR resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Handles requests to list all resources in a subscription. /// /// diff --git a/src/SDKs/SignalR/Management.SignalR/Generated/Models/Resource.cs b/src/SDKs/SignalR/Management.SignalR/Generated/Models/Resource.cs index 85e4b5205fec..61725b5ca00c 100644 --- a/src/SDKs/SignalR/Management.SignalR/Generated/Models/Resource.cs +++ b/src/SDKs/SignalR/Management.SignalR/Generated/Models/Resource.cs @@ -33,7 +33,7 @@ public Resource() /// /// Fully qualified resource Id for the /// resource. - /// The name of the resouce. + /// The name of the resource. /// The type of the service - e.g. /// "Microsoft.SignalRService/SignalR" public Resource(string id = default(string), string name = default(string), string type = default(string)) @@ -56,7 +56,7 @@ public Resource() public string Id { get; private set; } /// - /// Gets the name of the resouce. + /// Gets the name of the resource. /// [JsonProperty(PropertyName = "name")] public string Name { get; private set; } diff --git a/src/SDKs/SignalR/Management.SignalR/Generated/Models/ResourceSku.cs b/src/SDKs/SignalR/Management.SignalR/Generated/Models/ResourceSku.cs index 3e0c1bf120d4..e58cd4ecbef9 100644 --- a/src/SDKs/SignalR/Management.SignalR/Generated/Models/ResourceSku.cs +++ b/src/SDKs/SignalR/Management.SignalR/Generated/Models/ResourceSku.cs @@ -34,8 +34,8 @@ public ResourceSku() /// + number code, such as A0 or P3. Required (if sku is /// specified) /// Optional tier of this particular SKU. `Basic` is - /// deprecated, use `Standard` instead for Basic tier. Possible values - /// include: 'Free', 'Basic', 'Standard', 'Premium' + /// deprecated, use `Standard` instead. Possible values include: + /// 'Free', 'Basic', 'Standard', 'Premium' /// Optional, string. When the name field is the /// combination of tier and some other value, this would be the /// standalone code. @@ -70,8 +70,8 @@ public ResourceSku() /// /// Gets or sets optional tier of this particular SKU. `Basic` is - /// deprecated, use `Standard` instead for Basic tier. Possible values - /// include: 'Free', 'Basic', 'Standard', 'Premium' + /// deprecated, use `Standard` instead. Possible values include: + /// 'Free', 'Basic', 'Standard', 'Premium' /// [JsonProperty(PropertyName = "tier")] public string Tier { get; set; } diff --git a/src/SDKs/SignalR/Management.SignalR/Generated/Models/SignalRResource.cs b/src/SDKs/SignalR/Management.SignalR/Generated/Models/SignalRResource.cs index 88fbc084262e..a326a13420d4 100644 --- a/src/SDKs/SignalR/Management.SignalR/Generated/Models/SignalRResource.cs +++ b/src/SDKs/SignalR/Management.SignalR/Generated/Models/SignalRResource.cs @@ -36,7 +36,7 @@ public SignalRResource() /// /// Fully qualified resource Id for the /// resource. - /// The name of the resouce. + /// The name of the resource. /// The type of the service - e.g. /// "Microsoft.SignalRService/SignalR" /// The GEO location of the SignalR service. @@ -57,10 +57,10 @@ public SignalRResource() /// service. /// FQDN of the SignalR service instance. /// Format: xxx.service.signalr.net - /// The publicly accessibly port of the + /// The publicly accessible port of the /// SignalR service which is designed for browser/client side /// usage. - /// The publicly accessibly port of the + /// The publicly accessible port of the /// SignalR service which is designed for customer server side /// usage. /// Version of the SignalR resource. Probably you @@ -121,14 +121,14 @@ public SignalRResource() public string HostName { get; private set; } /// - /// Gets the publicly accessibly port of the SignalR service which is + /// Gets the publicly accessible port of the SignalR service which is /// designed for browser/client side usage. /// [JsonProperty(PropertyName = "properties.publicPort")] public int? PublicPort { get; private set; } /// - /// Gets the publicly accessibly port of the SignalR service which is + /// Gets the publicly accessible port of the SignalR service which is /// designed for customer server side usage. /// [JsonProperty(PropertyName = "properties.serverPort")] diff --git a/src/SDKs/SignalR/Management.SignalR/Generated/Models/SignalRUsageName.cs b/src/SDKs/SignalR/Management.SignalR/Generated/Models/SignalRUsageName.cs index d401ecf81687..6330d3765151 100644 --- a/src/SDKs/SignalR/Management.SignalR/Generated/Models/SignalRUsageName.cs +++ b/src/SDKs/SignalR/Management.SignalR/Generated/Models/SignalRUsageName.cs @@ -29,7 +29,7 @@ public SignalRUsageName() /// /// Initializes a new instance of the SignalRUsageName class. /// - /// The indentifier of the usage. + /// The identifier of the usage. /// Localized name of the usage. public SignalRUsageName(string value = default(string), string localizedValue = default(string)) { @@ -44,7 +44,7 @@ public SignalRUsageName() partial void CustomInit(); /// - /// Gets or sets the indentifier of the usage. + /// Gets or sets the identifier of the usage. /// [JsonProperty(PropertyName = "value")] public string Value { get; set; } diff --git a/src/SDKs/SignalR/Management.SignalR/Generated/Models/TrackedResource.cs b/src/SDKs/SignalR/Management.SignalR/Generated/Models/TrackedResource.cs index 2829818e3e02..84e63367c1bb 100644 --- a/src/SDKs/SignalR/Management.SignalR/Generated/Models/TrackedResource.cs +++ b/src/SDKs/SignalR/Management.SignalR/Generated/Models/TrackedResource.cs @@ -33,7 +33,7 @@ public TrackedResource() /// /// Fully qualified resource Id for the /// resource. - /// The name of the resouce. + /// The name of the resource. /// The type of the service - e.g. /// "Microsoft.SignalRService/SignalR" /// The GEO location of the SignalR service. diff --git a/src/SDKs/SignalR/Management.SignalR/Generated/Operations.cs b/src/SDKs/SignalR/Management.SignalR/Generated/Operations.cs index 79d9c4c56501..83aaf444ad7a 100644 --- a/src/SDKs/SignalR/Management.SignalR/Generated/Operations.cs +++ b/src/SDKs/SignalR/Management.SignalR/Generated/Operations.cs @@ -66,11 +66,21 @@ internal Operations(SignalRManagementClient client) /// /// Thrown when unable to deserialize the response /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// /// /// A response object containing the response body and response headers. /// public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -87,7 +97,7 @@ internal Operations(SignalRManagementClient client) List _queryParameters = new List(); if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.ApiVersion, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { diff --git a/src/SDKs/SignalR/Management.SignalR/Generated/SdkInfo_SignalRManagementClient.cs b/src/SDKs/SignalR/Management.SignalR/Generated/SdkInfo_SignalRManagementClient.cs index 7bc991a59442..f5c6c0579e28 100644 --- a/src/SDKs/SignalR/Management.SignalR/Generated/SdkInfo_SignalRManagementClient.cs +++ b/src/SDKs/SignalR/Management.SignalR/Generated/SdkInfo_SignalRManagementClient.cs @@ -19,9 +19,9 @@ public static IEnumerable> ApiInfo_SignalRManageme { return new Tuple[] { - new Tuple("SignalRService", "Operations", "2018-03-01-preview"), - new Tuple("SignalRService", "SignalR", "2018-03-01-preview"), - new Tuple("SignalRService", "Usages", "2018-03-01-preview"), + new Tuple("SignalRService", "Operations", "2018-10-01"), + new Tuple("SignalRService", "SignalR", "2018-10-01"), + new Tuple("SignalRService", "Usages", "2018-10-01"), }.AsEnumerable(); } } diff --git a/src/SDKs/SignalR/Management.SignalR/Generated/SignalRManagementClient.cs b/src/SDKs/SignalR/Management.SignalR/Generated/SignalRManagementClient.cs index 1482ae8bdc65..3f2969a26f47 100644 --- a/src/SDKs/SignalR/Management.SignalR/Generated/SignalRManagementClient.cs +++ b/src/SDKs/SignalR/Management.SignalR/Generated/SignalRManagementClient.cs @@ -47,7 +47,8 @@ public partial class SignalRManagementClient : ServiceClient - /// Client Api Version. + /// Client Api Version. Possible values include: '2018-03-01-preview', + /// '2018-10-01' /// public string ApiVersion { get; private set; } @@ -336,7 +337,7 @@ private void Initialize() SignalR = new SignalROperations(this); Usages = new UsagesOperations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2018-03-01-preview"; + ApiVersion = 2018-10-01; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/src/SDKs/SignalR/Management.SignalR/Generated/SignalROperations.cs b/src/SDKs/SignalR/Management.SignalR/Generated/SignalROperations.cs index 4b6853b161e6..f72039623e51 100644 --- a/src/SDKs/SignalR/Management.SignalR/Generated/SignalROperations.cs +++ b/src/SDKs/SignalR/Management.SignalR/Generated/SignalROperations.cs @@ -90,6 +90,10 @@ internal SignalROperations(SignalRManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -114,7 +118,7 @@ internal SignalROperations(SignalRManagementClient client) List _queryParameters = new List(); if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.ApiVersion, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { @@ -273,6 +277,10 @@ internal SignalROperations(SignalRManagementClient client) /// public async Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -294,7 +302,7 @@ internal SignalROperations(SignalRManagementClient client) List _queryParameters = new List(); if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.ApiVersion, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { @@ -451,6 +459,10 @@ internal SignalROperations(SignalRManagementClient client) /// public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -478,7 +490,7 @@ internal SignalROperations(SignalRManagementClient client) List _queryParameters = new List(); if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.ApiVersion, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { @@ -638,6 +650,10 @@ internal SignalROperations(SignalRManagementClient client) /// public async Task> ListKeysWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -671,7 +687,7 @@ internal SignalROperations(SignalRManagementClient client) List _queryParameters = new List(); if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.ApiVersion, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { @@ -858,6 +874,10 @@ internal SignalROperations(SignalRManagementClient client) /// public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -884,14 +904,14 @@ internal SignalROperations(SignalRManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR/{resourceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.ApiVersion, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { @@ -1093,6 +1113,29 @@ internal SignalROperations(SignalRManagementClient client) return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Operation to restart a SignalR service. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the SignalR resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task RestartWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginRestartWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot /// be regenerated at the same time. @@ -1130,6 +1173,10 @@ internal SignalROperations(SignalRManagementClient client) /// public async Task> BeginRegenerateKeyWithHttpMessagesAsync(string resourceGroupName, string resourceName, RegenerateKeyParameters parameters = default(RegenerateKeyParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1164,7 +1211,7 @@ internal SignalROperations(SignalRManagementClient client) List _queryParameters = new List(); if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.ApiVersion, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { @@ -1337,6 +1384,10 @@ internal SignalROperations(SignalRManagementClient client) { parameters.Validate(); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1364,14 +1415,14 @@ internal SignalROperations(SignalRManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR/{resourceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.ApiVersion, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { @@ -1534,6 +1585,10 @@ internal SignalROperations(SignalRManagementClient client) /// public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1560,14 +1615,14 @@ internal SignalROperations(SignalRManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR/{resourceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.ApiVersion, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { @@ -1712,6 +1767,10 @@ internal SignalROperations(SignalRManagementClient client) /// public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, SignalRUpdateParameters parameters = default(SignalRUpdateParameters), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -1739,14 +1798,14 @@ internal SignalROperations(SignalRManagementClient client) } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/SignalR/{resourceName}").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}").ToString(); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.ApiVersion, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) { @@ -1879,6 +1938,182 @@ internal SignalROperations(SignalRManagementClient client) return _result; } + /// + /// Operation to restart a SignalR service. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the SignalR resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BeginRestartWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginRestart", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SignalRService/signalR/{resourceName}/restart").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.ApiVersion, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Handles requests to list all resources in a subscription. /// diff --git a/src/SDKs/SignalR/Management.SignalR/Generated/SignalROperationsExtensions.cs b/src/SDKs/SignalR/Management.SignalR/Generated/SignalROperationsExtensions.cs index 80a7c506b70a..b063e149a269 100644 --- a/src/SDKs/SignalR/Management.SignalR/Generated/SignalROperationsExtensions.cs +++ b/src/SDKs/SignalR/Management.SignalR/Generated/SignalROperationsExtensions.cs @@ -394,6 +394,45 @@ public static void Delete(this ISignalROperations operations, string resourceGro } } + /// + /// Operation to restart a SignalR service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the SignalR resource. + /// + public static void Restart(this ISignalROperations operations, string resourceGroupName, string resourceName) + { + operations.RestartAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Operation to restart a SignalR service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the SignalR resource. + /// + /// + /// The cancellation token. + /// + public static async Task RestartAsync(this ISignalROperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.RestartWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Regenerate SignalR service access key. PrimaryKey and SecondaryKey cannot /// be regenerated at the same time. @@ -579,6 +618,45 @@ public static void BeginDelete(this ISignalROperations operations, string resour } } + /// + /// Operation to restart a SignalR service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the SignalR resource. + /// + public static void BeginRestart(this ISignalROperations operations, string resourceGroupName, string resourceName) + { + operations.BeginRestartAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Operation to restart a SignalR service. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the resource. You can obtain + /// this value from the Azure Resource Manager API or the portal. + /// + /// + /// The name of the SignalR resource. + /// + /// + /// The cancellation token. + /// + public static async Task BeginRestartAsync(this ISignalROperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginRestartWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Handles requests to list all resources in a subscription. /// diff --git a/src/SDKs/SignalR/Management.SignalR/Generated/UsagesOperations.cs b/src/SDKs/SignalR/Management.SignalR/Generated/UsagesOperations.cs index 8f7c3fcddc2f..7b40455c8b8f 100644 --- a/src/SDKs/SignalR/Management.SignalR/Generated/UsagesOperations.cs +++ b/src/SDKs/SignalR/Management.SignalR/Generated/UsagesOperations.cs @@ -83,6 +83,10 @@ internal UsagesOperations(SignalRManagementClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "location"); } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } if (Client.SubscriptionId == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); @@ -106,7 +110,7 @@ internal UsagesOperations(SignalRManagementClient client) List _queryParameters = new List(); if (Client.ApiVersion != null) { - _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(Client.ApiVersion, Client.SerializationSettings).Trim('"')))); } if (_queryParameters.Count > 0) {