From 26c7068311f49b5e43a5cae3f68c190e7fac8e74 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 28 Mar 2022 14:45:33 +0000 Subject: [PATCH] CodeGen from PR 17439 in Azure/azure-rest-api-specs Merge d0b4592a57a50f571f3c074549f9f7e0c0eda617 into 3026119ab41bbce77275cfa3a1afbabf43af5aea --- .../src/Generated/AppsOperations.cs | 214 ++-- .../src/Generated/AppsOperationsExtensions.cs | 34 +- .../src/Generated/IAppsOperations.cs | 48 +- .../src/Generated/IIotCentralClient.cs | 10 + .../src/Generated/IOperations.cs | 4 +- .../IPrivateEndpointConnectionsOperations.cs | 201 ++++ .../src/Generated/IPrivateLinksOperations.cs | 82 ++ .../src/Generated/IotCentralClient.cs | 14 +- .../src/Generated/Models/App.cs | 67 +- .../src/Generated/Models/AppPatch.cs | 55 +- .../Models/AppsCreateOrUpdateHeaders.cs | 64 ++ .../src/Generated/Models/AppsDeleteHeaders.cs | 74 ++ .../src/Generated/Models/AppsUpdateHeaders.cs | 74 ++ .../Generated/Models/AzureEntityResource.cs | 64 ++ .../src/Generated/Models/CreatedByType.cs | 24 + .../Generated/Models/ErrorAdditionalInfo.cs | 59 ++ .../{CloudErrorBody.cs => ErrorDetail.cs} | 31 +- .../src/Generated/Models/ErrorResponse.cs | 56 ++ .../Models/ErrorResponseException.cs | 62 ++ .../src/Generated/Models/NetworkAction.cs | 22 + .../Generated/Models/NetworkRuleSetIpRule.cs | 59 ++ .../src/Generated/Models/NetworkRuleSets.cs | 85 ++ .../src/Generated/Models/Page1.cs | 53 + .../src/Generated/Models/PrivateEndpoint.cs | 51 + .../Models/PrivateEndpointConnection.cs | 111 +++ ...vateEndpointConnectionProvisioningState.cs | 24 + ...PrivateEndpointConnectionsCreateHeaders.cs | 66 ++ ...PrivateEndpointConnectionsDeleteHeaders.cs | 76 ++ .../PrivateEndpointServiceConnectionStatus.cs | 23 + .../Generated/Models/PrivateLinkResource.cs | 83 ++ .../PrivateLinkServiceConnectionState.cs | 77 ++ .../src/Generated/Models/ProvisioningState.cs | 26 + .../src/Generated/Models/ProxyResource.cs | 55 ++ .../Generated/Models/PublicNetworkAccess.cs | 22 + .../src/Generated/Models/Resource.cs | 68 +- .../src/Generated/Models/SystemData.cs | 103 ++ .../src/Generated/Models/TrackedResource.cs | 89 ++ .../src/Generated/Operations.cs | 22 +- .../PrivateEndpointConnectionsOperations.cs | 922 ++++++++++++++++++ ...EndpointConnectionsOperationsExtensions.cs | 311 ++++++ .../src/Generated/PrivateLinksOperations.cs | 445 +++++++++ .../PrivateLinksOperationsExtensions.cs | 113 +++ .../src/Generated/SdkInfo_IotCentralClient.cs | 17 +- 43 files changed, 3893 insertions(+), 267 deletions(-) create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IPrivateEndpointConnectionsOperations.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IPrivateLinksOperations.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppsCreateOrUpdateHeaders.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppsDeleteHeaders.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppsUpdateHeaders.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AzureEntityResource.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/CreatedByType.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorAdditionalInfo.cs rename sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/{CloudErrorBody.cs => ErrorDetail.cs} (61%) create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorResponse.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorResponseException.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/NetworkAction.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/NetworkRuleSetIpRule.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/NetworkRuleSets.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/Page1.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpoint.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnection.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnectionsCreateHeaders.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnectionsDeleteHeaders.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateLinkResource.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateLinkServiceConnectionState.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ProxyResource.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PublicNetworkAccess.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/SystemData.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/TrackedResource.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateEndpointConnectionsOperations.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateLinksOperations.cs create mode 100644 sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateLinksOperationsExtensions.cs diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/AppsOperations.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/AppsOperations.cs index ad88ea0d746b4..33f9238ceb992 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/AppsOperations.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/AppsOperations.cs @@ -65,7 +65,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -181,14 +181,13 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -198,10 +197,6 @@ internal AppsOperations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -267,10 +262,10 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, App app, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, App app, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, app, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationResponse _response = await BeginCreateOrUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, app, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -292,10 +287,10 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, AppPatch appPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, AppPatch appPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, appPatch, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationHeaderResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, appPatch, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -314,10 +309,10 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send request - AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, customHeaders, cancellationToken).ConfigureAwait(false); return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } @@ -330,7 +325,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -434,14 +429,13 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -451,10 +445,6 @@ internal AppsOperations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -511,7 +501,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -621,14 +611,13 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -638,10 +627,6 @@ internal AppsOperations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -699,7 +684,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -818,14 +803,13 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -835,10 +819,6 @@ internal AppsOperations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -896,7 +876,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1015,14 +995,13 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1032,10 +1011,6 @@ internal AppsOperations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1089,7 +1064,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1193,14 +1168,13 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1210,10 +1184,6 @@ internal AppsOperations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1279,7 +1249,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1294,7 +1264,7 @@ internal AppsOperations(IotCentralClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, App app, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, App app, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1408,16 +1378,15 @@ internal AppsOperations(IotCentralClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 201 && (int)_statusCode != 202) + if ((int)_statusCode != 200 && (int)_statusCode != 201) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1427,10 +1396,6 @@ internal AppsOperations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1443,7 +1408,7 @@ internal AppsOperations(IotCentralClient 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")) @@ -1486,6 +1451,19 @@ internal AppsOperations(IotCentralClient client) throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); } } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1511,12 +1489,9 @@ internal AppsOperations(IotCentralClient client) /// /// 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 /// @@ -1526,7 +1501,7 @@ internal AppsOperations(IotCentralClient client) /// /// A response object containing the response body and response headers. /// - public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, AppPatch appPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, AppPatch appPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1636,16 +1611,15 @@ internal AppsOperations(IotCentralClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) + if ((int)_statusCode != 202) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1655,10 +1629,6 @@ internal AppsOperations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1671,30 +1641,25 @@ internal AppsOperations(IotCentralClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationHeaderResponse(); _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) + try { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + _httpResponse.Dispose(); } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); } if (_shouldTrace) { @@ -1718,7 +1683,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1730,7 +1695,7 @@ internal AppsOperations(IotCentralClient client) /// /// A response object containing the response body and response headers. /// - public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (Client.ApiVersion == null) { @@ -1829,16 +1794,15 @@ internal AppsOperations(IotCentralClient client) HttpStatusCode _statusCode = _httpResponse.StatusCode; cancellationToken.ThrowIfCancellationRequested(); string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + if ((int)_statusCode != 202 && (int)_statusCode != 204) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -1848,10 +1812,6 @@ internal AppsOperations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -1864,13 +1824,26 @@ internal AppsOperations(IotCentralClient client) throw ex; } // Create Result - var _result = new AzureOperationResponse(); + var _result = new AzureOperationHeaderResponse(); _result.Request = _httpRequest; _result.Response = _httpResponse; if (_httpResponse.Headers.Contains("x-ms-request-id")) { _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } if (_shouldTrace) { ServiceClientTracing.Exit(_invocationId, _result); @@ -1890,7 +1863,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -1986,14 +1959,13 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2003,10 +1975,6 @@ internal AppsOperations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2063,7 +2031,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2159,14 +2127,13 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2176,10 +2143,6 @@ internal AppsOperations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -2236,7 +2199,7 @@ internal AppsOperations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -2332,14 +2295,13 @@ internal AppsOperations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -2349,10 +2311,6 @@ internal AppsOperations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/AppsOperationsExtensions.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/AppsOperationsExtensions.cs index fb0252bfb4903..13eca917ef511 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/AppsOperationsExtensions.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/AppsOperationsExtensions.cs @@ -128,7 +128,7 @@ public static App CreateOrUpdate(this IAppsOperations operations, string resourc /// /// The IoT Central application metadata and security metadata. /// - public static App Update(this IAppsOperations operations, string resourceGroupName, string resourceName, AppPatch appPatch) + public static AppsUpdateHeaders Update(this IAppsOperations operations, string resourceGroupName, string resourceName, AppPatch appPatch) { return operations.UpdateAsync(resourceGroupName, resourceName, appPatch).GetAwaiter().GetResult(); } @@ -151,11 +151,11 @@ public static App Update(this IAppsOperations operations, string resourceGroupNa /// /// The cancellation token. /// - public static async Task UpdateAsync(this IAppsOperations operations, string resourceGroupName, string resourceName, AppPatch appPatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task UpdateAsync(this IAppsOperations operations, string resourceGroupName, string resourceName, AppPatch appPatch, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, resourceName, appPatch, null, cancellationToken).ConfigureAwait(false)) { - return _result.Body; + return _result.Headers; } } @@ -171,9 +171,9 @@ public static App Update(this IAppsOperations operations, string resourceGroupNa /// /// The ARM resource name of the IoT Central application. /// - public static void Delete(this IAppsOperations operations, string resourceGroupName, string resourceName) + public static AppsDeleteHeaders Delete(this IAppsOperations operations, string resourceGroupName, string resourceName) { - operations.DeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + return operations.DeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); } /// @@ -191,9 +191,12 @@ public static void Delete(this IAppsOperations operations, string resourceGroupN /// /// The cancellation token. /// - public static async Task DeleteAsync(this IAppsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteAsync(this IAppsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } } /// @@ -425,7 +428,7 @@ public static App BeginCreateOrUpdate(this IAppsOperations operations, string re /// /// The IoT Central application metadata and security metadata. /// - public static App BeginUpdate(this IAppsOperations operations, string resourceGroupName, string resourceName, AppPatch appPatch) + public static AppsUpdateHeaders BeginUpdate(this IAppsOperations operations, string resourceGroupName, string resourceName, AppPatch appPatch) { return operations.BeginUpdateAsync(resourceGroupName, resourceName, appPatch).GetAwaiter().GetResult(); } @@ -448,11 +451,11 @@ public static App BeginUpdate(this IAppsOperations operations, string resourceGr /// /// The cancellation token. /// - public static async Task BeginUpdateAsync(this IAppsOperations operations, string resourceGroupName, string resourceName, AppPatch appPatch, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginUpdateAsync(this IAppsOperations operations, string resourceGroupName, string resourceName, AppPatch appPatch, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, resourceName, appPatch, null, cancellationToken).ConfigureAwait(false)) { - return _result.Body; + return _result.Headers; } } @@ -468,9 +471,9 @@ public static App BeginUpdate(this IAppsOperations operations, string resourceGr /// /// The ARM resource name of the IoT Central application. /// - public static void BeginDelete(this IAppsOperations operations, string resourceGroupName, string resourceName) + public static AppsDeleteHeaders BeginDelete(this IAppsOperations operations, string resourceGroupName, string resourceName) { - operations.BeginDeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + return operations.BeginDeleteAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); } /// @@ -488,9 +491,12 @@ public static void BeginDelete(this IAppsOperations operations, string resourceG /// /// The cancellation token. /// - public static async Task BeginDeleteAsync(this IAppsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task BeginDeleteAsync(this IAppsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } } /// diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IAppsOperations.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IAppsOperations.cs index 534090f46244f..0023befef9a0d 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IAppsOperations.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IAppsOperations.cs @@ -39,7 +39,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -72,7 +72,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -81,7 +81,7 @@ public partial interface IAppsOperations /// /// Thrown when a required parameter is null /// - Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, App app, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> CreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, App app, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update the metadata of an IoT Central application. /// @@ -101,16 +101,13 @@ public partial interface IAppsOperations /// /// 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> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, AppPatch appPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, AppPatch appPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete an IoT Central application. /// @@ -127,13 +124,13 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// - Task DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all IoT Central Applications in a subscription. /// @@ -143,7 +140,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -166,7 +163,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -189,7 +186,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -212,7 +209,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -231,7 +228,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -264,7 +261,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -273,7 +270,7 @@ public partial interface IAppsOperations /// /// Thrown when a required parameter is null /// - Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, App app, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginCreateOrUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, App app, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Update the metadata of an IoT Central application. /// @@ -293,16 +290,13 @@ public partial interface IAppsOperations /// /// 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> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, AppPatch appPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string resourceName, AppPatch appPatch, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Delete an IoT Central application. /// @@ -319,13 +313,13 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// /// Thrown when a required parameter is null /// - Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Get all IoT Central Applications in a subscription. /// @@ -338,7 +332,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -360,7 +354,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -382,7 +376,7 @@ public partial interface IAppsOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IIotCentralClient.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IIotCentralClient.cs index 69123a8a18d43..598bdb2e7457d 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IIotCentralClient.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IIotCentralClient.cs @@ -75,6 +75,16 @@ public partial interface IIotCentralClient : System.IDisposable /// IAppsOperations Apps { get; } + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; } + + /// + /// Gets the IPrivateLinksOperations. + /// + IPrivateLinksOperations PrivateLinks { get; } + /// /// Gets the IOperations. /// diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IOperations.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IOperations.cs index f34c6086a585a..78ab900bb504b 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IOperations.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IOperations.cs @@ -33,7 +33,7 @@ public partial interface IOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -56,7 +56,7 @@ public partial interface IOperations /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IPrivateEndpointConnectionsOperations.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IPrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..b384e938c391f --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IPrivateEndpointConnectionsOperations.cs @@ -0,0 +1,201 @@ +// +// 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.IotCentral +{ + 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 + { + /// + /// Get the metadata of a private endpoint connection for the IoT + /// Central Application. + /// + /// + /// The name of the resource group that contains the IoT Central + /// application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a private endpoint connection. + /// + /// + /// The name of the resource group that contains the IoT Central + /// application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The private endpoint connection metadata. + /// + /// + /// 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> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a private endpoint connection from the IoT Central + /// Application. + /// + /// + /// The name of the resource group that contains the IoT Central + /// application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection 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> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all private endpoint connections of a IoT Central Application. + /// + /// + /// The name of the resource group that contains the IoT Central + /// application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Update a private endpoint connection. + /// + /// + /// The name of the resource group that contains the IoT Central + /// application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The private endpoint connection metadata. + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes a private endpoint connection from the IoT Central + /// Application. + /// + /// + /// The name of the resource group that contains the IoT Central + /// application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection 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> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IPrivateLinksOperations.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IPrivateLinksOperations.cs new file mode 100644 index 0000000000000..edf00b0fe2933 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IPrivateLinksOperations.cs @@ -0,0 +1,82 @@ +// +// 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.IotCentral +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// PrivateLinksOperations operations. + /// + public partial interface IPrivateLinksOperations + { + /// + /// Get a private link resource of a IoT Central Application. + /// + /// + /// The name of the resource group that contains the IoT Central + /// application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private link resource 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, string groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get all private link resources of a IoT Central Application. + /// + /// + /// The name of the resource group that contains the IoT Central + /// application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IotCentralClient.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IotCentralClient.cs index d6c21bfb8b388..3240fe178274d 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IotCentralClient.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/IotCentralClient.cs @@ -80,6 +80,16 @@ public partial class IotCentralClient : ServiceClient, IIotCen /// public virtual IAppsOperations Apps { get; private set; } + /// + /// Gets the IPrivateEndpointConnectionsOperations. + /// + public virtual IPrivateEndpointConnectionsOperations PrivateEndpointConnections { get; private set; } + + /// + /// Gets the IPrivateLinksOperations. + /// + public virtual IPrivateLinksOperations PrivateLinks { get; private set; } + /// /// Gets the IOperations. /// @@ -327,9 +337,11 @@ public IotCentralClient(System.Uri baseUri, ServiceClientCredentials credentials private void Initialize() { Apps = new AppsOperations(this); + PrivateEndpointConnections = new PrivateEndpointConnectionsOperations(this); + PrivateLinks = new PrivateLinksOperations(this); Operations = new Operations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2021-06-01"; + ApiVersion = "2021-11-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/App.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/App.cs index 6c46c617b8d02..8977c7c853cee 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/App.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/App.cs @@ -11,6 +11,7 @@ namespace Microsoft.Azure.Management.IotCentral.Models { using Microsoft.Rest; + using Microsoft.Rest.Azure; using Microsoft.Rest.Serialization; using Newtonsoft.Json; using System.Collections; @@ -21,7 +22,7 @@ namespace Microsoft.Azure.Management.IotCentral.Models /// The IoT Central application. /// [Rest.Serialization.JsonTransformation] - public partial class App : Resource + public partial class App : IResource { /// /// Initializes a new instance of the App class. @@ -34,12 +35,10 @@ public App() /// /// Initializes a new instance of the App class. /// - /// The resource location. /// A valid instance SKU. - /// The ARM resource identifier. - /// The ARM resource name. - /// The resource type. - /// The resource tags. + /// The provisioning state of the + /// application. Possible values include: 'Creating', 'Deleting', + /// 'Updating', 'Succeeded', 'Failed', 'Canceled' /// The ID of the application. /// The display name of the /// application. @@ -51,16 +50,26 @@ public App() /// scratch. /// The current state of the application. Possible /// values include: 'created', 'suspended' + /// Whether requests from the public + /// network are allowed. Possible values include: 'Enabled', + /// 'Disabled' + /// Network Rule Set Properties of this + /// IoT Central application. + /// Private endpoint + /// connections created on this IoT Central application. /// The managed identities for the IoT Central /// application. - public App(string location, AppSkuInfo sku, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary), string applicationId = default(string), string displayName = default(string), string subdomain = default(string), string template = default(string), string state = default(string), SystemAssignedServiceIdentity identity = default(SystemAssignedServiceIdentity)) - : base(location, id, name, type, tags) + public App(AppSkuInfo sku, string provisioningState = default(string), string applicationId = default(string), string displayName = default(string), string subdomain = default(string), string template = default(string), string state = default(string), string publicNetworkAccess = default(string), NetworkRuleSets networkRuleSets = default(NetworkRuleSets), IList privateEndpointConnections = default(IList), SystemAssignedServiceIdentity identity = default(SystemAssignedServiceIdentity)) { + ProvisioningState = provisioningState; ApplicationId = applicationId; DisplayName = displayName; Subdomain = subdomain; Template = template; State = state; + PublicNetworkAccess = publicNetworkAccess; + NetworkRuleSets = networkRuleSets; + PrivateEndpointConnections = privateEndpointConnections; Sku = sku; Identity = identity; CustomInit(); @@ -71,6 +80,14 @@ public App() /// partial void CustomInit(); + /// + /// Gets or sets the provisioning state of the application. Possible + /// values include: 'Creating', 'Deleting', 'Updating', 'Succeeded', + /// 'Failed', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + /// /// Gets the ID of the application. /// @@ -105,6 +122,27 @@ public App() [JsonProperty(PropertyName = "properties.state")] public string State { get; set; } + /// + /// Gets or sets whether requests from the public network are allowed. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + /// + /// Gets or sets network Rule Set Properties of this IoT Central + /// application. + /// + [JsonProperty(PropertyName = "properties.networkRuleSets")] + public NetworkRuleSets NetworkRuleSets { get; set; } + + /// + /// Gets private endpoint connections created on this IoT Central + /// application. + /// + [JsonProperty(PropertyName = "properties.privateEndpointConnections")] + public IList PrivateEndpointConnections { get; private set; } + /// /// Gets or sets a valid instance SKU. /// @@ -124,13 +162,22 @@ public App() /// /// Thrown if validation fails /// - public override void Validate() + public virtual void Validate() { - base.Validate(); if (Sku == null) { throw new ValidationException(ValidationRules.CannotBeNull, "Sku"); } + if (PrivateEndpointConnections != null) + { + foreach (var element in PrivateEndpointConnections) + { + if (element != null) + { + element.Validate(); + } + } + } if (Sku != null) { Sku.Validate(); diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppPatch.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppPatch.cs index 846e38c3b4e48..dfc6369761767 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppPatch.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppPatch.cs @@ -36,6 +36,9 @@ public AppPatch() /// /// Instance tags /// A valid instance SKU. + /// The provisioning state of the + /// application. Possible values include: 'Creating', 'Deleting', + /// 'Updating', 'Succeeded', 'Failed', 'Canceled' /// The ID of the application. /// The display name of the /// application. @@ -47,17 +50,28 @@ public AppPatch() /// scratch. /// The current state of the application. Possible /// values include: 'created', 'suspended' + /// Whether requests from the public + /// network are allowed. Possible values include: 'Enabled', + /// 'Disabled' + /// Network Rule Set Properties of this + /// IoT Central application. + /// Private endpoint + /// connections created on this IoT Central application. /// The managed identities for the IoT Central /// application. - public AppPatch(IDictionary tags = default(IDictionary), AppSkuInfo sku = default(AppSkuInfo), string applicationId = default(string), string displayName = default(string), string subdomain = default(string), string template = default(string), string state = default(string), SystemAssignedServiceIdentity identity = default(SystemAssignedServiceIdentity)) + public AppPatch(IDictionary tags = default(IDictionary), AppSkuInfo sku = default(AppSkuInfo), string provisioningState = default(string), string applicationId = default(string), string displayName = default(string), string subdomain = default(string), string template = default(string), string state = default(string), string publicNetworkAccess = default(string), NetworkRuleSets networkRuleSets = default(NetworkRuleSets), IList privateEndpointConnections = default(IList), SystemAssignedServiceIdentity identity = default(SystemAssignedServiceIdentity)) { Tags = tags; Sku = sku; + ProvisioningState = provisioningState; ApplicationId = applicationId; DisplayName = displayName; Subdomain = subdomain; Template = template; State = state; + PublicNetworkAccess = publicNetworkAccess; + NetworkRuleSets = networkRuleSets; + PrivateEndpointConnections = privateEndpointConnections; Identity = identity; CustomInit(); } @@ -79,6 +93,14 @@ public AppPatch() [JsonProperty(PropertyName = "sku")] public AppSkuInfo Sku { get; set; } + /// + /// Gets or sets the provisioning state of the application. Possible + /// values include: 'Creating', 'Deleting', 'Updating', 'Succeeded', + /// 'Failed', 'Canceled' + /// + [JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState { get; set; } + /// /// Gets the ID of the application. /// @@ -113,6 +135,27 @@ public AppPatch() [JsonProperty(PropertyName = "properties.state")] public string State { get; set; } + /// + /// Gets or sets whether requests from the public network are allowed. + /// Possible values include: 'Enabled', 'Disabled' + /// + [JsonProperty(PropertyName = "properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + + /// + /// Gets or sets network Rule Set Properties of this IoT Central + /// application. + /// + [JsonProperty(PropertyName = "properties.networkRuleSets")] + public NetworkRuleSets NetworkRuleSets { get; set; } + + /// + /// Gets private endpoint connections created on this IoT Central + /// application. + /// + [JsonProperty(PropertyName = "properties.privateEndpointConnections")] + public IList PrivateEndpointConnections { get; private set; } + /// /// Gets or sets the managed identities for the IoT Central /// application. @@ -132,6 +175,16 @@ public virtual void Validate() { Sku.Validate(); } + if (PrivateEndpointConnections != null) + { + foreach (var element in PrivateEndpointConnections) + { + if (element != null) + { + element.Validate(); + } + } + } if (Identity != null) { Identity.Validate(); diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppsCreateOrUpdateHeaders.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppsCreateOrUpdateHeaders.cs new file mode 100644 index 0000000000000..d43ad4b5e0dc3 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppsCreateOrUpdateHeaders.cs @@ -0,0 +1,64 @@ +// +// 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.IotCentral.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for CreateOrUpdate operation. + /// + public partial class AppsCreateOrUpdateHeaders + { + /// + /// Initializes a new instance of the AppsCreateOrUpdateHeaders class. + /// + public AppsCreateOrUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AppsCreateOrUpdateHeaders class. + /// + /// URL to query for status of the + /// operation. Returns current state, progress, and error metadata for + /// the operation. + /// How long the user should wait before + /// making a follow-up request. + public AppsCreateOrUpdateHeaders(string azureAsyncOperation = default(string), string retryAfter = default(string)) + { + AzureAsyncOperation = azureAsyncOperation; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL to query for status of the operation. Returns + /// current state, progress, and error metadata for the operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets how long the user should wait before making a + /// follow-up request. + /// + [JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter { get; set; } + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppsDeleteHeaders.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppsDeleteHeaders.cs new file mode 100644 index 0000000000000..0a68dee22886f --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppsDeleteHeaders.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.IotCentral.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class AppsDeleteHeaders + { + /// + /// Initializes a new instance of the AppsDeleteHeaders class. + /// + public AppsDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AppsDeleteHeaders class. + /// + /// URL to query for status of the + /// operation. Returns current state, progress, and error metadata for + /// the operation. + /// URL to query for status of the operation. + /// Returns 202 Accepted while the operation is in progress. + /// How long the user should wait before + /// making a follow-up request. + public AppsDeleteHeaders(string azureAsyncOperation = default(string), string location = default(string), string retryAfter = default(string)) + { + AzureAsyncOperation = azureAsyncOperation; + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL to query for status of the operation. Returns + /// current state, progress, and error metadata for the operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets URL to query for status of the operation. Returns 202 + /// Accepted while the operation is in progress. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets how long the user should wait before making a + /// follow-up request. + /// + [JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter { get; set; } + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppsUpdateHeaders.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppsUpdateHeaders.cs new file mode 100644 index 0000000000000..2a23282749507 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AppsUpdateHeaders.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.IotCentral.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Update operation. + /// + public partial class AppsUpdateHeaders + { + /// + /// Initializes a new instance of the AppsUpdateHeaders class. + /// + public AppsUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AppsUpdateHeaders class. + /// + /// URL to query for status of the + /// operation. Returns current state, progress, and error metadata for + /// the operation. + /// URL to query for status of the operation. + /// Returns 202 Accepted while the operation is in progress. + /// How long the user should wait before + /// making a follow-up request. + public AppsUpdateHeaders(string azureAsyncOperation = default(string), string location = default(string), string retryAfter = default(string)) + { + AzureAsyncOperation = azureAsyncOperation; + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL to query for status of the operation. Returns + /// current state, progress, and error metadata for the operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets URL to query for status of the operation. Returns 202 + /// Accepted while the operation is in progress. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets how long the user should wait before making a + /// follow-up request. + /// + [JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter { get; set; } + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AzureEntityResource.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AzureEntityResource.cs new file mode 100644 index 0000000000000..cb4ce8aafe87a --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/AzureEntityResource.cs @@ -0,0 +1,64 @@ +// +// 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.IotCentral.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Entity Resource + /// + /// + /// The resource model definition for an Azure Resource Manager resource + /// with an etag. + /// + public partial class AzureEntityResource : Resource + { + /// + /// Initializes a new instance of the AzureEntityResource class. + /// + public AzureEntityResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the AzureEntityResource 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. + /// Resource Etag. + 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(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets resource Etag. + /// + [JsonProperty(PropertyName = "etag")] + public string Etag { get; private set; } + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/CreatedByType.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/CreatedByType.cs new file mode 100644 index 0000000000000..bde08f79b86eb --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/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.IotCentral.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/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 0000000000000..ae1bd73829e10 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/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.IotCentral.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/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/CloudErrorBody.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorDetail.cs similarity index 61% rename from sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/CloudErrorBody.cs rename to sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorDetail.cs index 6ca9f55e5c605..b3a692f4cec8b 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/CloudErrorBody.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorDetail.cs @@ -16,32 +16,33 @@ namespace Microsoft.Azure.Management.IotCentral.Models using System.Linq; /// - /// Details of error response. + /// The error detail. /// - public partial class CloudErrorBody + public partial class ErrorDetail { /// - /// Initializes a new instance of the CloudErrorBody class. + /// Initializes a new instance of the ErrorDetail class. /// - public CloudErrorBody() + public ErrorDetail() { CustomInit(); } /// - /// Initializes a new instance of the CloudErrorBody class. + /// Initializes a new instance of the ErrorDetail class. /// /// The error code. /// The error message. - /// The target of the particular error. - /// A list of additional details about the - /// error. - public CloudErrorBody(string code = default(string), string message = default(string), string target = default(string), IList details = default(IList)) + /// 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(); } @@ -63,16 +64,22 @@ public CloudErrorBody() public string Message { get; private set; } /// - /// Gets the target of the particular error. + /// Gets the error target. /// [JsonProperty(PropertyName = "target")] public string Target { get; private set; } /// - /// Gets or sets a list of additional details about the error. + /// Gets the error details. /// [JsonProperty(PropertyName = "details")] - public IList Details { get; set; } + public IList Details { get; private set; } + + /// + /// Gets the error additional info. + /// + [JsonProperty(PropertyName = "additionalInfo")] + public IList AdditionalInfo { get; private set; } } } diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorResponse.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 0000000000000..c2d7093980f40 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,56 @@ +// +// 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.IotCentral.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// 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 + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The error object. + public ErrorResponse(ErrorDetail error = default(ErrorDetail)) + { + Error = error; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the error object. + /// + [JsonProperty(PropertyName = "error")] + public ErrorDetail Error { get; set; } + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorResponseException.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorResponseException.cs new file mode 100644 index 0000000000000..58bf2e7963521 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ErrorResponseException.cs @@ -0,0 +1,62 @@ +// +// 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.IotCentral.Models +{ + using Microsoft.Rest; + + /// + /// Exception thrown for an invalid response with ErrorResponse + /// information. + /// + public partial class ErrorResponseException : RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public ErrorResponse Body { get; set; } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + public ErrorResponseException() + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponseException class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/NetworkAction.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/NetworkAction.cs new file mode 100644 index 0000000000000..ac37ef478d29d --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/NetworkAction.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.IotCentral.Models +{ + + /// + /// Defines values for NetworkAction. + /// + public static class NetworkAction + { + public const string Allow = "Allow"; + public const string Deny = "Deny"; + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/NetworkRuleSetIpRule.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/NetworkRuleSetIpRule.cs new file mode 100644 index 0000000000000..6c0feea5fe809 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/NetworkRuleSetIpRule.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.IotCentral.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An object for an IP range that will be allowed access. + /// + public partial class NetworkRuleSetIpRule + { + /// + /// Initializes a new instance of the NetworkRuleSetIpRule class. + /// + public NetworkRuleSetIpRule() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkRuleSetIpRule class. + /// + /// The readable name of the IP rule. + /// The CIDR block defining the IP range. + public NetworkRuleSetIpRule(string filterName = default(string), string ipMask = default(string)) + { + FilterName = filterName; + IpMask = ipMask; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the readable name of the IP rule. + /// + [JsonProperty(PropertyName = "filterName")] + public string FilterName { get; set; } + + /// + /// Gets or sets the CIDR block defining the IP range. + /// + [JsonProperty(PropertyName = "ipMask")] + public string IpMask { get; set; } + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/NetworkRuleSets.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/NetworkRuleSets.cs new file mode 100644 index 0000000000000..1ff5e1035e58b --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/NetworkRuleSets.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.IotCentral.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Network Rule Set Properties of this IoT Central application. + /// + public partial class NetworkRuleSets + { + /// + /// Initializes a new instance of the NetworkRuleSets class. + /// + public NetworkRuleSets() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the NetworkRuleSets class. + /// + /// Whether these rules apply for device + /// connectivity to IoT Hub and Device Provisioning service associated + /// with this application. + /// Whether these rules apply for + /// connectivity via IoT Central web portal and APIs. + /// The default network action to apply. + /// Possible values include: 'Allow', 'Deny' + /// List of IP rules. + public NetworkRuleSets(bool? applyToDevices = default(bool?), bool? applyToIoTCentral = default(bool?), string defaultAction = default(string), IList ipRules = default(IList)) + { + ApplyToDevices = applyToDevices; + ApplyToIoTCentral = applyToIoTCentral; + DefaultAction = defaultAction; + IpRules = ipRules; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets whether these rules apply for device connectivity to + /// IoT Hub and Device Provisioning service associated with this + /// application. + /// + [JsonProperty(PropertyName = "applyToDevices")] + public bool? ApplyToDevices { get; set; } + + /// + /// Gets or sets whether these rules apply for connectivity via IoT + /// Central web portal and APIs. + /// + [JsonProperty(PropertyName = "applyToIoTCentral")] + public bool? ApplyToIoTCentral { get; set; } + + /// + /// Gets or sets the default network action to apply. Possible values + /// include: 'Allow', 'Deny' + /// + [JsonProperty(PropertyName = "defaultAction")] + public string DefaultAction { get; set; } + + /// + /// Gets or sets list of IP rules. + /// + [JsonProperty(PropertyName = "ipRules")] + public IList IpRules { get; set; } + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/Page1.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/Page1.cs new file mode 100644 index 0000000000000..4d17539922bc6 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/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.IotCentral.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/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpoint.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpoint.cs new file mode 100644 index 0000000000000..45883e6f433bd --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/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.IotCentral.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/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnection.cs new file mode 100644 index 0000000000000..764005c000ae6 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnection.cs @@ -0,0 +1,111 @@ +// +// 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.IotCentral.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + 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 group ids for the private endpoint + /// resource. + /// The private endpoint + /// resource. + /// 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), IList groupIds = default(IList), PrivateEndpoint privateEndpoint = default(PrivateEndpoint), string provisioningState = default(string)) + : base(id, name, type, systemData) + { + GroupIds = groupIds; + PrivateEndpoint = privateEndpoint; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets the group ids for the private endpoint resource. + /// + [JsonProperty(PropertyName = "properties.groupIds")] + public IList GroupIds { get; private set; } + + /// + /// Gets or sets the private endpoint resource. + /// + [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; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrivateLinkServiceConnectionState == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrivateLinkServiceConnectionState"); + } + } + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 0000000000000..e92b058eec464 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/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.IotCentral.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/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnectionsCreateHeaders.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnectionsCreateHeaders.cs new file mode 100644 index 0000000000000..7b1a2017851c2 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnectionsCreateHeaders.cs @@ -0,0 +1,66 @@ +// +// 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.IotCentral.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Create operation. + /// + public partial class PrivateEndpointConnectionsCreateHeaders + { + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsCreateHeaders class. + /// + public PrivateEndpointConnectionsCreateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsCreateHeaders class. + /// + /// URL to query for status of the + /// operation. Returns current state, progress, and error metadata for + /// the operation. + /// How long the user should wait before + /// making a follow-up request. + public PrivateEndpointConnectionsCreateHeaders(string azureAsyncOperation = default(string), string retryAfter = default(string)) + { + AzureAsyncOperation = azureAsyncOperation; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL to query for status of the operation. Returns + /// current state, progress, and error metadata for the operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets how long the user should wait before making a + /// follow-up request. + /// + [JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter { get; set; } + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnectionsDeleteHeaders.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnectionsDeleteHeaders.cs new file mode 100644 index 0000000000000..935144f37e44d --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointConnectionsDeleteHeaders.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.IotCentral.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Defines headers for Delete operation. + /// + public partial class PrivateEndpointConnectionsDeleteHeaders + { + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsDeleteHeaders class. + /// + public PrivateEndpointConnectionsDeleteHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// PrivateEndpointConnectionsDeleteHeaders class. + /// + /// URL to query for status of the + /// operation. Returns current state, progress, and error metadata for + /// the operation. + /// URL to query for status of the operation. + /// Returns 202 Accepted while the operation is in progress. + /// How long the user should wait before + /// making a follow-up request. + public PrivateEndpointConnectionsDeleteHeaders(string azureAsyncOperation = default(string), string location = default(string), string retryAfter = default(string)) + { + AzureAsyncOperation = azureAsyncOperation; + Location = location; + RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets URL to query for status of the operation. Returns + /// current state, progress, and error metadata for the operation. + /// + [JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation { get; set; } + + /// + /// Gets or sets URL to query for status of the operation. Returns 202 + /// Accepted while the operation is in progress. + /// + [JsonProperty(PropertyName = "Location")] + public string Location { get; set; } + + /// + /// Gets or sets how long the user should wait before making a + /// follow-up request. + /// + [JsonProperty(PropertyName = "Retry-After")] + public string RetryAfter { get; set; } + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateEndpointServiceConnectionStatus.cs new file mode 100644 index 0000000000000..296cff572c7a4 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/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.IotCentral.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/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateLinkResource.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateLinkResource.cs new file mode 100644 index 0000000000000..65f3318f5d08d --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateLinkResource.cs @@ -0,0 +1,83 @@ +// +// 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.IotCentral.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Serialization; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A private link resource. + /// + [Rest.Serialization.JsonTransformation] + public partial class PrivateLinkResource : Resource + { + /// + /// Initializes a new instance of the PrivateLinkResource class. + /// + public PrivateLinkResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the PrivateLinkResource 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. + public PrivateLinkResource(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)) + : base(id, name, type, systemData) + { + 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 = "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; } + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateLinkServiceConnectionState.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PrivateLinkServiceConnectionState.cs new file mode 100644 index 0000000000000..86de9804ad928 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/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.IotCentral.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/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ProvisioningState.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 0000000000000..b719fce58bef0 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,26 @@ +// +// 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.IotCentral.Models +{ + + /// + /// Defines values for ProvisioningState. + /// + public static class ProvisioningState + { + public const string Creating = "Creating"; + public const string Deleting = "Deleting"; + public const string Updating = "Updating"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Canceled = "Canceled"; + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ProxyResource.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ProxyResource.cs new file mode 100644 index 0000000000000..4412b6f1643ef --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/ProxyResource.cs @@ -0,0 +1,55 @@ +// +// 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.IotCentral.Models +{ + using System.Linq; + + /// + /// Proxy Resource + /// + /// + /// The resource model definition for a Azure Resource Manager proxy + /// resource. It will not have tags and a location + /// + public partial class ProxyResource : Resource + { + /// + /// Initializes a new instance of the ProxyResource class. + /// + public ProxyResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ProxyResource 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. + public ProxyResource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) + : base(id, name, type, systemData) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PublicNetworkAccess.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 0000000000000..b4878696a56d7 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/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.IotCentral.Models +{ + + /// + /// Defines values for PublicNetworkAccess. + /// + public static class PublicNetworkAccess + { + public const string Enabled = "Enabled"; + public const string Disabled = "Disabled"; + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/Resource.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/Resource.cs index f1330a2219b3f..9eac5b0068251 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/Resource.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/Resource.cs @@ -13,13 +13,15 @@ namespace Microsoft.Azure.Management.IotCentral.Models using Microsoft.Rest; using Microsoft.Rest.Azure; using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; using System.Linq; /// - /// The common properties of an ARM resource. + /// Resource /// + /// + /// Common fields that are returned in the response for all Azure Resource + /// Manager resources + /// public partial class Resource : IResource { /// @@ -33,18 +35,20 @@ public Resource() /// /// Initializes a new instance of the Resource class. /// - /// The resource location. - /// The ARM resource identifier. - /// The ARM resource name. - /// The resource type. - /// The resource tags. - public Resource(string location, string id = default(string), string name = default(string), string type = default(string), IDictionary tags = default(IDictionary)) + /// 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. + public Resource(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData)) { Id = id; Name = name; Type = type; - Location = location; - Tags = tags; + SystemData = systemData; CustomInit(); } @@ -54,54 +58,32 @@ public Resource() partial void CustomInit(); /// - /// Gets the ARM resource identifier. + /// Gets fully qualified resource ID for the resource. Ex - + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} /// [JsonProperty(PropertyName = "id")] public string Id { get; private set; } /// - /// Gets the ARM resource name. + /// Gets the name of the resource /// [JsonProperty(PropertyName = "name")] public string Name { get; private set; } /// - /// Gets the resource type. + /// Gets the type of the resource. E.g. + /// "Microsoft.Compute/virtualMachines" or + /// "Microsoft.Storage/storageAccounts" /// [JsonProperty(PropertyName = "type")] public string Type { get; private set; } /// - /// Gets or sets the resource location. + /// Gets azure Resource Manager metadata containing createdBy and + /// modifiedBy information. /// - [JsonProperty(PropertyName = "location")] - public string Location { get; set; } + [JsonProperty(PropertyName = "systemData")] + public SystemData SystemData { get; private set; } - /// - /// Gets or sets the resource tags. - /// - [JsonProperty(PropertyName = "tags")] - public IDictionary Tags { get; set; } - - /// - /// Validate the object. - /// - /// - /// Thrown if validation fails - /// - public virtual void Validate() - { - if (Location == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "Location"); - } - if (Name != null) - { - if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,99}[a-zA-Z0-9]$")) - { - throw new ValidationException(ValidationRules.Pattern, "Name", "^(?![0-9]+$)(?!-)[a-zA-Z0-9-]{2,99}[a-zA-Z0-9]$"); - } - } - } } } diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/SystemData.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/SystemData.cs new file mode 100644 index 0000000000000..e3896ac6813fa --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/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.IotCentral.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/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/TrackedResource.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/TrackedResource.cs new file mode 100644 index 0000000000000..ba3e77a544ef2 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Models/TrackedResource.cs @@ -0,0 +1,89 @@ +// +// 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.IotCentral.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Tracked Resource + /// + /// + /// The resource model definition for an Azure Resource Manager tracked top + /// level resource which has 'tags' and a 'location' + /// + public partial class TrackedResource : Resource + { + /// + /// Initializes a new instance of the TrackedResource class. + /// + public TrackedResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the TrackedResource class. + /// + /// The geo-location where the resource + /// lives + /// 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. + /// Resource tags. + 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; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets resource tags. + /// + [JsonProperty(PropertyName = "tags")] + public IDictionary Tags { get; set; } + + /// + /// Gets or sets the geo-location where the resource lives + /// + [JsonProperty(PropertyName = "location")] + public string Location { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Location == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Location"); + } + } + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Operations.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Operations.cs index 13de959a94391..32ab4b736fc50 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Operations.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/Operations.cs @@ -59,7 +59,7 @@ internal Operations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -158,14 +158,13 @@ internal Operations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -175,10 +174,6 @@ internal Operations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); @@ -235,7 +230,7 @@ internal Operations(IotCentralClient client) /// /// The cancellation token. /// - /// + /// /// Thrown when the operation returned an invalid status code /// /// @@ -331,14 +326,13 @@ internal Operations(IotCentralClient client) string _responseContent = null; if ((int)_statusCode != 200) { - var ex = new CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); try { _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - CloudError _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); if (_errorBody != null) { - ex = new CloudException(_errorBody.Message); ex.Body = _errorBody; } } @@ -348,10 +342,6 @@ internal Operations(IotCentralClient client) } ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); - if (_httpResponse.Headers.Contains("x-ms-request-id")) - { - ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); - } if (_shouldTrace) { ServiceClientTracing.Error(_invocationId, ex); diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateEndpointConnectionsOperations.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateEndpointConnectionsOperations.cs new file mode 100644 index 0000000000000..2a215d1d4e394 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateEndpointConnectionsOperations.cs @@ -0,0 +1,922 @@ +// +// 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.IotCentral +{ + 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(IotCentralClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the IotCentralClient + /// + public IotCentralClient Client { get; private set; } + + /// + /// Get the metadata of a private endpoint connection for the IoT Central + /// Application. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + 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("resourceName", resourceName); + 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.IoTCentral/iotApps/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _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 a private endpoint connection. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The private endpoint connection metadata. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send Request + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes a private endpoint connection from the IoT Central Application. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async Task> DeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, string privateEndpointConnectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Send request + AzureOperationHeaderResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get all private endpoint connections of a IoT Central Application. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", 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.IoTCentral/iotApps/{resourceName}/privateEndpointConnections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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 a private endpoint connection. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The private endpoint connection metadata. + /// + /// + /// 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> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + if (privateEndpointConnectionName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnectionName"); + } + if (privateEndpointConnection == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "privateEndpointConnection"); + } + if (privateEndpointConnection != null) + { + privateEndpointConnection.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("privateEndpointConnectionName", privateEndpointConnectionName); + tracingParameters.Add("privateEndpointConnection", privateEndpointConnection); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", 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.IoTCentral/iotApps/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _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 != 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); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes a private endpoint connection from the IoT Central Application. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection 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> BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + 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("resourceName", resourceName); + 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.IoTCentral/iotApps/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _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 != 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 AzureOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs new file mode 100644 index 0000000000000..7aa6654da7dd1 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateEndpointConnectionsOperationsExtensions.cs @@ -0,0 +1,311 @@ +// +// 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.IotCentral +{ + 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 + { + /// + /// Get the metadata of a private endpoint connection for the IoT Central + /// Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + public static PrivateEndpointConnection Get(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName) + { + return operations.GetAsync(resourceGroupName, resourceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Get the metadata of a private endpoint connection for the IoT Central + /// Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The private endpoint connection metadata. + /// + public static PrivateEndpointConnection Create(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection) + { + return operations.CreateAsync(resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection).GetAwaiter().GetResult(); + } + + /// + /// Update a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The private endpoint connection metadata. + /// + /// + /// The cancellation token. + /// + public static async Task CreateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a private endpoint connection from the IoT Central Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + public static PrivateEndpointConnectionsDeleteHeaders Delete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName) + { + return operations.DeleteAsync(resourceGroupName, resourceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a private endpoint connection from the IoT Central Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The cancellation token. + /// + public static async Task DeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DeleteWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Get all private endpoint connections of a IoT Central Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + public static IEnumerable List(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Get all private endpoint connections of a IoT Central Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Update a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The private endpoint connection metadata. + /// + public static PrivateEndpointConnection BeginCreate(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection) + { + return operations.BeginCreateAsync(resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection).GetAwaiter().GetResult(); + } + + /// + /// Update a private endpoint connection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The private endpoint connection metadata. + /// + /// + /// The cancellation token. + /// + public static async Task BeginCreateAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, PrivateEndpointConnection privateEndpointConnection, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, privateEndpointConnection, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Deletes a private endpoint connection from the IoT Central Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + public static PrivateEndpointConnectionsDeleteHeaders BeginDelete(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName) + { + return operations.BeginDeleteAsync(resourceGroupName, resourceName, privateEndpointConnectionName).GetAwaiter().GetResult(); + } + + /// + /// Deletes a private endpoint connection from the IoT Central Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private endpoint connection name. + /// + /// + /// The cancellation token. + /// + public static async Task BeginDeleteAsync(this IPrivateEndpointConnectionsOperations operations, string resourceGroupName, string resourceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, resourceName, privateEndpointConnectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateLinksOperations.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateLinksOperations.cs new file mode 100644 index 0000000000000..9cacec4a2fcc0 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateLinksOperations.cs @@ -0,0 +1,445 @@ +// +// 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.IotCentral +{ + 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; + + /// + /// PrivateLinksOperations operations. + /// + internal partial class PrivateLinksOperations : IServiceOperations, IPrivateLinksOperations + { + /// + /// Initializes a new instance of the PrivateLinksOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal PrivateLinksOperations(IotCentralClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the IotCentralClient + /// + public IotCentralClient Client { get; private set; } + + /// + /// Get a private link resource of a IoT Central Application. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private link resource 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> GetWithHttpMessagesAsync(string resourceGroupName, string resourceName, 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 (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + 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("resourceName", resourceName); + 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.IoTCentral/iotApps/{resourceName}/privateLinkResources/{groupId}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + _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; + } + + /// + /// Get all private link resources of a IoT Central Application. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// 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>> ListWithHttpMessagesAsync(string resourceGroupName, string resourceName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + if (Client.SubscriptionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + if (resourceGroupName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "resourceName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("resourceName", resourceName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "List", 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.IoTCentral/iotApps/{resourceName}/privateLinkResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{resourceName}", System.Uri.EscapeDataString(resourceName)); + List _queryParameters = new List(); + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + 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/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateLinksOperationsExtensions.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateLinksOperationsExtensions.cs new file mode 100644 index 0000000000000..d67b91c892578 --- /dev/null +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/PrivateLinksOperationsExtensions.cs @@ -0,0 +1,113 @@ +// +// 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.IotCentral +{ + 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 PrivateLinksOperations. + /// + public static partial class PrivateLinksOperationsExtensions + { + /// + /// Get a private link resource of a IoT Central Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private link resource name. + /// + public static PrivateLinkResource Get(this IPrivateLinksOperations operations, string resourceGroupName, string resourceName, string groupId) + { + return operations.GetAsync(resourceGroupName, resourceName, groupId).GetAwaiter().GetResult(); + } + + /// + /// Get a private link resource of a IoT Central Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The private link resource name. + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IPrivateLinksOperations operations, string resourceGroupName, string resourceName, string groupId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(resourceGroupName, resourceName, groupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get all private link resources of a IoT Central Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + public static IEnumerable List(this IPrivateLinksOperations operations, string resourceGroupName, string resourceName) + { + return operations.ListAsync(resourceGroupName, resourceName).GetAwaiter().GetResult(); + } + + /// + /// Get all private link resources of a IoT Central Application. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group that contains the IoT Central application. + /// + /// + /// The ARM resource name of the IoT Central application. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IPrivateLinksOperations operations, string resourceGroupName, string resourceName, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, resourceName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/SdkInfo_IotCentralClient.cs b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/SdkInfo_IotCentralClient.cs index cdd1241e9faf8..086a0ff755275 100644 --- a/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/SdkInfo_IotCentralClient.cs +++ b/sdk/iotcentral/Microsoft.Azure.Management.IotCentral/src/Generated/SdkInfo_IotCentralClient.cs @@ -19,21 +19,12 @@ public static IEnumerable> ApiInfo_IotCentralClien { return new Tuple[] { - new Tuple("IoTCentral", "Apps", "2021-06-01"), - new Tuple("IoTCentral", "Operations", "2021-06-01"), + new Tuple("IoTCentral", "Apps", "2021-11-01-preview"), + new Tuple("IoTCentral", "Operations", "2021-11-01-preview"), + new Tuple("IoTCentral", "PrivateEndpointConnections", "2021-11-01-preview"), + new Tuple("IoTCentral", "PrivateLinks", "2021-11-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/main/specification/iotcentral/resource-manager/readme.md --csharp --version=v2 --reflect-api-versions --csharp.output-folder=C:\\code\\azure-sdk-for-net\\sdk\\iotcentral\\Microsoft.Azure.Management.IotCentral\\src\\Generated"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "main"; - public static readonly String GithubCommidId = "aac5247b6299f15c9d9f5c1dd802c6d4f528953d"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -