From 8deb11d414b71b3b215fa8b006345340e72b9557 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 1 Oct 2021 14:02:00 +0000 Subject: [PATCH] CodeGen from PR 16197 in Azure/azure-rest-api-specs Merge 54c5a8c4e3504444428f56b4c7030ca742349168 into 28e60e3f539b44b60e7b4d6fa2cf4476519bcf93 --- .../src/Generated/AccountsOperations.cs | 190 +++- .../Generated/AccountsOperationsExtensions.cs | 37 + .../src/Generated/DeviceUpdateClient.cs | 201 ++++ .../Generated/DeviceUpdateClientExtensions.cs | 59 ++ .../src/Generated/IAccountsOperations.cs | 22 + .../src/Generated/IDeviceUpdateClient.cs | 28 + .../src/Generated/IInstancesOperations.cs | 41 +- .../IPrivateEndpointConnectionsOperations.cs | 202 ++++ .../IPrivateLinkResourcesOperations.cs | 81 ++ .../src/Generated/InstancesOperations.cs | 237 +---- .../InstancesOperationsExtensions.cs | 81 +- .../src/Generated/Models/Account.cs | 27 +- .../src/Generated/Models/AccountUpdate.cs | 11 +- .../Generated/Models/AzureEntityResource.cs | 6 +- .../Models/CheckNameAvailabilityReason.cs | 22 + .../Models/CheckNameAvailabilityRequest.cs | 63 ++ .../Models/CheckNameAvailabilityResponse.cs | 74 ++ .../src/Generated/Models/CreatedByType.cs | 24 + .../Models/DiagnosticStorageProperties.cs | 76 ++ .../Generated/Models/ErrorAdditionalInfo.cs | 59 ++ .../src/Generated/Models/ErrorDefinition.cs | 69 -- .../src/Generated/Models/ErrorDetail.cs | 85 ++ .../src/Generated/Models/ErrorResponse.cs | 24 +- .../Models/GroupIdProvisioningState.cs | 23 + .../src/Generated/Models/GroupInformation.cs | 94 ++ .../src/Generated/Models/Instance.cs | 21 +- .../Models/ManagedServiceIdentity.cs | 85 ++ .../Models/ManagedServiceIdentityType.cs | 24 + .../src/Generated/Models/Page1.cs | 53 ++ .../src/Generated/Models/PrivateEndpoint.cs | 51 + .../Models/PrivateEndpointConnection.cs | 87 ++ ...vateEndpointConnectionProvisioningState.cs | 24 + .../PrivateEndpointServiceConnectionStatus.cs | 23 + .../Models/PrivateLinkResourceProperties.cs | 73 ++ .../PrivateLinkServiceConnectionState.cs | 77 ++ .../src/Generated/Models/ProxyResource.cs | 6 +- .../Generated/Models/PublicNetworkAccess.cs | 22 + .../src/Generated/Models/Resource.cs | 12 +- .../src/Generated/Models/SystemData.cs | 103 ++ .../src/Generated/Models/TrackedResource.cs | 6 +- .../Generated/Models/UserAssignedIdentity.cs | 61 ++ .../PrivateEndpointConnectionsOperations.cs | 901 ++++++++++++++++++ ...EndpointConnectionsOperationsExtensions.cs | 323 +++++++ .../PrivateLinkResourcesOperations.cs | 446 +++++++++ ...rivateLinkResourcesOperationsExtensions.cs | 115 +++ .../src/Generated/SdkInfo_DeviceUpdate.cs | 14 +- 46 files changed, 3969 insertions(+), 394 deletions(-) create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/DeviceUpdateClientExtensions.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IPrivateEndpointConnectionsOperations.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IPrivateLinkResourcesOperations.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CheckNameAvailabilityReason.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CheckNameAvailabilityRequest.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CheckNameAvailabilityResponse.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CreatedByType.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/DiagnosticStorageProperties.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorAdditionalInfo.cs delete mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorDefinition.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorDetail.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/GroupIdProvisioningState.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/GroupInformation.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ManagedServiceIdentity.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ManagedServiceIdentityType.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Page1.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpoint.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpointConnection.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateLinkResourceProperties.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateLinkServiceConnectionState.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PublicNetworkAccess.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/SystemData.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/UserAssignedIdentity.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateEndpointConnectionsOperations.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateLinkResourcesOperations.cs create mode 100644 sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateLinkResourcesOperationsExtensions.cs diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/AccountsOperations.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/AccountsOperations.cs index 50a929c2f867..c0b5805c841f 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/AccountsOperations.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/AccountsOperations.cs @@ -596,6 +596,176 @@ internal AccountsOperations(DeviceUpdateClient client) return _result; } + /// + /// Checks whether account exists. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// 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 HeadWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + 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 (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Head", 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.DeviceUpdate/accounts/{accountName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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("HEAD"); + _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, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + /// /// Creates or updates Account. /// @@ -1186,7 +1356,7 @@ internal AccountsOperations(DeviceUpdateClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try @@ -1241,6 +1411,24 @@ internal AccountsOperations(DeviceUpdateClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/AccountsOperationsExtensions.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/AccountsOperationsExtensions.cs index 3723cdf9157e..b5a4935bdc63 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/AccountsOperationsExtensions.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/AccountsOperationsExtensions.cs @@ -123,6 +123,43 @@ public static Account Get(this IAccountsOperations operations, string resourceGr } } + /// + /// Checks whether account exists. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + public static void Head(this IAccountsOperations operations, string resourceGroupName, string accountName) + { + operations.HeadAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// Checks whether account exists. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The cancellation token. + /// + public static async Task HeadAsync(this IAccountsOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.HeadWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Creates or updates Account. /// diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/DeviceUpdateClient.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/DeviceUpdateClient.cs index 71663c9ed333..af0b1a2a39bd 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/DeviceUpdateClient.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/DeviceUpdateClient.cs @@ -20,6 +20,8 @@ namespace Microsoft.Azure.Management.DeviceUpdate using System.Linq; using System.Net; using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; /// /// Microsoft Device Update resource provider. @@ -84,6 +86,16 @@ public partial class DeviceUpdateClient : ServiceClient, IDe /// public virtual IInstancesOperations Instances { get; private set; } + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + public virtual IPrivateLinkResourcesOperations PrivateLinkResources { get; private set; } + /// /// Gets the IOperations. /// @@ -332,6 +344,8 @@ private void Initialize() { Accounts = new AccountsOperations(this); Instances = new InstancesOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + PrivateLinkResources = new PrivateLinkResourcesOperations(this); Operations = new Operations(this); BaseUri = new System.Uri("https://management.azure.com"); ApiVersion = "2020-03-01-preview"; @@ -368,5 +382,192 @@ private void Initialize() DeserializationSettings.Converters.Add(new TransformationJsonConverter()); DeserializationSettings.Converters.Add(new CloudErrorJsonConverter()); } + /// + /// Checks ADU resource name availability. + /// + /// + /// Check Name Availability Request. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityRequest request, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + if (SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.SubscriptionId"); + } + if (request == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "request"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("request", request); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/checknameavailability").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(SubscriptionId)); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion))); + } + 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 (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", 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; + if(request != null) + { + _requestContent = SafeJsonConvert.SerializeObject(request, SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/DeviceUpdateClientExtensions.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/DeviceUpdateClientExtensions.cs new file mode 100644 index 000000000000..813df45e53e4 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/DeviceUpdateClientExtensions.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DeviceUpdateClient. + /// + public static partial class DeviceUpdateClientExtensions + { + /// + /// Checks ADU resource name availability. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Check Name Availability Request. + /// + public static CheckNameAvailabilityResponse CheckNameAvailability(this IDeviceUpdateClient operations, CheckNameAvailabilityRequest request) + { + return operations.CheckNameAvailabilityAsync(request).GetAwaiter().GetResult(); + } + + /// + /// Checks ADU resource name availability. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Check Name Availability Request. + /// + /// + /// The cancellation token. + /// + public static async Task CheckNameAvailabilityAsync(this IDeviceUpdateClient operations, CheckNameAvailabilityRequest request, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(request, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IAccountsOperations.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IAccountsOperations.cs index 046321285640..a4bcec10c5c0 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IAccountsOperations.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IAccountsOperations.cs @@ -90,6 +90,28 @@ public partial interface IAccountsOperations /// Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Checks whether account exists. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// 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 HeadWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Creates or updates Account. /// /// diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IDeviceUpdateClient.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IDeviceUpdateClient.cs index 7b34b3d5d5c8..c0c2ec1a5cc7 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IDeviceUpdateClient.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IDeviceUpdateClient.cs @@ -14,6 +14,10 @@ namespace Microsoft.Azure.Management.DeviceUpdate using Microsoft.Rest.Azure; using Models; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; /// /// Microsoft Device Update resource provider. @@ -79,10 +83,34 @@ public partial interface IDeviceUpdateClient : System.IDisposable /// IInstancesOperations Instances { get; } + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + + /// + /// Gets the IPrivateLinkResourcesOperations. + /// + IPrivateLinkResourcesOperations PrivateLinkResources { get; } + /// /// Gets the IOperations. /// IOperations Operations { get; } + /// + /// Checks ADU resource name availability. + /// + /// + /// Check Name Availability Request. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> CheckNameAvailabilityWithHttpMessagesAsync(CheckNameAvailabilityRequest request, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } } diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IInstancesOperations.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IInstancesOperations.cs index 4e3df48e9120..4cf97c5fe0dc 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IInstancesOperations.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IInstancesOperations.cs @@ -26,6 +26,9 @@ public partial interface IInstancesOperations /// /// Returns instances for the given account name. /// + /// + /// The resource group name. + /// /// /// Account name. /// @@ -44,9 +47,9 @@ public partial interface IInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListBySubscriptionWithHttpMessagesAsync(string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task>> ListByAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns instances for the given account name. + /// Returns instance details for the given instance and account name. /// /// /// The resource group name. @@ -54,6 +57,9 @@ public partial interface IInstancesOperations /// /// Account name. /// + /// + /// Instance name. + /// /// /// The headers that will be added to request. /// @@ -69,9 +75,9 @@ public partial interface IInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListByAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string instanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// - /// Returns instances for the given account and instance name. + /// Checks whether instance exists. /// /// /// The resource group name. @@ -91,13 +97,10 @@ public partial interface IInstancesOperations /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// - Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string instanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task HeadWithHttpMessagesAsync(string resourceGroupName, string accountName, string instanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Creates or updates instance. /// @@ -263,28 +266,6 @@ public partial interface IInstancesOperations /// /// Thrown when a required parameter is null /// - Task>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns instances for the given account name. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when unable to deserialize the response - /// - /// - /// Thrown when a required parameter is null - /// Task>> ListByAccountNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IPrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..355c8b0221b4 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IPrivateEndpointConnectionsOperations.cs @@ -0,0 +1,202 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + public partial interface IPrivateEndpointConnectionsOperations + { + /// + /// List all private endpoint connections in a device update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the specified private endpoint connection associated with the + /// device update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the state of specified private endpoint connection + /// associated with the device update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure resource + /// + /// + /// The parameters for creating a private endpoint connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified private endpoint connection associated with + /// the device update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure 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 DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update the state of specified private endpoint connection + /// associated with the device update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure resource + /// + /// + /// The parameters for creating a private endpoint connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified private endpoint connection associated with + /// the device update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the + /// Azure 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IPrivateLinkResourcesOperations.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IPrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..e5055d9921d9 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/IPrivateLinkResourcesOperations.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateLinkResourcesOperations operations. + /// + public partial interface IPrivateLinkResourcesOperations + { + /// + /// List all private link resources in a device update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListByAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the specified private link resource associated with the device + /// update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The group ID of the private link resource. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/InstancesOperations.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/InstancesOperations.cs index 606bdcebbadd..9a5e28c40cb2 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/InstancesOperations.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/InstancesOperations.cs @@ -53,6 +53,9 @@ internal InstancesOperations(DeviceUpdateClient client) /// /// Returns instances for the given account name. /// + /// + /// The resource group name. + /// /// /// Account name. /// @@ -77,8 +80,12 @@ internal InstancesOperations(DeviceUpdateClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListBySubscriptionWithHttpMessagesAsync(string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task>> ListByAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } if (Client.ApiVersion == null) { throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -98,13 +105,15 @@ internal InstancesOperations(DeviceUpdateClient client) { _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("accountName", accountName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "ListByAccount", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/instances").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/instances").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); List _queryParameters = new List(); @@ -233,7 +242,7 @@ internal InstancesOperations(DeviceUpdateClient client) } /// - /// Returns instances for the given account name. + /// Returns instance details for the given instance and account name. /// /// /// The resource group name. @@ -241,6 +250,9 @@ internal InstancesOperations(DeviceUpdateClient client) /// /// Account name. /// + /// + /// Instance name. + /// /// /// Headers that will be added to request. /// @@ -262,7 +274,7 @@ internal InstancesOperations(DeviceUpdateClient client) /// /// A response object containing the response body and response headers. /// - public async Task>> ListByAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string instanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -280,6 +292,10 @@ internal InstancesOperations(DeviceUpdateClient client) { throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); } + if (instanceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "instanceName"); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -289,15 +305,17 @@ internal InstancesOperations(DeviceUpdateClient client) Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("resourceGroupName", resourceGroupName); tracingParameters.Add("accountName", accountName); + tracingParameters.Add("instanceName", instanceName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListByAccount", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Get", 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.DeviceUpdate/accounts/{accountName}/instances").ToString(); + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DeviceUpdate/accounts/{accountName}/instances/{instanceName}").ToString(); _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{instanceName}", System.Uri.EscapeDataString(instanceName)); List _queryParameters = new List(); if (Client.ApiVersion != null) { @@ -391,7 +409,7 @@ internal InstancesOperations(DeviceUpdateClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse>(); + var _result = new AzureOperationResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) @@ -404,7 +422,7 @@ internal InstancesOperations(DeviceUpdateClient client) _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); try { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); } catch (JsonException ex) { @@ -424,7 +442,7 @@ internal InstancesOperations(DeviceUpdateClient client) } /// - /// Returns instances for the given account and instance name. + /// Checks whether instance exists. /// /// /// The resource group name. @@ -444,9 +462,6 @@ internal InstancesOperations(DeviceUpdateClient client) /// /// Thrown when the operation returned an invalid status code /// - /// - /// Thrown when unable to deserialize the response - /// /// /// Thrown when a required parameter is null /// @@ -456,7 +471,7 @@ internal InstancesOperations(DeviceUpdateClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string instanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task HeadWithHttpMessagesAsync(string resourceGroupName, string accountName, string instanceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (resourceGroupName == null) { @@ -489,7 +504,7 @@ internal InstancesOperations(DeviceUpdateClient client) tracingParameters.Add("accountName", accountName); tracingParameters.Add("instanceName", instanceName); tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "Get", tracingParameters); + ServiceClientTracing.Enter(_invocationId, this, "Head", tracingParameters); } // Construct URL var _baseUrl = Client.BaseUri.AbsoluteUri; @@ -510,7 +525,7 @@ internal InstancesOperations(DeviceUpdateClient client) // Create HTTP transport objects var _httpRequest = new HttpRequestMessage(); HttpResponseMessage _httpResponse = null; - _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.Method = new HttpMethod("HEAD"); _httpRequest.RequestUri = new System.Uri(_url); // Set Headers if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) @@ -553,7 +568,7 @@ internal InstancesOperations(DeviceUpdateClient client) ServiceClientTracing.SendRequest(_invocationId, _httpRequest); } cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); if (_shouldTrace) { ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); @@ -591,31 +606,13 @@ internal InstancesOperations(DeviceUpdateClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + 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(); } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1285,174 +1282,6 @@ internal InstancesOperations(DeviceUpdateClient client) return _result; } - /// - /// Returns instances for the given account name. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// 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>> ListBySubscriptionNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (nextPageLink == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("nextPageLink", nextPageLink); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ListBySubscriptionNext", tracingParameters); - } - // Construct URL - string _url = "{nextLink}"; - _url = _url.Replace("{nextLink}", nextPageLink); - List _queryParameters = new List(); - 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("GET"); - _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 != 200) - { - var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - try - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - if (_errorBody != null) - { - ex.Body = _errorBody; - } - } - catch (JsonException) - { - // Ignore the exception - } - ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); - ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - 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(); - } - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - /// /// Returns instances for the given account name. /// diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/InstancesOperationsExtensions.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/InstancesOperationsExtensions.cs index bfeb769bf28f..2d95841233ab 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/InstancesOperationsExtensions.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/InstancesOperationsExtensions.cs @@ -29,12 +29,15 @@ public static partial class InstancesOperationsExtensions /// /// The operations group for this extension method. /// + /// + /// The resource group name. + /// /// /// Account name. /// - public static IPage ListBySubscription(this IInstancesOperations operations, string accountName) + public static IPage ListByAccount(this IInstancesOperations operations, string resourceGroupName, string accountName) { - return operations.ListBySubscriptionAsync(accountName).GetAwaiter().GetResult(); + return operations.ListByAccountAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); } /// @@ -43,22 +46,25 @@ public static IPage ListBySubscription(this IInstancesOperations opera /// /// The operations group for this extension method. /// + /// + /// The resource group name. + /// /// /// Account name. /// /// /// The cancellation token. /// - public static async Task> ListBySubscriptionAsync(this IInstancesOperations operations, string accountName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task> ListByAccountAsync(this IInstancesOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(accountName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.ListByAccountWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Returns instances for the given account name. + /// Returns instance details for the given instance and account name. /// /// /// The operations group for this extension method. @@ -69,13 +75,16 @@ public static IPage ListBySubscription(this IInstancesOperations opera /// /// Account name. /// - public static IPage ListByAccount(this IInstancesOperations operations, string resourceGroupName, string accountName) + /// + /// Instance name. + /// + public static Instance Get(this IInstancesOperations operations, string resourceGroupName, string accountName, string instanceName) { - return operations.ListByAccountAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + return operations.GetAsync(resourceGroupName, accountName, instanceName).GetAwaiter().GetResult(); } /// - /// Returns instances for the given account name. + /// Returns instance details for the given instance and account name. /// /// /// The operations group for this extension method. @@ -86,19 +95,22 @@ public static IPage ListByAccount(this IInstancesOperations operations /// /// Account name. /// + /// + /// Instance name. + /// /// /// The cancellation token. /// - public static async Task> ListByAccountAsync(this IInstancesOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAsync(this IInstancesOperations operations, string resourceGroupName, string accountName, string instanceName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.ListByAccountWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, instanceName, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } } /// - /// Returns instances for the given account and instance name. + /// Checks whether instance exists. /// /// /// The operations group for this extension method. @@ -112,13 +124,13 @@ public static IPage ListByAccount(this IInstancesOperations operations /// /// Instance name. /// - public static Instance Get(this IInstancesOperations operations, string resourceGroupName, string accountName, string instanceName) + public static void Head(this IInstancesOperations operations, string resourceGroupName, string accountName, string instanceName) { - return operations.GetAsync(resourceGroupName, accountName, instanceName).GetAwaiter().GetResult(); + operations.HeadAsync(resourceGroupName, accountName, instanceName).GetAwaiter().GetResult(); } /// - /// Returns instances for the given account and instance name. + /// Checks whether instance exists. /// /// /// The operations group for this extension method. @@ -135,12 +147,9 @@ public static Instance Get(this IInstancesOperations operations, string resource /// /// The cancellation token. /// - public static async Task GetAsync(this IInstancesOperations operations, string resourceGroupName, string accountName, string instanceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task HeadAsync(this IInstancesOperations operations, string resourceGroupName, string accountName, string instanceName, CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, instanceName, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } + (await operations.HeadWithHttpMessagesAsync(resourceGroupName, accountName, instanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// @@ -387,40 +396,6 @@ public static void BeginDelete(this IInstancesOperations operations, string reso (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, instanceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); } - /// - /// Returns instances for the given account name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - public static IPage ListBySubscriptionNext(this IInstancesOperations operations, string nextPageLink) - { - return operations.ListBySubscriptionNextAsync(nextPageLink).GetAwaiter().GetResult(); - } - - /// - /// Returns instances for the given account name. - /// - /// - /// The operations group for this extension method. - /// - /// - /// The NextLink from the previous successful call to List operation. - /// - /// - /// The cancellation token. - /// - public static async Task> ListBySubscriptionNextAsync(this IInstancesOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ListBySubscriptionNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - /// /// Returns instances for the given account name. /// diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Account.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Account.cs index 775570668718..fa86a62e43ac 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Account.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Account.cs @@ -42,16 +42,25 @@ public Account() /// The type of the resource. E.g. /// "Microsoft.Compute/virtualMachines" or /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Resource tags. /// Provisioning state. Possible values /// include: 'Succeeded', 'Deleted', 'Failed', 'Canceled', 'Accepted', /// 'Creating' /// API host name. - public Account(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), string hostName = default(string)) - : base(location, id, name, type, tags) + /// Whether or not public network + /// access is allowed for the container registry. Possible values + /// include: 'Enabled', 'Disabled' + /// The type of identity used for the + /// resource. + public Account(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), string provisioningState = default(string), string hostName = default(string), string publicNetworkAccess = default(string), ManagedServiceIdentity identity = default(ManagedServiceIdentity)) + : base(location, id, name, type, systemData, tags) { ProvisioningState = provisioningState; HostName = hostName; + PublicNetworkAccess = publicNetworkAccess; + Identity = identity; CustomInit(); } @@ -73,5 +82,19 @@ public Account() [JsonProperty(PropertyName = "properties.hostName")] public string HostName { get; private set; } + /// + /// Gets or sets whether or not public network access is allowed for + /// the container registry. Possible values include: 'Enabled', + /// 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + /// + /// Gets or sets the type of identity used for the resource. + /// + [JsonProperty(PropertyName = "identity")] + public ManagedServiceIdentity Identity { get; set; } + } } diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/AccountUpdate.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/AccountUpdate.cs index d859ea3e037d..5560a819edbc 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/AccountUpdate.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/AccountUpdate.cs @@ -33,11 +33,14 @@ public AccountUpdate() /// /// List of key value pairs that describe the /// resource. This will overwrite the existing tags. + /// The type of identity used for the + /// resource. /// The geo-location where the resource /// lives - public AccountUpdate(IDictionary tags = default(IDictionary), string location = default(string)) + public AccountUpdate(IDictionary tags = default(IDictionary), ManagedServiceIdentity identity = default(ManagedServiceIdentity), string location = default(string)) : base(tags) { + Identity = identity; Location = location; CustomInit(); } @@ -47,6 +50,12 @@ public AccountUpdate() /// partial void CustomInit(); + /// + /// Gets or sets the type of identity used for the resource. + /// + [JsonProperty(PropertyName = "identity")] + public ManagedServiceIdentity Identity { get; set; } + /// /// Gets or sets the geo-location where the resource lives /// diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/AzureEntityResource.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/AzureEntityResource.cs index ccc8f00303cc..c742270e9006 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/AzureEntityResource.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/AzureEntityResource.cs @@ -39,9 +39,11 @@ public AzureEntityResource() /// The type of the resource. E.g. /// "Microsoft.Compute/virtualMachines" or /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Resource Etag. - public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), string etag = default(string)) - : base(id, name, type) + public AzureEntityResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string etag = default(string)) + : base(id, name, type, systemData) { Etag = etag; CustomInit(); diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CheckNameAvailabilityReason.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CheckNameAvailabilityReason.cs new file mode 100644 index 000000000000..3efcc2436f2d --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CheckNameAvailabilityReason.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + + /// + /// Defines values for CheckNameAvailabilityReason. + /// + public static class CheckNameAvailabilityReason + { + public const string Invalid = "Invalid"; + public const string AlreadyExists = "AlreadyExists"; + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CheckNameAvailabilityRequest.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CheckNameAvailabilityRequest.cs new file mode 100644 index 000000000000..2967d694c99e --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CheckNameAvailabilityRequest.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The check availability request body. + /// + public partial class CheckNameAvailabilityRequest + { + /// + /// Initializes a new instance of the CheckNameAvailabilityRequest + /// class. + /// + public CheckNameAvailabilityRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameAvailabilityRequest + /// class. + /// + /// The name of the resource for which availability + /// needs to be checked. + /// The resource type. + public CheckNameAvailabilityRequest(string name = default(string), string type = default(string)) + { + Name = name; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the name of the resource for which availability needs + /// to be checked. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the resource type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CheckNameAvailabilityResponse.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CheckNameAvailabilityResponse.cs new file mode 100644 index 000000000000..f12b9ae6bfef --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CheckNameAvailabilityResponse.cs @@ -0,0 +1,74 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The check availability result. + /// + public partial class CheckNameAvailabilityResponse + { + /// + /// Initializes a new instance of the CheckNameAvailabilityResponse + /// class. + /// + public CheckNameAvailabilityResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameAvailabilityResponse + /// class. + /// + /// Indicates if the resource name is + /// available. + /// The reason why the given name is not + /// available. Possible values include: 'Invalid', + /// 'AlreadyExists' + /// Detailed reason why the given name is + /// available. + public CheckNameAvailabilityResponse(bool? nameAvailable = default(bool?), string reason = default(string), string message = default(string)) + { + NameAvailable = nameAvailable; + Reason = reason; + Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates if the resource name is available. + /// + [JsonProperty(PropertyName = "nameAvailable")] + public bool? NameAvailable { get; set; } + + /// + /// Gets or sets the reason why the given name is not available. + /// Possible values include: 'Invalid', 'AlreadyExists' + /// + [JsonProperty(PropertyName = "reason")] + public string Reason { get; set; } + + /// + /// Gets or sets detailed reason why the given name is available. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CreatedByType.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CreatedByType.cs new file mode 100644 index 000000000000..efe9aa839fa9 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/CreatedByType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + + /// + /// Defines values for CreatedByType. + /// + public static class CreatedByType + { + public const string User = "User"; + public const string Application = "Application"; + public const string ManagedIdentity = "ManagedIdentity"; + public const string Key = "Key"; + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/DiagnosticStorageProperties.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/DiagnosticStorageProperties.cs new file mode 100644 index 000000000000..9f7459e2eb0d --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/DiagnosticStorageProperties.cs @@ -0,0 +1,76 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Customer-initiated diagnostic log collection storage properties + /// + public partial class DiagnosticStorageProperties + { + /// + /// Initializes a new instance of the DiagnosticStorageProperties + /// class. + /// + public DiagnosticStorageProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DiagnosticStorageProperties + /// class. + /// + /// ResourceId of the diagnostic storage + /// account + /// ConnectionString of the diagnostic + /// storage account + public DiagnosticStorageProperties(string resourceId, string connectionString = default(string)) + { + ConnectionString = connectionString; + ResourceId = resourceId; + CustomInit(); + } + /// + /// Static constructor for DiagnosticStorageProperties class. + /// + static DiagnosticStorageProperties() + { + AuthenticationType = "KeyBased"; + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets connectionString of the diagnostic storage account + /// + [JsonProperty(PropertyName = "connectionString")] + public string ConnectionString { get; set; } + + /// + /// Gets or sets resourceId of the diagnostic storage account + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Authentication Type + /// + [JsonProperty(PropertyName = "authenticationType")] + public static string AuthenticationType { get; private set; } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..69522f376a91 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorAdditionalInfo.cs @@ -0,0 +1,59 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The resource management error additional info. + /// + public partial class ErrorAdditionalInfo + { + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + public ErrorAdditionalInfo() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorAdditionalInfo class. + /// + /// The additional info type. + /// The additional info. + public ErrorAdditionalInfo(string type = default(string), object info = default(object)) + { + Type = type; + Info = info; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the additional info type. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets the additional info. + /// + [JsonProperty(PropertyName = "info")] + public object Info { get; private set; } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorDefinition.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorDefinition.cs deleted file mode 100644 index c4d3fb9415ab..000000000000 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorDefinition.cs +++ /dev/null @@ -1,69 +0,0 @@ -// -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for -// license information. -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.Azure.Management.DeviceUpdate.Models -{ - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - - /// - /// Error definition. - /// - public partial class ErrorDefinition - { - /// - /// Initializes a new instance of the ErrorDefinition class. - /// - public ErrorDefinition() - { - CustomInit(); - } - - /// - /// Initializes a new instance of the ErrorDefinition class. - /// - /// Error status code. - /// Error message. - /// Error details. - public ErrorDefinition(string code = default(string), string message = default(string), IList details = default(IList)) - { - Code = code; - Message = message; - Details = details; - CustomInit(); - } - - /// - /// An initialization method that performs custom operations like setting defaults - /// - partial void CustomInit(); - - /// - /// Gets error status code. - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; private set; } - - /// - /// Gets error message. - /// - [JsonProperty(PropertyName = "message")] - public string Message { get; private set; } - - /// - /// Gets or sets error details. - /// - [JsonProperty(PropertyName = "details")] - public IList Details { get; set; } - - } -} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorDetail.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorDetail.cs new file mode 100644 index 000000000000..5aada779027d --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorDetail.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The error detail. + /// + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + /// The error code. + /// The error message. + /// The error target. + /// The error details. + /// The error additional info. + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList), IList additionalInfo = default(IList)) + { + Code = code; + Message = message; + Target = target; + Details = details; + AdditionalInfo = additionalInfo; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the error code. + /// + [JsonProperty(PropertyName = "code")] + public string Code { get; private set; } + + /// + /// Gets the error message. + /// + [JsonProperty(PropertyName = "message")] + public string Message { get; private set; } + + /// + /// Gets the error target. + /// + [JsonProperty(PropertyName = "target")] + public string Target { get; private set; } + + /// + /// Gets the error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorResponse.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorResponse.cs index 0523c368121a..3fffc19cf5a2 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorResponse.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ErrorResponse.cs @@ -14,9 +14,13 @@ namespace Microsoft.Azure.Management.DeviceUpdate.Models using System.Linq; /// - /// Error response indicates that the service is not able to process the - /// incoming request. + /// Error response /// + /// + /// Common error response for all Azure Resource Manager APIs to return + /// error details for failed operations. (This also follows the OData error + /// response format.). + /// public partial class ErrorResponse { /// @@ -30,11 +34,9 @@ public ErrorResponse() /// /// Initializes a new instance of the ErrorResponse class. /// - /// Error status code. - /// Error details. - public ErrorResponse(string code = default(string), ErrorDefinition error = default(ErrorDefinition)) + /// The error object. + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) { - Code = code; Error = error; CustomInit(); } @@ -45,16 +47,10 @@ public ErrorResponse() partial void CustomInit(); /// - /// Gets error status code. - /// - [JsonProperty(PropertyName = "code")] - public string Code { get; private set; } - - /// - /// Gets error details. + /// Gets or sets the error object. /// [JsonProperty(PropertyName = "error")] - public ErrorDefinition Error { get; private set; } + public ErrorDetail Error { get; set; } } } diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/GroupIdProvisioningState.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/GroupIdProvisioningState.cs new file mode 100644 index 000000000000..28e6fdd5c391 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/GroupIdProvisioningState.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + + /// + /// Defines values for GroupIdProvisioningState. + /// + public static class GroupIdProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/GroupInformation.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/GroupInformation.cs new file mode 100644 index 000000000000..ac94b4e0988f --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/GroupInformation.cs @@ -0,0 +1,94 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// The group information for creating a private endpoint on an Account + /// + [Rest.Serialization.JsonTransformation] + public partial class GroupInformation : ProxyResource + { + /// + /// Initializes a new instance of the GroupInformation class. + /// + public GroupInformation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the GroupInformation class. + /// + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// The private link resource group id. + /// The private link resource required + /// member names. + /// The private link resource Private + /// link DNS zone name. + /// The provisioning state of private + /// link group ID. Possible values include: 'Succeeded', 'Failed', + /// 'Canceled' + public GroupInformation(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList), string provisioningState = default(string)) + : base(id, name, type, systemData) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the private link resource group id. + /// + [JsonProperty(PropertyName = "properties.groupId")] + public string GroupId { get; private set; } + + /// + /// Gets the private link resource required member names. + /// + [JsonProperty(PropertyName = "properties.requiredMembers")] + public IList RequiredMembers { get; private set; } + + /// + /// Gets or sets the private link resource Private link DNS zone name. + /// + [JsonProperty(PropertyName = "properties.requiredZoneNames")] + public IList RequiredZoneNames { get; set; } + + /// + /// Gets the provisioning state of private link group ID. Possible + /// values include: 'Succeeded', 'Failed', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; private set; } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Instance.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Instance.cs index 2388f859e207..527d6879b463 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Instance.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Instance.cs @@ -42,6 +42,8 @@ public Instance() /// The type of the resource. E.g. /// "Microsoft.Compute/virtualMachines" or /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Resource tags. /// Provisioning state. Possible values /// include: 'Succeeded', 'Deleted', 'Failed', 'Canceled', 'Accepted', @@ -50,12 +52,16 @@ public Instance() /// Instance belongs to. /// List of IoT Hubs associated with the /// account. - public Instance(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string provisioningState = default(string), string accountName = default(string), IList iotHubs = default(IList)) - : base(location, id, name, type, tags) + /// Enables or Disables the diagnostic + /// logs collection + public Instance(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary), string provisioningState = default(string), string accountName = default(string), IList iotHubs = default(IList), bool? enableDiagnostics = default(bool?), DiagnosticStorageProperties diagnosticStorageProperties = default(DiagnosticStorageProperties)) + : base(location, id, name, type, systemData, tags) { ProvisioningState = provisioningState; AccountName = accountName; IotHubs = iotHubs; + EnableDiagnostics = enableDiagnostics; + DiagnosticStorageProperties = diagnosticStorageProperties; CustomInit(); } @@ -83,5 +89,16 @@ public Instance() [JsonProperty(PropertyName = "properties.iotHubs")] public IList IotHubs { get; set; } + /// + /// Gets or sets enables or Disables the diagnostic logs collection + /// + [JsonProperty(PropertyName = "properties.enableDiagnostics")] + public bool? EnableDiagnostics { get; set; } + + /// + /// + [JsonProperty(PropertyName = "properties.diagnosticStorageProperties")] + public DiagnosticStorageProperties DiagnosticStorageProperties { get; set; } + } } diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ManagedServiceIdentity.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ManagedServiceIdentity.cs new file mode 100644 index 000000000000..079c33965459 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ManagedServiceIdentity.cs @@ -0,0 +1,85 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Managed service identity (system assigned and/or user assigned + /// identities) + /// + public partial class ManagedServiceIdentity + { + /// + /// Initializes a new instance of the ManagedServiceIdentity class. + /// + public ManagedServiceIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ManagedServiceIdentity class. + /// + /// Possible values include: 'None', + /// 'SystemAssigned', 'UserAssigned', + /// 'SystemAssigned,UserAssigned' + /// The service principal ID of the system + /// assigned identity. This property will only be provided for a system + /// assigned identity. + /// The tenant ID of the system assigned + /// identity. This property will only be provided for a system assigned + /// identity. + public ManagedServiceIdentity(string type, System.Guid? principalId = default(System.Guid?), System.Guid? tenantId = default(System.Guid?), IDictionary userAssignedIdentities = default(IDictionary)) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + UserAssignedIdentities = userAssignedIdentities; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the service principal ID of the system assigned identity. This + /// property will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public System.Guid? PrincipalId { get; private set; } + + /// + /// Gets the tenant ID of the system assigned identity. This property + /// will only be provided for a system assigned identity. + /// + [JsonProperty(PropertyName = "tenantId")] + public System.Guid? TenantId { get; private set; } + + /// + /// Gets or sets possible values include: 'None', 'SystemAssigned', + /// 'UserAssigned', 'SystemAssigned,UserAssigned' + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// + [JsonProperty(PropertyName = "userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; set; } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ManagedServiceIdentityType.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ManagedServiceIdentityType.cs new file mode 100644 index 000000000000..f415deaedc08 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ManagedServiceIdentityType.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + + /// + /// Defines values for ManagedServiceIdentityType. + /// + public static class ManagedServiceIdentityType + { + public const string None = "None"; + public const string SystemAssigned = "SystemAssigned"; + public const string UserAssigned = "UserAssigned"; + public const string SystemAssignedUserAssigned = "SystemAssigned,UserAssigned"; + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Page1.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Page1.cs new file mode 100644 index 000000000000..59a261f1abb7 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Page1.cs @@ -0,0 +1,53 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [JsonObject] + public class Page1 : IPage + { + /// + /// Gets the link to the next page. + /// + [JsonProperty("")] + public string NextPageLink { get; private set; } + + [JsonProperty("value")] + private IList Items{ get; set; } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + public IEnumerator GetEnumerator() + { + return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator(); + } + + /// + /// Returns an enumerator that iterates through the collection. + /// + /// A an enumerator that can be used to iterate through the collection. + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpoint.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 000000000000..dde095f0fcdb --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpoint.cs @@ -0,0 +1,51 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Private Endpoint resource. + /// + public partial class PrivateEndpoint + { + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + public PrivateEndpoint() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpoint class. + /// + /// The ARM identifier for Private Endpoint + public PrivateEndpoint(string id = default(string)) + { + Id = id; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the ARM identifier for Private Endpoint + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 000000000000..706723c6c69b --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpointConnection.cs @@ -0,0 +1,87 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The Private Endpoint Connection resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateEndpointConnection : Resource + { + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + public PrivateEndpointConnection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateEndpointConnection class. + /// + /// A collection of + /// information about the state of the connection between service + /// consumer and provider. + /// Fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + /// The name of the resource + /// The type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + /// The resource of private end + /// point. + /// The provisioning state of the + /// private endpoint connection resource. Possible values include: + /// 'Succeeded', 'Creating', 'Deleting', 'Failed' + public PrivateEndpointConnection(PrivateLinkServiceConnectionState privateLinkServiceConnectionState, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), PrivateEndpoint privateEndpoint = default(PrivateEndpoint), string provisioningState = default(string)) + : base(id, name, type, systemData) + { + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the resource of private end point. + /// + [JsonProperty(PropertyName = "properties.privateEndpoint")] + public PrivateEndpoint PrivateEndpoint { get; set; } + + /// + /// Gets or sets a collection of information about the state of the + /// connection between service consumer and provider. + /// + [JsonProperty(PropertyName = "properties.privateLinkServiceConnectionState")] + public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + + /// + /// Gets or sets the provisioning state of the private endpoint + /// connection resource. Possible values include: 'Succeeded', + /// 'Creating', 'Deleting', 'Failed' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 000000000000..631a74469059 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs @@ -0,0 +1,24 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + + /// + /// Defines values for PrivateEndpointConnectionProvisioningState. + /// + public static class PrivateEndpointConnectionProvisioningState + { + public const string Succeeded = "Succeeded"; + public const string Creating = "Creating"; + public const string Deleting = "Deleting"; + public const string Failed = "Failed"; + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs new file mode 100644 index 000000000000..f8076abb83bd --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs @@ -0,0 +1,23 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + + /// + /// Defines values for PrivateEndpointServiceConnectionStatus. + /// + public static class PrivateEndpointServiceConnectionStatus + { + public const string Pending = "Pending"; + public const string Approved = "Approved"; + public const string Rejected = "Rejected"; + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateLinkResourceProperties.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateLinkResourceProperties.cs new file mode 100644 index 000000000000..d851945b94ee --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateLinkResourceProperties.cs @@ -0,0 +1,73 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a private link resource. + /// + public partial class PrivateLinkResourceProperties + { + /// + /// Initializes a new instance of the PrivateLinkResourceProperties + /// class. + /// + public PrivateLinkResourceProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResourceProperties + /// class. + /// + /// The private link resource group id. + /// The private link resource required + /// member names. + /// The private link resource Private + /// link DNS zone name. + public PrivateLinkResourceProperties(string groupId = default(string), IList requiredMembers = default(IList), IList requiredZoneNames = default(IList)) + { + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the private link resource group id. + /// + [JsonProperty(PropertyName = "groupId")] + public string GroupId { get; private set; } + + /// + /// Gets the private link resource required member names. + /// + [JsonProperty(PropertyName = "requiredMembers")] + public IList RequiredMembers { get; private set; } + + /// + /// Gets or sets the private link resource Private link DNS zone name. + /// + [JsonProperty(PropertyName = "requiredZoneNames")] + public IList RequiredZoneNames { get; set; } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateLinkServiceConnectionState.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateLinkServiceConnectionState.cs new file mode 100644 index 000000000000..16f564511181 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PrivateLinkServiceConnectionState.cs @@ -0,0 +1,77 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// A collection of information about the state of the connection between + /// service consumer and provider. + /// + public partial class PrivateLinkServiceConnectionState + { + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + public PrivateLinkServiceConnectionState() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkServiceConnectionState + /// class. + /// + /// Indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected' + /// The reason for approval/rejection of the + /// connection. + /// A message indicating if changes on + /// the service provider require any updates on the consumer. + public PrivateLinkServiceConnectionState(string status = default(string), string description = default(string), string actionsRequired = default(string)) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets indicates whether the connection has been + /// Approved/Rejected/Removed by the owner of the service. Possible + /// values include: 'Pending', 'Approved', 'Rejected' + /// + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or sets the reason for approval/rejection of the connection. + /// + [JsonProperty(PropertyName = "description")] + public string Description { get; set; } + + /// + /// Gets or sets a message indicating if changes on the service + /// provider require any updates on the consumer. + /// + [JsonProperty(PropertyName = "actionsRequired")] + public string ActionsRequired { get; set; } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ProxyResource.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ProxyResource.cs index 8e3a9a1646a8..6e9ab4185d07 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ProxyResource.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/ProxyResource.cs @@ -38,8 +38,10 @@ public ProxyResource() /// The type of the resource. E.g. /// "Microsoft.Compute/virtualMachines" or /// "Microsoft.Storage/storageAccounts" - public ProxyResource(string id = default(string), string name = default(string), string type = default(string)) - : base(id, name, type) + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, systemData) { CustomInit(); } diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PublicNetworkAccess.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 000000000000..689aeeef76e3 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/PublicNetworkAccess.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + + /// + /// Defines values for PublicNetworkAccess. + /// + public static class PublicNetworkAccess + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Resource.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Resource.cs index a06d89a1ec26..3e563f1026d3 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Resource.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/Resource.cs @@ -41,11 +41,14 @@ public Resource() /// The type of the resource. E.g. /// "Microsoft.Compute/virtualMachines" or /// "Microsoft.Storage/storageAccounts" - public Resource(string id = default(string), string name = default(string), string type = default(string)) + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. + public Resource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) { Id = id; Name = name; Type = type; + SystemData = systemData; CustomInit(); } @@ -75,5 +78,12 @@ public Resource() [JsonProperty(PropertyName = "type")] public string Type { get; private set; } + /// + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. + /// + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } + } } diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/SystemData.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/SystemData.cs new file mode 100644 index 000000000000..07ec58e13818 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/SystemData.cs @@ -0,0 +1,103 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Metadata pertaining to creation and last modification of the resource. + /// + public partial class SystemData + { + /// + /// Initializes a new instance of the SystemData class. + /// + public SystemData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SystemData class. + /// + /// The identity that created the + /// resource. + /// The type of identity that created the + /// resource. Possible values include: 'User', 'Application', + /// 'ManagedIdentity', 'Key' + /// The timestamp of resource creation + /// (UTC). + /// The identity that last modified the + /// resource. + /// The type of identity that last + /// modified the resource. Possible values include: 'User', + /// 'Application', 'ManagedIdentity', 'Key' + /// The timestamp of resource last + /// modification (UTC) + public SystemData(string createdBy = default(string), string createdByType = default(string), System.DateTime? createdAt = default(System.DateTime?), string lastModifiedBy = default(string), string lastModifiedByType = default(string), System.DateTime? lastModifiedAt = default(System.DateTime?)) + { + CreatedBy = createdBy; + CreatedByType = createdByType; + CreatedAt = createdAt; + LastModifiedBy = lastModifiedBy; + LastModifiedByType = lastModifiedByType; + LastModifiedAt = lastModifiedAt; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the identity that created the resource. + /// + [JsonProperty(PropertyName = "createdBy")] + public string CreatedBy { get; set; } + + /// + /// Gets or sets the type of identity that created the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "createdByType")] + public string CreatedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource creation (UTC). + /// + [JsonProperty(PropertyName = "createdAt")] + public System.DateTime? CreatedAt { get; set; } + + /// + /// Gets or sets the identity that last modified the resource. + /// + [JsonProperty(PropertyName = "lastModifiedBy")] + public string LastModifiedBy { get; set; } + + /// + /// Gets or sets the type of identity that last modified the resource. + /// Possible values include: 'User', 'Application', 'ManagedIdentity', + /// 'Key' + /// + [JsonProperty(PropertyName = "lastModifiedByType")] + public string LastModifiedByType { get; set; } + + /// + /// Gets or sets the timestamp of resource last modification (UTC) + /// + [JsonProperty(PropertyName = "lastModifiedAt")] + public System.DateTime? LastModifiedAt { get; set; } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/TrackedResource.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/TrackedResource.cs index 78b5ed6bfc12..dfaa2ebdc100 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/TrackedResource.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/TrackedResource.cs @@ -43,9 +43,11 @@ public TrackedResource() /// The type of the resource. E.g. /// "Microsoft.Compute/virtualMachines" or /// "Microsoft.Storage/storageAccounts" + /// Azure Resource Manager metadata containing + /// createdBy and modifiedBy information. /// Resource tags. - public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) - : base(id, name, type) + public TrackedResource(string location, string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), IDictionary tags = default(IDictionary)) + : base(id, name, type, systemData) { Tags = tags; Location = location; diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/UserAssignedIdentity.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/UserAssignedIdentity.cs new file mode 100644 index 000000000000..45d718895ac5 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/Models/UserAssignedIdentity.cs @@ -0,0 +1,61 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// User assigned identity properties + /// + public partial class UserAssignedIdentity + { + /// + /// Initializes a new instance of the UserAssignedIdentity class. + /// + public UserAssignedIdentity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UserAssignedIdentity class. + /// + /// The principal ID of the assigned + /// identity. + /// The client ID of the assigned + /// identity. + public UserAssignedIdentity(System.Guid? principalId = default(System.Guid?), System.Guid? clientId = default(System.Guid?)) + { + PrincipalId = principalId; + ClientId = clientId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the principal ID of the assigned identity. + /// + [JsonProperty(PropertyName = "principalId")] + public System.Guid? PrincipalId { get; private set; } + + /// + /// Gets the client ID of the assigned identity. + /// + [JsonProperty(PropertyName = "clientId")] + public System.Guid? ClientId { get; private set; } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateEndpointConnectionsOperations.cs new file mode 100644 index 000000000000..72d6f424f391 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -0,0 +1,901 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateEndpointConnectionsOperations operations. + /// + internal partial class PrivateEndpointConnectionsOperations : IServiceOperations, IPrivateEndpointConnectionsOperations + { + /// + /// Initializes a new instance of the PrivateEndpointConnectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateEndpointConnectionsOperations(DeviceUpdateClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DeviceUpdateClient + /// + public DeviceUpdateClient Client { get; private set; } + + /// + /// List all private endpoint connections in a device update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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>> ListByAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, 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 (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByAccount", 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.DeviceUpdate/accounts/{accountName}/privateEndpointConnections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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("GET"); + _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 != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the specified private endpoint connection associated with the device + /// update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, 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 (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", 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.DeviceUpdate/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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("GET"); + _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 != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the device update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The parameters for creating a private endpoint connection. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, privateEndpointConnection, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// device update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the device update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The parameters for creating a private endpoint connection. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, 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 (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (privateEndpointConnection == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnection"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("privateEndpointConnection", privateEndpointConnection); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreateOrUpdate", 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.DeviceUpdate/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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("PUT"); + _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; + if(privateEndpointConnection != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(privateEndpointConnection, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // 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 != 201) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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(); + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// device update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// 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 BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string accountName, string privateEndpointConnectionName, 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 (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", 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.DeviceUpdate/accounts/{accountName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{privateEndpointConnectionName}", System.Uri.EscapeDataString(privateEndpointConnectionName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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("DELETE"); + _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 != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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; + } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 000000000000..cfaec7e37680 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,323 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateEndpointConnectionsOperations. + /// + public static partial class PrivateEndpointConnectionsOperationsExtensions + { + /// + /// List all private endpoint connections in a device update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + public static IEnumerable ListByAccount(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string accountName) + { + return operations.ListByAccountAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// List all private endpoint connections in a device update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByAccountAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByAccountWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the specified private endpoint connection associated with the device + /// update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName) + { + return operations.GetAsync(resourceGroupName, accountName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Get the specified private endpoint connection associated with the device + /// update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the device update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The parameters for creating a private endpoint connection. + /// + public static PrivateEndpointConnection CreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection) + { + return operations.CreateOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, privateEndpointConnection).GetAwaiter().GetResult(); + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the device update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The parameters for creating a private endpoint connection. + /// + /// + /// The cancellation token. + /// + public static async Task CreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateOrUpdateWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, privateEndpointConnection, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// device update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + public static void Delete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName) + { + operations.DeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// device update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the device update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The parameters for creating a private endpoint connection. + /// + public static PrivateEndpointConnection BeginCreateOrUpdate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection) + { + return operations.BeginCreateOrUpdateAsync(resourceGroupName, accountName, privateEndpointConnectionName, privateEndpointConnection).GetAwaiter().GetResult(); + } + + /// + /// Update the state of specified private endpoint connection associated with + /// the device update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The parameters for creating a private endpoint connection. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateOrUpdateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, privateEndpointConnection, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// device update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + public static void BeginDelete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName) + { + operations.BeginDeleteAsync(resourceGroupName, accountName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified private endpoint connection associated with the + /// device update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The name of the private endpoint connection associated with the Azure + /// resource + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string accountName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, accountName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateLinkResourcesOperations.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateLinkResourcesOperations.cs new file mode 100644 index 000000000000..285929d0ad81 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateLinkResourcesOperations.cs @@ -0,0 +1,446 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateLinkResourcesOperations operations. + /// + internal partial class PrivateLinkResourcesOperations : IServiceOperations, IPrivateLinkResourcesOperations + { + /// + /// Initializes a new instance of the PrivateLinkResourcesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateLinkResourcesOperations(DeviceUpdateClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the DeviceUpdateClient + /// + public DeviceUpdateClient Client { get; private set; } + + /// + /// List all private link resources in a device update account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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>> ListByAccountWithHttpMessagesAsync(string resourceGroupName, string accountName, 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 (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListByAccount", 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.DeviceUpdate/accounts/{accountName}/privateLinkResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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("GET"); + _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 != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the specified private link resource associated with the device update + /// account. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The group ID of the private link resource. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// 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> GetWithHttpMessagesAsync(string resourceGroupName, string accountName, string groupId, 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 (accountName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "accountName"); + } + if (groupId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("accountName", accountName); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "Get", 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.DeviceUpdate/accounts/{accountName}/privateLinkResources/{groupId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{accountName}", System.Uri.EscapeDataString(accountName)); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(groupId)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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("GET"); + _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 != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + 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(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateLinkResourcesOperationsExtensions.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateLinkResourcesOperationsExtensions.cs new file mode 100644 index 000000000000..091a93036639 --- /dev/null +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/PrivateLinkResourcesOperationsExtensions.cs @@ -0,0 +1,115 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.DeviceUpdate +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for PrivateLinkResourcesOperations. + /// + public static partial class PrivateLinkResourcesOperationsExtensions + { + /// + /// List all private link resources in a device update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + public static IEnumerable ListByAccount(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string accountName) + { + return operations.ListByAccountAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); + } + + /// + /// List all private link resources in a device update account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The cancellation token. + /// + public static async Task> ListByAccountAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string accountName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListByAccountWithHttpMessagesAsync(resourceGroupName, accountName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the specified private link resource associated with the device update + /// account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The group ID of the private link resource. + /// + public static GroupInformation Get(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string accountName, string groupId) + { + return operations.GetAsync(resourceGroupName, accountName, groupId).GetAwaiter().GetResult(); + } + + /// + /// Get the specified private link resource associated with the device update + /// account. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The resource group name. + /// + /// + /// Account name. + /// + /// + /// The group ID of the private link resource. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateLinkResourcesOperations operations, string resourceGroupName, string accountName, string groupId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, accountName, groupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/SdkInfo_DeviceUpdate.cs b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/SdkInfo_DeviceUpdate.cs index 3857f18d5fad..79af262ce2b2 100644 --- a/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/SdkInfo_DeviceUpdate.cs +++ b/sdk/deviceupdate/Microsoft.Azure.Management.DeviceUpdate/src/Generated/SdkInfo_DeviceUpdate.cs @@ -20,21 +20,13 @@ public static IEnumerable> ApiInfo_DeviceUpdate return new Tuple[] { new Tuple("DeviceUpdate", "Accounts", "2020-03-01-preview"), + new Tuple("DeviceUpdate", "CheckNameAvailability", "2020-03-01-preview"), new Tuple("DeviceUpdate", "Instances", "2020-03-01-preview"), new Tuple("DeviceUpdate", "Operations", "2020-03-01-preview"), + new Tuple("DeviceUpdate", "PrivateEndpointConnections", "2020-03-01-preview"), + new Tuple("DeviceUpdate", "PrivateLinkResources", "2020-03-01-preview"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "v2"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4413"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/deviceupdate/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp-sdks-folder=E:\\GitHub\\azure-sdk-for-net\\sdk"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "4d1ea13dd5ec9e9e73e8ebabfa2d27a83b7e0e0d"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -