From ae2838b0698075f82fff915b67917af71e3f8dda Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Sun, 7 Mar 2021 17:52:01 +0000 Subject: [PATCH] CodeGen from PR 12581 in Azure/azure-rest-api-specs Merge aa59f189e74885a807761953fa220d73120db6bd into 47b422a4d1ea9f4736739a4a6a19d4a8a2fe54d9 --- .../src/Generated/IManagedServicesClient.cs | 10 + ...tplaceRegistrationDefinitionsOperations.cs | 106 ++++ ...rationDefinitionsWithoutScopeOperations.cs | 100 +++ .../src/Generated/ManagedServicesClient.cs | 14 +- ...tplaceRegistrationDefinitionsOperations.cs | 599 ++++++++++++++++++ ...strationDefinitionsOperationsExtensions.cs | 151 +++++ ...rationDefinitionsWithoutScopeOperations.cs | 581 +++++++++++++++++ ...nitionsWithoutScopeOperationsExtensions.cs | 139 ++++ .../src/Generated/Models/Authorization.cs | 30 +- .../Generated/Models/EligibleAuthorization.cs | 111 ++++ ...rorResponseError.cs => ErrorDefinition.cs} | 30 +- .../src/Generated/Models/ErrorResponse.cs | 12 +- .../Models/JustInTimeAccessPolicy.cs | 76 +++ .../MarketplaceRegistrationDefinition.cs | 105 +++ ...etplaceRegistrationDefinitionProperties.cs | 145 +++++ .../Models/MultiFactorAuthProvider.cs | 22 + ...pertiesRegistrationDefinitionProperties.cs | 15 +- .../RegistrationDefinitionProperties.cs | 25 +- .../SdkInfo_ManagedServicesClient.cs | 8 +- 19 files changed, 2259 insertions(+), 20 deletions(-) create mode 100644 sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/IMarketplaceRegistrationDefinitionsOperations.cs create mode 100644 sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/IMarketplaceRegistrationDefinitionsWithoutScopeOperations.cs create mode 100644 sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsOperations.cs create mode 100644 sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsOperationsExtensions.cs create mode 100644 sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsWithoutScopeOperations.cs create mode 100644 sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsWithoutScopeOperationsExtensions.cs create mode 100644 sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/EligibleAuthorization.cs rename sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/{ErrorResponseError.cs => ErrorDefinition.cs} (69%) create mode 100644 sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/JustInTimeAccessPolicy.cs create mode 100644 sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/MarketplaceRegistrationDefinition.cs create mode 100644 sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/MarketplaceRegistrationDefinitionProperties.cs create mode 100644 sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/MultiFactorAuthProvider.cs diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/IManagedServicesClient.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/IManagedServicesClient.cs index 380ada5ccf25c..ddfe66632686d 100644 --- a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/IManagedServicesClient.cs +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/IManagedServicesClient.cs @@ -74,6 +74,16 @@ public partial interface IManagedServicesClient : System.IDisposable /// IRegistrationAssignmentsOperations RegistrationAssignments { get; } + /// + /// Gets the IMarketplaceRegistrationDefinitionsOperations. + /// + IMarketplaceRegistrationDefinitionsOperations MarketplaceRegistrationDefinitions { get; } + + /// + /// Gets the IMarketplaceRegistrationDefinitionsWithoutScopeOperations. + /// + IMarketplaceRegistrationDefinitionsWithoutScopeOperations MarketplaceRegistrationDefinitionsWithoutScope { get; } + /// /// Gets the IOperations. /// diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/IMarketplaceRegistrationDefinitionsOperations.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/IMarketplaceRegistrationDefinitionsOperations.cs new file mode 100644 index 0000000000000..323580876765a --- /dev/null +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/IMarketplaceRegistrationDefinitionsOperations.cs @@ -0,0 +1,106 @@ +// +// 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.ManagedServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MarketplaceRegistrationDefinitionsOperations operations. + /// + public partial interface IMarketplaceRegistrationDefinitionsOperations + { + /// + /// Gets a list of the marketplace registration definitions for the + /// marketplace identifier. + /// + /// + /// Scope of the resource. + /// + /// + /// The filter query parameter. Might be used to filter marketplace + /// registration definition by plan identifier, publisher, version etc. + /// + /// + /// 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 scope, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the marketplace registration definition for the marketplace + /// identifier. + /// + /// + /// Scope of the resource. + /// + /// + /// Market place identifier. Expected Formats - + /// {publisher}.{product[-preview]}.{planName}.{version} or + /// {publisher}.{product[-preview]}.{planName} or + /// {publisher}.{product[-preview]} or {publisher}). + /// + /// + /// 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 scope, string marketplaceIdentifier, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of the marketplace registration definitions for the + /// marketplace identifier. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/IMarketplaceRegistrationDefinitionsWithoutScopeOperations.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/IMarketplaceRegistrationDefinitionsWithoutScopeOperations.cs new file mode 100644 index 0000000000000..fd21b5d1f5cce --- /dev/null +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/IMarketplaceRegistrationDefinitionsWithoutScopeOperations.cs @@ -0,0 +1,100 @@ +// +// 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.ManagedServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// MarketplaceRegistrationDefinitionsWithoutScopeOperations operations. + /// + public partial interface IMarketplaceRegistrationDefinitionsWithoutScopeOperations + { + /// + /// Gets a list of the marketplace registration definitions for the + /// marketplace identifier. + /// + /// + /// The filter query parameter. Might be used to filter marketplace + /// registration definition by plan identifier, publisher, version etc. + /// + /// + /// 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 filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Get the marketplace registration definition for the marketplace + /// identifier. + /// + /// + /// Market place identifier. Expected Formats - + /// {publisher}.{product[-preview]}.{planName}.{version} or + /// {publisher}.{product[-preview]}.{planName} or + /// {publisher}.{product[-preview]} or {publisher}). + /// + /// + /// 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 marketplaceIdentifier, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Gets a list of the marketplace registration definitions for the + /// marketplace identifier. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/ManagedServicesClient.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/ManagedServicesClient.cs index 445c497cfb758..7a15510b17ed8 100644 --- a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/ManagedServicesClient.cs +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/ManagedServicesClient.cs @@ -79,6 +79,16 @@ public partial class ManagedServicesClient : ServiceClient public virtual IRegistrationAssignmentsOperations RegistrationAssignments { get; private set; } + /// + /// Gets the IMarketplaceRegistrationDefinitionsOperations. + /// + public virtual IMarketplaceRegistrationDefinitionsOperations MarketplaceRegistrationDefinitions { get; private set; } + + /// + /// Gets the IMarketplaceRegistrationDefinitionsWithoutScopeOperations. + /// + public virtual IMarketplaceRegistrationDefinitionsWithoutScopeOperations MarketplaceRegistrationDefinitionsWithoutScope { get; private set; } + /// /// Gets the IOperations. /// @@ -327,9 +337,11 @@ private void Initialize() { RegistrationDefinitions = new RegistrationDefinitionsOperations(this); RegistrationAssignments = new RegistrationAssignmentsOperations(this); + MarketplaceRegistrationDefinitions = new MarketplaceRegistrationDefinitionsOperations(this); + MarketplaceRegistrationDefinitionsWithoutScope = new MarketplaceRegistrationDefinitionsWithoutScopeOperations(this); Operations = new Operations(this); BaseUri = new System.Uri("https://management.azure.com"); - ApiVersion = "2019-06-01"; + ApiVersion = "2020-02-01-preview"; AcceptLanguage = "en-US"; LongRunningOperationRetryTimeout = 30; GenerateClientRequestId = true; diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsOperations.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsOperations.cs new file mode 100644 index 0000000000000..321d8a43b5c70 --- /dev/null +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsOperations.cs @@ -0,0 +1,599 @@ +// +// 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.ManagedServices +{ + 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; + + /// + /// MarketplaceRegistrationDefinitionsOperations operations. + /// + internal partial class MarketplaceRegistrationDefinitionsOperations : IServiceOperations, IMarketplaceRegistrationDefinitionsOperations + { + /// + /// Initializes a new instance of the MarketplaceRegistrationDefinitionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MarketplaceRegistrationDefinitionsOperations(ManagedServicesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ManagedServicesClient + /// + public ManagedServicesClient Client { get; private set; } + + /// + /// Gets a list of the marketplace registration definitions for the marketplace + /// identifier. + /// + /// + /// Scope of the resource. + /// + /// + /// The filter query parameter. Might be used to filter marketplace + /// registration definition by plan identifier, publisher, version etc. + /// + /// + /// 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 scope, string filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("filter", filter); + 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("/") ? "" : "/")), "{scope}/providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions").ToString(); + _url = _url.Replace("{scope}", scope); + List _queryParameters = new List(); + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the marketplace registration definition for the marketplace identifier. + /// + /// + /// Scope of the resource. + /// + /// + /// Market place identifier. Expected Formats - + /// {publisher}.{product[-preview]}.{planName}.{version} or + /// {publisher}.{product[-preview]}.{planName} or + /// {publisher}.{product[-preview]} or {publisher}). + /// + /// + /// 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 scope, string marketplaceIdentifier, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (scope == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "scope"); + } + if (marketplaceIdentifier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "marketplaceIdentifier"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("scope", scope); + tracingParameters.Add("marketplaceIdentifier", marketplaceIdentifier); + 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("/") ? "" : "/")), "{scope}/providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions/{marketplaceIdentifier}").ToString(); + _url = _url.Replace("{scope}", scope); + _url = _url.Replace("{marketplaceIdentifier}", System.Uri.EscapeDataString(marketplaceIdentifier)); + 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; + } + + /// + /// Gets a list of the marketplace registration definitions for the marketplace + /// identifier. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsOperationsExtensions.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsOperationsExtensions.cs new file mode 100644 index 0000000000000..fdbe7c19ddbb7 --- /dev/null +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsOperationsExtensions.cs @@ -0,0 +1,151 @@ +// +// 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.ManagedServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for MarketplaceRegistrationDefinitionsOperations. + /// + public static partial class MarketplaceRegistrationDefinitionsOperationsExtensions + { + /// + /// Gets a list of the marketplace registration definitions for the marketplace + /// identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the resource. + /// + /// + /// The filter query parameter. Might be used to filter marketplace + /// registration definition by plan identifier, publisher, version etc. + /// + public static IPage List(this IMarketplaceRegistrationDefinitionsOperations operations, string scope, string filter = default(string)) + { + return operations.ListAsync(scope, filter).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of the marketplace registration definitions for the marketplace + /// identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the resource. + /// + /// + /// The filter query parameter. Might be used to filter marketplace + /// registration definition by plan identifier, publisher, version etc. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IMarketplaceRegistrationDefinitionsOperations operations, string scope, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(scope, filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the marketplace registration definition for the marketplace identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the resource. + /// + /// + /// Market place identifier. Expected Formats - + /// {publisher}.{product[-preview]}.{planName}.{version} or + /// {publisher}.{product[-preview]}.{planName} or + /// {publisher}.{product[-preview]} or {publisher}). + /// + public static MarketplaceRegistrationDefinition Get(this IMarketplaceRegistrationDefinitionsOperations operations, string scope, string marketplaceIdentifier) + { + return operations.GetAsync(scope, marketplaceIdentifier).GetAwaiter().GetResult(); + } + + /// + /// Get the marketplace registration definition for the marketplace identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Scope of the resource. + /// + /// + /// Market place identifier. Expected Formats - + /// {publisher}.{product[-preview]}.{planName}.{version} or + /// {publisher}.{product[-preview]}.{planName} or + /// {publisher}.{product[-preview]} or {publisher}). + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IMarketplaceRegistrationDefinitionsOperations operations, string scope, string marketplaceIdentifier, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(scope, marketplaceIdentifier, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of the marketplace registration definitions for the marketplace + /// identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IMarketplaceRegistrationDefinitionsOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of the marketplace registration definitions for the marketplace + /// identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IMarketplaceRegistrationDefinitionsOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsWithoutScopeOperations.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsWithoutScopeOperations.cs new file mode 100644 index 0000000000000..b814ffe56eb89 --- /dev/null +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsWithoutScopeOperations.cs @@ -0,0 +1,581 @@ +// +// 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.ManagedServices +{ + 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; + + /// + /// MarketplaceRegistrationDefinitionsWithoutScopeOperations operations. + /// + internal partial class MarketplaceRegistrationDefinitionsWithoutScopeOperations : IServiceOperations, IMarketplaceRegistrationDefinitionsWithoutScopeOperations + { + /// + /// Initializes a new instance of the MarketplaceRegistrationDefinitionsWithoutScopeOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal MarketplaceRegistrationDefinitionsWithoutScopeOperations(ManagedServicesClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the ManagedServicesClient + /// + public ManagedServicesClient Client { get; private set; } + + /// + /// Gets a list of the marketplace registration definitions for the marketplace + /// identifier. + /// + /// + /// The filter query parameter. Might be used to filter marketplace + /// registration definition by plan identifier, publisher, version etc. + /// + /// + /// 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 filter = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("filter", filter); + 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("/") ? "" : "/")), "providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions").ToString(); + List _queryParameters = new List(); + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get the marketplace registration definition for the marketplace identifier. + /// + /// + /// Market place identifier. Expected Formats - + /// {publisher}.{product[-preview]}.{planName}.{version} or + /// {publisher}.{product[-preview]}.{planName} or + /// {publisher}.{product[-preview]} or {publisher}). + /// + /// + /// 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 marketplaceIdentifier, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (marketplaceIdentifier == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "marketplaceIdentifier"); + } + if (Client.ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("marketplaceIdentifier", marketplaceIdentifier); + 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("/") ? "" : "/")), "providers/Microsoft.ManagedServices/marketplaceRegistrationDefinitions/{marketplaceIdentifier}").ToString(); + _url = _url.Replace("{marketplaceIdentifier}", System.Uri.EscapeDataString(marketplaceIdentifier)); + 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; + } + + /// + /// Gets a list of the marketplace registration definitions for the marketplace + /// identifier. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task>> ListNextWithHttpMessagesAsync(string nextPageLink, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (nextPageLink == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + List _queryParameters = new List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse>(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + } +} diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsWithoutScopeOperationsExtensions.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsWithoutScopeOperationsExtensions.cs new file mode 100644 index 0000000000000..f7e1cdd627d71 --- /dev/null +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/MarketplaceRegistrationDefinitionsWithoutScopeOperationsExtensions.cs @@ -0,0 +1,139 @@ +// +// 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.ManagedServices +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for MarketplaceRegistrationDefinitionsWithoutScopeOperations. + /// + public static partial class MarketplaceRegistrationDefinitionsWithoutScopeOperationsExtensions + { + /// + /// Gets a list of the marketplace registration definitions for the marketplace + /// identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter query parameter. Might be used to filter marketplace + /// registration definition by plan identifier, publisher, version etc. + /// + public static IPage List(this IMarketplaceRegistrationDefinitionsWithoutScopeOperations operations, string filter = default(string)) + { + return operations.ListAsync(filter).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of the marketplace registration definitions for the marketplace + /// identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The filter query parameter. Might be used to filter marketplace + /// registration definition by plan identifier, publisher, version etc. + /// + /// + /// The cancellation token. + /// + public static async Task> ListAsync(this IMarketplaceRegistrationDefinitionsWithoutScopeOperations operations, string filter = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(filter, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get the marketplace registration definition for the marketplace identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Market place identifier. Expected Formats - + /// {publisher}.{product[-preview]}.{planName}.{version} or + /// {publisher}.{product[-preview]}.{planName} or + /// {publisher}.{product[-preview]} or {publisher}). + /// + public static MarketplaceRegistrationDefinition Get(this IMarketplaceRegistrationDefinitionsWithoutScopeOperations operations, string marketplaceIdentifier) + { + return operations.GetAsync(marketplaceIdentifier).GetAwaiter().GetResult(); + } + + /// + /// Get the marketplace registration definition for the marketplace identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Market place identifier. Expected Formats - + /// {publisher}.{product[-preview]}.{planName}.{version} or + /// {publisher}.{product[-preview]}.{planName} or + /// {publisher}.{product[-preview]} or {publisher}). + /// + /// + /// The cancellation token. + /// + public static async Task GetAsync(this IMarketplaceRegistrationDefinitionsWithoutScopeOperations operations, string marketplaceIdentifier, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetWithHttpMessagesAsync(marketplaceIdentifier, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Gets a list of the marketplace registration definitions for the marketplace + /// identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static IPage ListNext(this IMarketplaceRegistrationDefinitionsWithoutScopeOperations operations, string nextPageLink) + { + return operations.ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Gets a list of the marketplace registration definitions for the marketplace + /// identifier. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async Task> ListNextAsync(this IMarketplaceRegistrationDefinitionsWithoutScopeOperations operations, string nextPageLink, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/Authorization.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/Authorization.cs index 6a4a0996b8ae3..3899ad508851c 100644 --- a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/Authorization.cs +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/Authorization.cs @@ -12,6 +12,8 @@ namespace Microsoft.Azure.Management.ManagedServices.Models { using Microsoft.Rest; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -38,10 +40,20 @@ public Authorization() /// role will define all the permissions that the security /// group/service principal/user must have on the projected /// subscription. This role cannot be an owner role. - public Authorization(string principalId, string roleDefinitionId) + /// Display name of the principal + /// Id. + /// The + /// delegatedRoleDefinitionIds field is required when the + /// roleDefinitionId refers to the User Access Administrator Role. It + /// is the list of role definition ids which define all the permissions + /// that the user in the authorization can assign to other security + /// groups/service principals/users. + public Authorization(string principalId, string roleDefinitionId, string principalIdDisplayName = default(string), IList delegatedRoleDefinitionIds = default(IList)) { PrincipalId = principalId; + PrincipalIdDisplayName = principalIdDisplayName; RoleDefinitionId = roleDefinitionId; + DelegatedRoleDefinitionIds = delegatedRoleDefinitionIds; CustomInit(); } @@ -58,6 +70,12 @@ public Authorization(string principalId, string roleDefinitionId) [JsonProperty(PropertyName = "principalId")] public string PrincipalId { get; set; } + /// + /// Gets or sets display name of the principal Id. + /// + [JsonProperty(PropertyName = "principalIdDisplayName")] + public string PrincipalIdDisplayName { get; set; } + /// /// Gets or sets the role definition identifier. This role will define /// all the permissions that the security group/service principal/user @@ -67,6 +85,16 @@ public Authorization(string principalId, string roleDefinitionId) [JsonProperty(PropertyName = "roleDefinitionId")] public string RoleDefinitionId { get; set; } + /// + /// Gets or sets the delegatedRoleDefinitionIds field is required when + /// the roleDefinitionId refers to the User Access Administrator Role. + /// It is the list of role definition ids which define all the + /// permissions that the user in the authorization can assign to other + /// security groups/service principals/users. + /// + [JsonProperty(PropertyName = "delegatedRoleDefinitionIds")] + public IList DelegatedRoleDefinitionIds { get; set; } + /// /// Validate the object. /// diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/EligibleAuthorization.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/EligibleAuthorization.cs new file mode 100644 index 0000000000000..d974e564ad89d --- /dev/null +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/EligibleAuthorization.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.ManagedServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Eligible authorization tuple containing principle Id (of user/service + /// principal/security group), role definition id, and the just-in-time + /// access setting. + /// + public partial class EligibleAuthorization + { + /// + /// Initializes a new instance of the EligibleAuthorization class. + /// + public EligibleAuthorization() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the EligibleAuthorization class. + /// + /// Principal Id of the security + /// group/service principal/user that would be delegated permissions to + /// the projected subscription + /// The role definition identifier. This + /// role will delegate all the permissions that the security + /// group/service principal/user must have on the projected + /// subscription. This role cannot be an owner role. + /// Display name of the principal + /// Id. + /// Just-in-time access policy + /// setting. + public EligibleAuthorization(string principalId, string roleDefinitionId, string principalIdDisplayName = default(string), JustInTimeAccessPolicy justInTimeAccessPolicy = default(JustInTimeAccessPolicy)) + { + PrincipalId = principalId; + PrincipalIdDisplayName = principalIdDisplayName; + RoleDefinitionId = roleDefinitionId; + JustInTimeAccessPolicy = justInTimeAccessPolicy; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets principal Id of the security group/service + /// principal/user that would be delegated permissions to the projected + /// subscription + /// + [JsonProperty(PropertyName = "principalId")] + public string PrincipalId { get; set; } + + /// + /// Gets or sets display name of the principal Id. + /// + [JsonProperty(PropertyName = "principalIdDisplayName")] + public string PrincipalIdDisplayName { get; set; } + + /// + /// Gets or sets the role definition identifier. This role will + /// delegate all the permissions that the security group/service + /// principal/user must have on the projected subscription. This role + /// cannot be an owner role. + /// + [JsonProperty(PropertyName = "roleDefinitionId")] + public string RoleDefinitionId { get; set; } + + /// + /// Gets or sets just-in-time access policy setting. + /// + [JsonProperty(PropertyName = "justInTimeAccessPolicy")] + public JustInTimeAccessPolicy JustInTimeAccessPolicy { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (PrincipalId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "PrincipalId"); + } + if (RoleDefinitionId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "RoleDefinitionId"); + } + if (JustInTimeAccessPolicy != null) + { + JustInTimeAccessPolicy.Validate(); + } + } + } +} diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/ErrorResponseError.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/ErrorDefinition.cs similarity index 69% rename from sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/ErrorResponseError.cs rename to sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/ErrorDefinition.cs index 20d4f22452a57..d98bc97b0dc6f 100644 --- a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/ErrorResponseError.cs +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/ErrorDefinition.cs @@ -12,32 +12,36 @@ namespace Microsoft.Azure.Management.ManagedServices.Models { using Microsoft.Rest; using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// /// Error response indicates Azure Resource Manager is not able to process /// the incoming request. The reason is provided in the error message. /// - public partial class ErrorResponseError + public partial class ErrorDefinition { /// - /// Initializes a new instance of the ErrorResponseError class. + /// Initializes a new instance of the ErrorDefinition class. /// - public ErrorResponseError() + public ErrorDefinition() { CustomInit(); } /// - /// Initializes a new instance of the ErrorResponseError class. + /// Initializes a new instance of the ErrorDefinition class. /// /// Error code. /// Error message indicating why the operation /// failed. - public ErrorResponseError(string code, string message) + /// Internal error details. + public ErrorDefinition(string code, string message, IList details = default(IList)) { Code = code; Message = message; + Details = details; CustomInit(); } @@ -58,6 +62,12 @@ public ErrorResponseError(string code, string message) [JsonProperty(PropertyName = "message")] public string Message { get; set; } + /// + /// Gets or sets internal error details. + /// + [JsonProperty(PropertyName = "details")] + public IList Details { get; set; } + /// /// Validate the object. /// @@ -74,6 +84,16 @@ public virtual void Validate() { throw new ValidationException(ValidationRules.CannotBeNull, "Message"); } + if (Details != null) + { + foreach (var element in Details) + { + if (element != null) + { + element.Validate(); + } + } + } } } } diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/ErrorResponse.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/ErrorResponse.cs index 4941a69f09d1a..5b2ed0613df8d 100644 --- a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/ErrorResponse.cs +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/ErrorResponse.cs @@ -29,10 +29,8 @@ public ErrorResponse() /// /// Initializes a new instance of the ErrorResponse class. /// - /// Error response indicates Azure Resource Manager - /// is not able to process the incoming request. The reason is provided - /// in the error message. - public ErrorResponse(ErrorResponseError error = default(ErrorResponseError)) + /// The error details. + public ErrorResponse(ErrorDefinition error = default(ErrorDefinition)) { Error = error; CustomInit(); @@ -44,12 +42,10 @@ public ErrorResponse() partial void CustomInit(); /// - /// Gets error response indicates Azure Resource Manager is not able to - /// process the incoming request. The reason is provided in the error - /// message. + /// Gets or sets the error details. /// [JsonProperty(PropertyName = "error")] - public ErrorResponseError Error { get; private set; } + public ErrorDefinition Error { get; set; } /// /// Validate the object. diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/JustInTimeAccessPolicy.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/JustInTimeAccessPolicy.cs new file mode 100644 index 0000000000000..9beb45898d636 --- /dev/null +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/JustInTimeAccessPolicy.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.ManagedServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Just-in-time access policy setting. + /// + public partial class JustInTimeAccessPolicy + { + /// + /// Initializes a new instance of the JustInTimeAccessPolicy class. + /// + public JustInTimeAccessPolicy() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the JustInTimeAccessPolicy class. + /// + /// MFA provider. Possible values + /// include: 'Azure', 'None' + /// Maximum access duration in + /// ISO 8601 format. The default value is "PT8H". + public JustInTimeAccessPolicy(string multiFactorAuthProvider, System.TimeSpan? maximumActivationDuration = default(System.TimeSpan?)) + { + MultiFactorAuthProvider = multiFactorAuthProvider; + MaximumActivationDuration = maximumActivationDuration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets MFA provider. Possible values include: 'Azure', 'None' + /// + [JsonProperty(PropertyName = "multiFactorAuthProvider")] + public string MultiFactorAuthProvider { get; set; } + + /// + /// Gets or sets maximum access duration in ISO 8601 format. The + /// default value is "PT8H". + /// + [JsonProperty(PropertyName = "maximumActivationDuration")] + public System.TimeSpan? MaximumActivationDuration { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (MultiFactorAuthProvider == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "MultiFactorAuthProvider"); + } + } + } +} diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/MarketplaceRegistrationDefinition.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/MarketplaceRegistrationDefinition.cs new file mode 100644 index 0000000000000..7577c968b399f --- /dev/null +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/MarketplaceRegistrationDefinition.cs @@ -0,0 +1,105 @@ +// +// 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.ManagedServices.Models +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Newtonsoft.Json; + using System.Linq; + + public partial class MarketplaceRegistrationDefinition : IResource + { + /// + /// Initializes a new instance of the MarketplaceRegistrationDefinition + /// class. + /// + public MarketplaceRegistrationDefinition() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MarketplaceRegistrationDefinition + /// class. + /// + /// Properties of a marketplace registration + /// definition. + /// Plan details for the managed services. + /// Fully qualified path of the marketplace + /// registration definition. + /// Type of the resource. + /// Name of the marketplace registration + /// definition. + public MarketplaceRegistrationDefinition(MarketplaceRegistrationDefinitionProperties properties = default(MarketplaceRegistrationDefinitionProperties), Plan plan = default(Plan), string id = default(string), string type = default(string), string name = default(string)) + { + Properties = properties; + Plan = plan; + Id = id; + Type = type; + Name = name; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets properties of a marketplace registration definition. + /// + [JsonProperty(PropertyName = "properties")] + public MarketplaceRegistrationDefinitionProperties Properties { get; set; } + + /// + /// Gets or sets plan details for the managed services. + /// + [JsonProperty(PropertyName = "plan")] + public Plan Plan { get; set; } + + /// + /// Gets fully qualified path of the marketplace registration + /// definition. + /// + [JsonProperty(PropertyName = "id")] + public string Id { get; private set; } + + /// + /// Gets type of the resource. + /// + [JsonProperty(PropertyName = "type")] + public string Type { get; private set; } + + /// + /// Gets name of the marketplace registration definition. + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; private set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (Properties != null) + { + Properties.Validate(); + } + if (Plan != null) + { + Plan.Validate(); + } + } + } +} diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/MarketplaceRegistrationDefinitionProperties.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/MarketplaceRegistrationDefinitionProperties.cs new file mode 100644 index 0000000000000..f43056f990ff5 --- /dev/null +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/MarketplaceRegistrationDefinitionProperties.cs @@ -0,0 +1,145 @@ +// +// 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.ManagedServices.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Properties of a marketplace registration definition. + /// + public partial class MarketplaceRegistrationDefinitionProperties + { + /// + /// Initializes a new instance of the + /// MarketplaceRegistrationDefinitionProperties class. + /// + public MarketplaceRegistrationDefinitionProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// MarketplaceRegistrationDefinitionProperties class. + /// + /// Id of the managedBy tenant. + /// Authorization tuple containing + /// principal id of the user/security group or service principal and id + /// of the build-in role. + /// Eligible PIM authorization + /// tuple containing principal id of the user/security group or service + /// principal, id of the built-in role, and just-in-time access policy + /// setting + /// The marketplace offer display + /// name. + /// The marketplace publisher + /// display name. + /// The marketplace plan display + /// name. + public MarketplaceRegistrationDefinitionProperties(string managedByTenantId, IList authorizations, IList eligibleAuthorizations = default(IList), string offerDisplayName = default(string), string publisherDisplayName = default(string), string planDisplayName = default(string)) + { + ManagedByTenantId = managedByTenantId; + Authorizations = authorizations; + EligibleAuthorizations = eligibleAuthorizations; + OfferDisplayName = offerDisplayName; + PublisherDisplayName = publisherDisplayName; + PlanDisplayName = planDisplayName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets id of the managedBy tenant. + /// + [JsonProperty(PropertyName = "managedByTenantId")] + public string ManagedByTenantId { get; set; } + + /// + /// Gets or sets authorization tuple containing principal id of the + /// user/security group or service principal and id of the build-in + /// role. + /// + [JsonProperty(PropertyName = "authorizations")] + public IList Authorizations { get; set; } + + /// + /// Gets or sets eligible PIM authorization tuple containing principal + /// id of the user/security group or service principal, id of the + /// built-in role, and just-in-time access policy setting + /// + [JsonProperty(PropertyName = "eligibleAuthorizations")] + public IList EligibleAuthorizations { get; set; } + + /// + /// Gets or sets the marketplace offer display name. + /// + [JsonProperty(PropertyName = "offerDisplayName")] + public string OfferDisplayName { get; set; } + + /// + /// Gets or sets the marketplace publisher display name. + /// + [JsonProperty(PropertyName = "publisherDisplayName")] + public string PublisherDisplayName { get; set; } + + /// + /// Gets or sets the marketplace plan display name. + /// + [JsonProperty(PropertyName = "planDisplayName")] + public string PlanDisplayName { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ManagedByTenantId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ManagedByTenantId"); + } + if (Authorizations == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Authorizations"); + } + if (Authorizations != null) + { + foreach (var element in Authorizations) + { + if (element != null) + { + element.Validate(); + } + } + } + if (EligibleAuthorizations != null) + { + foreach (var element1 in EligibleAuthorizations) + { + if (element1 != null) + { + element1.Validate(); + } + } + } + } + } +} diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/MultiFactorAuthProvider.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/MultiFactorAuthProvider.cs new file mode 100644 index 0000000000000..91fa6af73fcc9 --- /dev/null +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/MultiFactorAuthProvider.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.ManagedServices.Models +{ + + /// + /// Defines values for MultiFactorAuthProvider. + /// + public static class MultiFactorAuthProvider + { + public const string Azure = "Azure"; + public const string None = "None"; + } +} diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/RegistrationAssignmentPropertiesRegistrationDefinitionProperties.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/RegistrationAssignmentPropertiesRegistrationDefinitionProperties.cs index 29aff9ba4c0c1..a512faa9f9e20 100644 --- a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/RegistrationAssignmentPropertiesRegistrationDefinitionProperties.cs +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/RegistrationAssignmentPropertiesRegistrationDefinitionProperties.cs @@ -40,6 +40,10 @@ public RegistrationAssignmentPropertiesRegistrationDefinitionProperties() /// Authorization tuple containing /// principal id of the user/security group or service principal and id /// of the build-in role. + /// Eligible PIM authorization + /// tuple containing principal id of the user/security group or service + /// principal, id of the built-in role, and just-in-time access policy + /// setting /// Name of the registration /// definition. /// Current state of the registration @@ -51,10 +55,11 @@ public RegistrationAssignmentPropertiesRegistrationDefinitionProperties() /// Id of the managedBy tenant. /// Name of the managedBy /// tenant. - public RegistrationAssignmentPropertiesRegistrationDefinitionProperties(string description = default(string), IList authorizations = default(IList), string registrationDefinitionName = default(string), string provisioningState = default(string), string manageeTenantId = default(string), string manageeTenantName = default(string), string managedByTenantId = default(string), string managedByTenantName = default(string)) + public RegistrationAssignmentPropertiesRegistrationDefinitionProperties(string description = default(string), IList authorizations = default(IList), IList eligibleAuthorizations = default(IList), string registrationDefinitionName = default(string), string provisioningState = default(string), string manageeTenantId = default(string), string manageeTenantName = default(string), string managedByTenantId = default(string), string managedByTenantName = default(string)) { Description = description; Authorizations = authorizations; + EligibleAuthorizations = eligibleAuthorizations; RegistrationDefinitionName = registrationDefinitionName; ProvisioningState = provisioningState; ManageeTenantId = manageeTenantId; @@ -83,6 +88,14 @@ public RegistrationAssignmentPropertiesRegistrationDefinitionProperties() [JsonProperty(PropertyName = "authorizations")] public IList Authorizations { get; set; } + /// + /// Gets or sets eligible PIM authorization tuple containing principal + /// id of the user/security group or service principal, id of the + /// built-in role, and just-in-time access policy setting + /// + [JsonProperty(PropertyName = "eligibleAuthorizations")] + public IList EligibleAuthorizations { get; set; } + /// /// Gets or sets name of the registration definition. /// diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/RegistrationDefinitionProperties.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/RegistrationDefinitionProperties.cs index 6f1ded14d68fa..2e8facf2a18c3 100644 --- a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/RegistrationDefinitionProperties.cs +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/Models/RegistrationDefinitionProperties.cs @@ -40,6 +40,10 @@ public RegistrationDefinitionProperties() /// Id of the managedBy tenant. /// Description of the registration /// definition. + /// Eligible PIM authorization + /// tuple containing principal id of the user/security group or service + /// principal, id of the built-in role, and just-in-time access policy + /// setting /// Name of the registration /// definition. /// Current state of the registration @@ -48,10 +52,11 @@ public RegistrationDefinitionProperties() /// 'Canceled', 'Failed', 'Succeeded', 'Updating' /// Name of the managedBy /// tenant. - public RegistrationDefinitionProperties(IList authorizations, string managedByTenantId, string description = default(string), string registrationDefinitionName = default(string), string provisioningState = default(string), string managedByTenantName = default(string)) + public RegistrationDefinitionProperties(IList authorizations, string managedByTenantId, string description = default(string), IList eligibleAuthorizations = default(IList), string registrationDefinitionName = default(string), string provisioningState = default(string), string managedByTenantName = default(string)) { Description = description; Authorizations = authorizations; + EligibleAuthorizations = eligibleAuthorizations; RegistrationDefinitionName = registrationDefinitionName; ManagedByTenantId = managedByTenantId; ProvisioningState = provisioningState; @@ -78,6 +83,14 @@ public RegistrationDefinitionProperties() [JsonProperty(PropertyName = "authorizations")] public IList Authorizations { get; set; } + /// + /// Gets or sets eligible PIM authorization tuple containing principal + /// id of the user/security group or service principal, id of the + /// built-in role, and just-in-time access policy setting + /// + [JsonProperty(PropertyName = "eligibleAuthorizations")] + public IList EligibleAuthorizations { get; set; } + /// /// Gets or sets name of the registration definition. /// @@ -131,6 +144,16 @@ public virtual void Validate() } } } + if (EligibleAuthorizations != null) + { + foreach (var element1 in EligibleAuthorizations) + { + if (element1 != null) + { + element1.Validate(); + } + } + } } } } diff --git a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/SdkInfo_ManagedServicesClient.cs b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/SdkInfo_ManagedServicesClient.cs index c28da342868c4..58a06f6286f65 100644 --- a/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/SdkInfo_ManagedServicesClient.cs +++ b/sdk/managedservices/Microsoft.Azure.Management.ManagedServices/src/Generated/SdkInfo_ManagedServicesClient.cs @@ -19,9 +19,11 @@ public static IEnumerable> ApiInfo_ManagedServices { return new Tuple[] { - new Tuple("ManagedServices", "Operations", "2019-06-01"), - new Tuple("ManagedServices", "RegistrationAssignments", "2019-06-01"), - new Tuple("ManagedServices", "RegistrationDefinitions", "2019-06-01"), + new Tuple("ManagedServices", "MarketplaceRegistrationDefinitions", "2020-02-01-preview"), + new Tuple("ManagedServices", "MarketplaceRegistrationDefinitionsWithoutScope", "2020-02-01-preview"), + new Tuple("ManagedServices", "Operations", "2020-02-01-preview"), + new Tuple("ManagedServices", "RegistrationAssignments", "2020-02-01-preview"), + new Tuple("ManagedServices", "RegistrationDefinitions", "2020-02-01-preview"), }.AsEnumerable(); } }