diff --git a/src/PowerBIEmbedded/PowerBI.Test/PowerBI.Test.csproj b/src/PowerBIEmbedded/PowerBI.Test/PowerBI.Test.csproj index 81ec54719790..6b64dbc746b2 100644 --- a/src/PowerBIEmbedded/PowerBI.Test/PowerBI.Test.csproj +++ b/src/PowerBIEmbedded/PowerBI.Test/PowerBI.Test.csproj @@ -11,7 +11,7 @@ - + \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBI/Models/PowerBIClient.cs b/src/PowerBIEmbedded/PowerBI/Models/PowerBIClient.cs index a2e712248913..e36d7aa999f3 100644 --- a/src/PowerBIEmbedded/PowerBI/Models/PowerBIClient.cs +++ b/src/PowerBIEmbedded/PowerBI/Models/PowerBIClient.cs @@ -203,7 +203,7 @@ private string GetResourceGroupByCapacity(string capacityName) private ResourceSku GetResourceSkuFromName(string skuName) { - var tier = skuName.StartsWith("A") ? SkuTier.PBIEAzure : null; + var tier = skuName.StartsWith("A") ? SkuTier.PbieAzure : null; return new ResourceSku(skuName, tier); } diff --git a/src/PowerBIEmbedded/PowerBI/PowerBI.csproj b/src/PowerBIEmbedded/PowerBI/PowerBI.csproj index d3b52e1f33c0..4dc8697c24fe 100644 --- a/src/PowerBIEmbedded/PowerBI/PowerBI.csproj +++ b/src/PowerBIEmbedded/PowerBI/PowerBI.csproj @@ -12,11 +12,11 @@ - + diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Customizations/AzureCapacityClient.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Customizations/AzureCapacityClient.cs new file mode 100644 index 000000000000..3c0404096cb8 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Customizations/AzureCapacityClient.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. + +using System; + +namespace Microsoft.Azure.Management.PowerBIDedicated +{ + /// + public partial class PowerBIDedicatedManagementClient + { + partial void CustomInitialize() + { + // Override the capacities operations which includes override of UpdateWithHttpMessagesAsync to support non long running operation in case of OK response + this.Capacities = new CustomCapacitiesOperations(this.Capacities, this); + } + } +} diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Customizations/CustomCapacitiesOperations.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Customizations/CustomCapacitiesOperations.cs new file mode 100644 index 000000000000..972bca10bce0 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Customizations/CustomCapacitiesOperations.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. + +using Microsoft.Azure.Management.PowerBIDedicated.Models; +using Microsoft.Rest.Azure; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; + +namespace Microsoft.Azure.Management.PowerBIDedicated +{ + /// + /// Customize UpdateWithHttpMessagesAsync to skip LRO when response is OK. -- migration engineer + /// + public class CustomCapacitiesOperations : ICapacitiesOperations + { + private readonly ICapacitiesOperations innerCapacityOperations; + private readonly PowerBIDedicatedManagementClient client; + + internal CustomCapacitiesOperations(ICapacitiesOperations inner, PowerBIDedicatedManagementClient client) + { + this.innerCapacityOperations = inner; + this.client = client; + } + + public PowerBIDedicatedManagementClient Client => client; + + /// + public async Task> GetDetailsWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .GetDetailsWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, customHeaders, cancellationToken) + .ConfigureAwait(false); + } + + /// + public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, DedicatedCapacity capacityParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .CreateWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, capacityParameters, customHeaders, cancellationToken) + .ConfigureAwait(false); + } + + /// + public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .DeleteWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, customHeaders, cancellationToken) + .ConfigureAwait(false); + } + + /// + /// Customize response return 200 skip LRO operation. -- migration engineer + public async Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, DedicatedCapacityUpdateParameters capacityUpdateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, capacityUpdateParameters, customHeaders, cancellationToken).ConfigureAwait(false); + if (_response.Response.StatusCode != System.Net.HttpStatusCode.OK) + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + return _response; + } + + /// + public async Task SuspendWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .SuspendWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, customHeaders, cancellationToken) + .ConfigureAwait(false); + } + + /// + public async Task ResumeWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .ResumeWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, customHeaders, cancellationToken) + .ConfigureAwait(false); + } + + /// + public async Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, customHeaders, cancellationToken) + .ConfigureAwait(false); + } + + /// + public async Task>> ListWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .ListWithHttpMessagesAsync(customHeaders, cancellationToken) + .ConfigureAwait(false); + } + + /// + public async Task> ListSkusWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .ListSkusWithHttpMessagesAsync(customHeaders, cancellationToken) + .ConfigureAwait(false); + } + + /// + public async Task> ListSkusForCapacityWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .ListSkusForCapacityWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, customHeaders, cancellationToken) + .ConfigureAwait(false); + } + + /// + public async Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, DedicatedCapacity capacityParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .BeginCreateWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, capacityParameters, customHeaders, cancellationToken) + .ConfigureAwait(false); + } + + /// + public async Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .BeginDeleteWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, customHeaders, cancellationToken) + .ConfigureAwait(false); + } + + /// + public async Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, DedicatedCapacityUpdateParameters capacityUpdateParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .BeginUpdateWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, capacityUpdateParameters, customHeaders, cancellationToken) + .ConfigureAwait(false); + } + + /// + public async Task BeginSuspendWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .BeginSuspendWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, customHeaders, cancellationToken) + .ConfigureAwait(false); + } + + /// + public async Task BeginResumeWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + return await innerCapacityOperations + .BeginResumeWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, customHeaders, cancellationToken) + .ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/CapacitiesOperations.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/CapacitiesOperations.cs new file mode 100644 index 000000000000..886295f00b7b --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/CapacitiesOperations.cs @@ -0,0 +1,2493 @@ +// 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.PowerBIDedicated +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// CapacitiesOperations operations. + /// + internal partial class CapacitiesOperations : Microsoft.Rest.IServiceOperations, ICapacitiesOperations + { + /// + /// Initializes a new instance of the CapacitiesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal CapacitiesOperations (PowerBIDedicatedManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the PowerBIDedicatedManagementClient + /// + public PowerBIDedicatedManagementClient Client { get; private set; } + + /// + /// Gets details about the specified dedicated capacity. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the dedicated capacity. It must be a minimum of 3 characters, + /// and a maximum of 63. + /// + /// + /// 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 System.Threading.Tasks.Task> GetDetailsWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (dedicatedCapacityName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dedicatedCapacityName"); + } + if (dedicatedCapacityName != null) + { + if (dedicatedCapacityName.Length > 63) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "dedicatedCapacityName", 63); + } + if (dedicatedCapacityName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "dedicatedCapacityName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(dedicatedCapacityName, "^[a-z][a-z0-9]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "dedicatedCapacityName", "^[a-z][a-z0-9]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dedicatedCapacityName", dedicatedCapacityName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetDetails", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dedicatedCapacityName}", System.Uri.EscapeDataString(dedicatedCapacityName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Provisions the specified Dedicated capacity based on the configuration + /// specified in the request. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be a minimum of 3 characters, + /// and a maximum of 63. + /// + /// + /// Contains the information used to provision the Dedicated capacity. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, DedicatedCapacity capacityParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, capacityParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Deletes the specified Dedicated capacity. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Updates the current state of the specified Dedicated capacity. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// Request object that contains the updated information for the capacity. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, DedicatedCapacityUpdateParameters capacityUpdateParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, capacityUpdateParameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Suspends operation of the specified dedicated capacity instance. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task SuspendWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginSuspendWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Resumes operation of the specified Dedicated capacity instance. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task ResumeWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginResumeWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets all the Dedicated capacities for the given resource group. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists all the Dedicated capacities for the given subscription. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/capacities").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists eligible SKUs for PowerBI Dedicated resource provider. + /// + /// + /// 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 System.Threading.Tasks.Task> ListSkusWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListSkus", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.PowerBIDedicated/skus").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists eligible SKUs for a PowerBI Dedicated resource. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// 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 System.Threading.Tasks.Task> ListSkusForCapacityWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (dedicatedCapacityName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dedicatedCapacityName"); + } + if (dedicatedCapacityName != null) + { + if (dedicatedCapacityName.Length > 63) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "dedicatedCapacityName", 63); + } + if (dedicatedCapacityName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "dedicatedCapacityName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(dedicatedCapacityName, "^[a-z][a-z0-9]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "dedicatedCapacityName", "^[a-z][a-z0-9]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dedicatedCapacityName", dedicatedCapacityName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListSkusForCapacity", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}/skus").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dedicatedCapacityName}", System.Uri.EscapeDataString(dedicatedCapacityName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Provisions the specified Dedicated capacity based on the configuration + /// specified in the request. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be a minimum of 3 characters, + /// and a maximum of 63. + /// + /// + /// Contains the information used to provision the Dedicated capacity. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, DedicatedCapacity capacityParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (capacityParameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "capacityParameters"); + } + if (capacityParameters != null) + { + capacityParameters.Validate(); + } + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (dedicatedCapacityName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dedicatedCapacityName"); + } + if (dedicatedCapacityName != null) + { + if (dedicatedCapacityName.Length > 63) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "dedicatedCapacityName", 63); + } + if (dedicatedCapacityName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "dedicatedCapacityName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(dedicatedCapacityName, "^[a-z][a-z0-9]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "dedicatedCapacityName", "^[a-z][a-z0-9]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dedicatedCapacityName", dedicatedCapacityName); + + tracingParameters.Add("capacityParameters", capacityParameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginCreate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dedicatedCapacityName}", System.Uri.EscapeDataString(dedicatedCapacityName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(capacityParameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(capacityParameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 201) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Deletes the specified Dedicated capacity. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (dedicatedCapacityName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dedicatedCapacityName"); + } + if (dedicatedCapacityName != null) + { + if (dedicatedCapacityName.Length > 63) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "dedicatedCapacityName", 63); + } + if (dedicatedCapacityName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "dedicatedCapacityName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(dedicatedCapacityName, "^[a-z][a-z0-9]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "dedicatedCapacityName", "^[a-z][a-z0-9]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dedicatedCapacityName", dedicatedCapacityName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dedicatedCapacityName}", System.Uri.EscapeDataString(dedicatedCapacityName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202 && (int)_statusCode != 204) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Updates the current state of the specified Dedicated capacity. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// Request object that contains the updated information for the capacity. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, DedicatedCapacityUpdateParameters capacityUpdateParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (capacityUpdateParameters == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "capacityUpdateParameters"); + } + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (dedicatedCapacityName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dedicatedCapacityName"); + } + if (dedicatedCapacityName != null) + { + if (dedicatedCapacityName.Length > 63) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "dedicatedCapacityName", 63); + } + if (dedicatedCapacityName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "dedicatedCapacityName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(dedicatedCapacityName, "^[a-z][a-z0-9]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "dedicatedCapacityName", "^[a-z][a-z0-9]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dedicatedCapacityName", dedicatedCapacityName); + + tracingParameters.Add("capacityUpdateParameters", capacityUpdateParameters); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dedicatedCapacityName}", System.Uri.EscapeDataString(dedicatedCapacityName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(capacityUpdateParameters != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(capacityUpdateParameters, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Suspends operation of the specified dedicated capacity instance. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// 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 System.Threading.Tasks.Task BeginSuspendWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (dedicatedCapacityName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dedicatedCapacityName"); + } + if (dedicatedCapacityName != null) + { + if (dedicatedCapacityName.Length > 63) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "dedicatedCapacityName", 63); + } + if (dedicatedCapacityName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "dedicatedCapacityName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(dedicatedCapacityName, "^[a-z][a-z0-9]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "dedicatedCapacityName", "^[a-z][a-z0-9]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dedicatedCapacityName", dedicatedCapacityName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginSuspend", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}/suspend").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dedicatedCapacityName}", System.Uri.EscapeDataString(dedicatedCapacityName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Resumes operation of the specified Dedicated capacity instance. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// 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 System.Threading.Tasks.Task BeginResumeWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(resourceGroupName, "^[-\\w\\._\\(\\)]+$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "resourceGroupName", "^[-\\w\\._\\(\\)]+$"); + } + } + if (dedicatedCapacityName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "dedicatedCapacityName"); + } + if (dedicatedCapacityName != null) + { + if (dedicatedCapacityName.Length > 63) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "dedicatedCapacityName", 63); + } + if (dedicatedCapacityName.Length < 3) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "dedicatedCapacityName", 3); + } + if (!System.Text.RegularExpressions.Regex.IsMatch(dedicatedCapacityName, "^[a-z][a-z0-9]*$")) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "dedicatedCapacityName", "^[a-z][a-z0-9]*$"); + } + } + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("dedicatedCapacityName", dedicatedCapacityName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginResume", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBIDedicated/capacities/{dedicatedCapacityName}/resume").ToString(); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{dedicatedCapacityName}", System.Uri.EscapeDataString(dedicatedCapacityName)); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new Microsoft.Rest.Azure.CloudException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + CloudError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex = new Microsoft.Rest.Azure.CloudException(_errorBody.Message); + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + ex.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/CapacitiesOperationsExtensions.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/CapacitiesOperationsExtensions.cs new file mode 100644 index 000000000000..d8edaa044692 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/CapacitiesOperationsExtensions.cs @@ -0,0 +1,633 @@ +// 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.PowerBIDedicated +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for CapacitiesOperations + /// + public static partial class CapacitiesOperationsExtensions + { + /// + /// Gets details about the specified dedicated capacity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the dedicated capacity. It must be a minimum of 3 characters, + /// and a maximum of 63. + /// + public static DedicatedCapacity GetDetails(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName) + { + return ((ICapacitiesOperations)operations).GetDetailsAsync(resourceGroupName, dedicatedCapacityName).GetAwaiter().GetResult(); + } + + /// + /// Gets details about the specified dedicated capacity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the dedicated capacity. It must be a minimum of 3 characters, + /// and a maximum of 63. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetDetailsAsync(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetDetailsWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Provisions the specified Dedicated capacity based on the configuration + /// specified in the request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be a minimum of 3 characters, + /// and a maximum of 63. + /// + public static DedicatedCapacity Create(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, DedicatedCapacity capacityParameters) + { + return ((ICapacitiesOperations)operations).CreateAsync(resourceGroupName, dedicatedCapacityName, capacityParameters).GetAwaiter().GetResult(); + } + + /// + /// Provisions the specified Dedicated capacity based on the configuration + /// specified in the request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be a minimum of 3 characters, + /// and a maximum of 63. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, DedicatedCapacity capacityParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, capacityParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes the specified Dedicated capacity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + public static void Delete(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName) + { + ((ICapacitiesOperations)operations).DeleteAsync(resourceGroupName, dedicatedCapacityName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified Dedicated capacity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Updates the current state of the specified Dedicated capacity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + public static DedicatedCapacity Update(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, DedicatedCapacityUpdateParameters capacityUpdateParameters) + { + return ((ICapacitiesOperations)operations).UpdateAsync(resourceGroupName, dedicatedCapacityName, capacityUpdateParameters).GetAwaiter().GetResult(); + } + + /// + /// Updates the current state of the specified Dedicated capacity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, DedicatedCapacityUpdateParameters capacityUpdateParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, capacityUpdateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Suspends operation of the specified dedicated capacity instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + public static void Suspend(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName) + { + ((ICapacitiesOperations)operations).SuspendAsync(resourceGroupName, dedicatedCapacityName).GetAwaiter().GetResult(); + } + + /// + /// Suspends operation of the specified dedicated capacity instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task SuspendAsync(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.SuspendWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Resumes operation of the specified Dedicated capacity instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + public static void Resume(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName) + { + ((ICapacitiesOperations)operations).ResumeAsync(resourceGroupName, dedicatedCapacityName).GetAwaiter().GetResult(); + } + + /// + /// Resumes operation of the specified Dedicated capacity instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ResumeAsync(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.ResumeWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Gets all the Dedicated capacities for the given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + public static System.Collections.Generic.IEnumerable ListByResourceGroup(this ICapacitiesOperations operations, string resourceGroupName) + { + return ((ICapacitiesOperations)operations).ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Gets all the Dedicated capacities for the given resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByResourceGroupAsync(this ICapacitiesOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists all the Dedicated capacities for the given subscription. + /// + /// + /// The operations group for this extension method. + /// + public static System.Collections.Generic.IEnumerable List(this ICapacitiesOperations operations) + { + return ((ICapacitiesOperations)operations).ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all the Dedicated capacities for the given subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this ICapacitiesOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists eligible SKUs for PowerBI Dedicated resource provider. + /// + /// + /// The operations group for this extension method. + /// + public static SkuEnumerationForNewResourceResult ListSkus(this ICapacitiesOperations operations) + { + return ((ICapacitiesOperations)operations).ListSkusAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists eligible SKUs for PowerBI Dedicated resource provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ListSkusAsync(this ICapacitiesOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListSkusWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists eligible SKUs for a PowerBI Dedicated resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + public static SkuEnumerationForExistingResourceResult ListSkusForCapacity(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName) + { + return ((ICapacitiesOperations)operations).ListSkusForCapacityAsync(resourceGroupName, dedicatedCapacityName).GetAwaiter().GetResult(); + } + + /// + /// Lists eligible SKUs for a PowerBI Dedicated resource. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task ListSkusForCapacityAsync(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListSkusForCapacityWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Provisions the specified Dedicated capacity based on the configuration + /// specified in the request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be a minimum of 3 characters, + /// and a maximum of 63. + /// + public static DedicatedCapacity BeginCreate(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, DedicatedCapacity capacityParameters) + { + return ((ICapacitiesOperations)operations).BeginCreateAsync(resourceGroupName, dedicatedCapacityName, capacityParameters).GetAwaiter().GetResult(); + } + + /// + /// Provisions the specified Dedicated capacity based on the configuration + /// specified in the request. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be a minimum of 3 characters, + /// and a maximum of 63. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginCreateAsync(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, DedicatedCapacity capacityParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginCreateWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, capacityParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Deletes the specified Dedicated capacity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + public static void BeginDelete(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName) + { + ((ICapacitiesOperations)operations).BeginDeleteAsync(resourceGroupName, dedicatedCapacityName).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified Dedicated capacity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Updates the current state of the specified Dedicated capacity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + public static DedicatedCapacity BeginUpdate(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, DedicatedCapacityUpdateParameters capacityUpdateParameters) + { + return ((ICapacitiesOperations)operations).BeginUpdateAsync(resourceGroupName, dedicatedCapacityName, capacityUpdateParameters).GetAwaiter().GetResult(); + } + + /// + /// Updates the current state of the specified Dedicated capacity. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginUpdateAsync(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, DedicatedCapacityUpdateParameters capacityUpdateParameters, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, capacityUpdateParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Suspends operation of the specified dedicated capacity instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + public static void BeginSuspend(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName) + { + ((ICapacitiesOperations)operations).BeginSuspendAsync(resourceGroupName, dedicatedCapacityName).GetAwaiter().GetResult(); + } + + /// + /// Suspends operation of the specified dedicated capacity instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginSuspendAsync(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginSuspendWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Resumes operation of the specified Dedicated capacity instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + public static void BeginResume(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName) + { + ((ICapacitiesOperations)operations).BeginResumeAsync(resourceGroupName, dedicatedCapacityName).GetAwaiter().GetResult(); + } + + /// + /// Resumes operation of the specified Dedicated capacity instance. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginResumeAsync(this ICapacitiesOperations operations, string resourceGroupName, string dedicatedCapacityName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginResumeWithHttpMessagesAsync(resourceGroupName, dedicatedCapacityName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + } +} diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/ICapacitiesOperations.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/ICapacitiesOperations.cs new file mode 100644 index 000000000000..704334d7c4ee --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/ICapacitiesOperations.cs @@ -0,0 +1,428 @@ +// 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.PowerBIDedicated +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// CapacitiesOperations operations. + /// + public partial interface ICapacitiesOperations + { + /// + /// Gets details about the specified dedicated capacity. + /// + /// + /// Gets details about the specified dedicated capacity. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the dedicated capacity. It must be a minimum of 3 characters, + /// and a maximum of 63. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetDetailsWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Provisions the specified Dedicated capacity based on the configuration + /// specified in the request. + /// + /// + /// Provisions the specified Dedicated capacity based on the configuration + /// specified in the request. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be a minimum of 3 characters, + /// and a maximum of 63. + /// + /// + /// Contains the information used to provision the Dedicated capacity. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, DedicatedCapacity capacityParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes the specified Dedicated capacity. + /// + /// + /// Deletes the specified Dedicated capacity. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates the current state of the specified Dedicated capacity. + /// + /// + /// Updates the current state of the specified Dedicated capacity. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// Request object that contains the updated information for the capacity. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, DedicatedCapacityUpdateParameters capacityUpdateParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Suspends operation of the specified dedicated capacity instance. + /// + /// + /// Suspends operation of the specified dedicated capacity instance. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task SuspendWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Resumes operation of the specified Dedicated capacity instance. + /// + /// + /// Resumes operation of the specified Dedicated capacity instance. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task ResumeWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Gets all the Dedicated capacities for the given resource group. + /// + /// + /// Gets all the Dedicated capacities for the given resource group. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists all the Dedicated capacities for the given subscription. + /// + /// + /// Lists all the Dedicated capacities for the given subscription. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists eligible SKUs for PowerBI Dedicated resource provider. + /// + /// + /// Lists eligible SKUs for PowerBI Dedicated resource provider. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> ListSkusWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists eligible SKUs for a PowerBI Dedicated resource. + /// + /// + /// Lists eligible SKUs for a PowerBI Dedicated resource. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> ListSkusForCapacityWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Provisions the specified Dedicated capacity based on the configuration + /// specified in the request. + /// + /// + /// Provisions the specified Dedicated capacity based on the configuration + /// specified in the request. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be a minimum of 3 characters, + /// and a maximum of 63. + /// + /// + /// Contains the information used to provision the Dedicated capacity. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, DedicatedCapacity capacityParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Deletes the specified Dedicated capacity. + /// + /// + /// Deletes the specified Dedicated capacity. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Updates the current state of the specified Dedicated capacity. + /// + /// + /// Updates the current state of the specified Dedicated capacity. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// Request object that contains the updated information for the capacity. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, DedicatedCapacityUpdateParameters capacityUpdateParameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Suspends operation of the specified dedicated capacity instance. + /// + /// + /// Suspends operation of the specified dedicated capacity instance. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginSuspendWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Resumes operation of the specified Dedicated capacity instance. + /// + /// + /// Resumes operation of the specified Dedicated capacity instance. + /// + /// + /// The name of the Azure Resource group of which a given PowerBIDedicated + /// capacity is part. This name must be at least 1 character in length, and no + /// more than 90. + /// + /// + /// The name of the Dedicated capacity. It must be at least 3 characters in + /// length, and no more than 63. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginResumeWithHttpMessagesAsync(string resourceGroupName, string dedicatedCapacityName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/IOperations.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/IOperations.cs new file mode 100644 index 000000000000..2b2de69eab2b --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/IOperations.cs @@ -0,0 +1,60 @@ +// 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.PowerBIDedicated +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Operations operations. + /// + public partial interface IOperations + { + /// + /// Lists all of the available PowerBIDedicated REST API operations. + /// + /// + /// Lists all of the available PowerBIDedicated REST API operations. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Lists all of the available PowerBIDedicated REST API operations. + /// + /// + /// Lists all of the available PowerBIDedicated REST API operations. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/IPowerBIDedicatedManagementClient.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/IPowerBIDedicatedManagementClient.cs new file mode 100644 index 000000000000..1ff6e398525d --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/IPowerBIDedicatedManagementClient.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.PowerBIDedicated +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// PowerBI Dedicated Web API provides a RESTful set of web services that + /// enables users to create, retrieve, update, and delete Power BI dedicated + /// capacities + /// + public partial interface IPowerBIDedicatedManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + Microsoft.Rest.ServiceClientCredentials Credentials { get;} + + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get;} + + + /// + /// A unique identifier for a Microsoft Azure subscription. The subscription ID + /// forms part of the URI for every service call. + /// + string SubscriptionId { get; set;} + + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set;} + + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set;} + + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set;} + + + /// + /// Gets the ICapacitiesOperations + /// + ICapacitiesOperations Capacities { get; } + + /// + /// Gets the IOperations + /// + IOperations Operations { get; } + + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacity.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacity.cs new file mode 100644 index 000000000000..fb8362d7f029 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacity.cs @@ -0,0 +1,109 @@ +// 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.PowerBIDedicated.Models +{ + using System.Linq; + + /// + /// Represents an instance of a Dedicated Capacity resource. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class DedicatedCapacity : Resource + { + /// + /// Initializes a new instance of the DedicatedCapacity class. + /// + public DedicatedCapacity() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedCapacity class. + /// + + /// An identifier that represents the PowerBI Dedicated resource. + /// + + /// The name of the PowerBI Dedicated resource. + /// + + /// The type of the PowerBI Dedicated resource. + /// + + /// Location of the PowerBI Dedicated resource. + /// + + /// The SKU of the PowerBI Dedicated resource. + /// + + /// Key-value pairs of additional resource provisioning properties. + /// + + /// The current state of PowerBI Dedicated resource. The state is to indicate + /// more states outside of resource provisioning. + /// Possible values include: 'Deleting', 'Succeeded', 'Failed', 'Paused', + /// 'Suspended', 'Provisioning', 'Updating', 'Suspending', 'Pausing', + /// 'Resuming', 'Preparing', 'Scaling' + + /// The current deployment state of PowerBI Dedicatedresource. The + /// provisioningState is to indicate states for resource provisioning. + /// Possible values include: 'Deleting', 'Succeeded', 'Failed', 'Paused', + /// 'Suspended', 'Provisioning', 'Updating', 'Suspending', 'Pausing', + /// 'Resuming', 'Preparing', 'Scaling' + + /// A collection of Dedicated capacity administrators + /// + public DedicatedCapacity(string location, ResourceSku sku, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), string state = default(string), string provisioningState = default(string), DedicatedCapacityAdministrators administration = default(DedicatedCapacityAdministrators)) + + : base(location, sku, id, name, type, tags) + { + this.State = state; + this.ProvisioningState = provisioningState; + this.Administration = administration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the current state of PowerBI Dedicated resource. The state is to + /// indicate more states outside of resource provisioning. Possible values include: 'Deleting', 'Succeeded', 'Failed', 'Paused', 'Suspended', 'Provisioning', 'Updating', 'Suspending', 'Pausing', 'Resuming', 'Preparing', 'Scaling' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.state")] + public string State {get; private set; } + + /// + /// Gets the current deployment state of PowerBI Dedicatedresource. The + /// provisioningState is to indicate states for resource provisioning. Possible values include: 'Deleting', 'Succeeded', 'Failed', 'Paused', 'Suspended', 'Provisioning', 'Updating', 'Suspending', 'Pausing', 'Resuming', 'Preparing', 'Scaling' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.provisioningState")] + public string ProvisioningState {get; private set; } + + /// + /// Gets or sets a collection of Dedicated capacity administrators + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.administration")] + public DedicatedCapacityAdministrators Administration {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + + + + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacityAdministrators.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacityAdministrators.cs new file mode 100644 index 000000000000..0374dbb25953 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacityAdministrators.cs @@ -0,0 +1,48 @@ +// 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.PowerBIDedicated.Models +{ + using System.Linq; + + /// + /// An array of administrator user identities + /// + public partial class DedicatedCapacityAdministrators + { + /// + /// Initializes a new instance of the DedicatedCapacityAdministrators class. + /// + public DedicatedCapacityAdministrators() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedCapacityAdministrators class. + /// + + /// An array of administrator user identities. + /// + public DedicatedCapacityAdministrators(System.Collections.Generic.IList members = default(System.Collections.Generic.IList)) + + { + this.Members = members; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets an array of administrator user identities. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "members")] + public System.Collections.Generic.IList Members {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacityMutableProperties.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacityMutableProperties.cs new file mode 100644 index 000000000000..61c435c77b48 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacityMutableProperties.cs @@ -0,0 +1,49 @@ +// 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.PowerBIDedicated.Models +{ + using System.Linq; + + /// + /// An object that represents a set of mutable Dedicated capacity resource + /// properties. + /// + public partial class DedicatedCapacityMutableProperties + { + /// + /// Initializes a new instance of the DedicatedCapacityMutableProperties class. + /// + public DedicatedCapacityMutableProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedCapacityMutableProperties class. + /// + + /// A collection of Dedicated capacity administrators + /// + public DedicatedCapacityMutableProperties(DedicatedCapacityAdministrators administration = default(DedicatedCapacityAdministrators)) + + { + this.Administration = administration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets a collection of Dedicated capacity administrators + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "administration")] + public DedicatedCapacityAdministrators Administration {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacityProperties.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacityProperties.cs new file mode 100644 index 000000000000..ddecf52c4a8d --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacityProperties.cs @@ -0,0 +1,70 @@ +// 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.PowerBIDedicated.Models +{ + using System.Linq; + + /// + /// Properties of Dedicated Capacity resource. + /// + public partial class DedicatedCapacityProperties : DedicatedCapacityMutableProperties + { + /// + /// Initializes a new instance of the DedicatedCapacityProperties class. + /// + public DedicatedCapacityProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedCapacityProperties class. + /// + + /// A collection of Dedicated capacity administrators + /// + + /// The current state of PowerBI Dedicated resource. The state is to indicate + /// more states outside of resource provisioning. + /// Possible values include: 'Deleting', 'Succeeded', 'Failed', 'Paused', + /// 'Suspended', 'Provisioning', 'Updating', 'Suspending', 'Pausing', + /// 'Resuming', 'Preparing', 'Scaling' + + /// The current deployment state of PowerBI Dedicatedresource. The + /// provisioningState is to indicate states for resource provisioning. + /// Possible values include: 'Deleting', 'Succeeded', 'Failed', 'Paused', + /// 'Suspended', 'Provisioning', 'Updating', 'Suspending', 'Pausing', + /// 'Resuming', 'Preparing', 'Scaling' + public DedicatedCapacityProperties(DedicatedCapacityAdministrators administration = default(DedicatedCapacityAdministrators), string state = default(string), string provisioningState = default(string)) + + : base(administration) + { + this.State = state; + this.ProvisioningState = provisioningState; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets the current state of PowerBI Dedicated resource. The state is to + /// indicate more states outside of resource provisioning. Possible values include: 'Deleting', 'Succeeded', 'Failed', 'Paused', 'Suspended', 'Provisioning', 'Updating', 'Suspending', 'Pausing', 'Resuming', 'Preparing', 'Scaling' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "state")] + public string State {get; private set; } + + /// + /// Gets the current deployment state of PowerBI Dedicatedresource. The + /// provisioningState is to indicate states for resource provisioning. Possible values include: 'Deleting', 'Succeeded', 'Failed', 'Paused', 'Suspended', 'Provisioning', 'Updating', 'Suspending', 'Pausing', 'Resuming', 'Preparing', 'Scaling' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provisioningState")] + public string ProvisioningState {get; private set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacityUpdateParameters.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacityUpdateParameters.cs new file mode 100644 index 000000000000..3f994e2d89b5 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/DedicatedCapacityUpdateParameters.cs @@ -0,0 +1,84 @@ +// 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.PowerBIDedicated.Models +{ + using System.Linq; + + /// + /// Provision request specification + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class DedicatedCapacityUpdateParameters + { + /// + /// Initializes a new instance of the DedicatedCapacityUpdateParameters class. + /// + public DedicatedCapacityUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DedicatedCapacityUpdateParameters class. + /// + + /// The SKU of the Dedicated capacity resource. + /// + + /// Key-value pairs of additional provisioning properties. + /// + + /// A collection of Dedicated capacity administrators + /// + public DedicatedCapacityUpdateParameters(ResourceSku sku = default(ResourceSku), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), DedicatedCapacityAdministrators administration = default(DedicatedCapacityAdministrators)) + + { + this.Sku = sku; + this.Tags = tags; + this.Administration = administration; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the SKU of the Dedicated capacity resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sku")] + public ResourceSku Sku {get; set; } + + /// + /// Gets or sets key-value pairs of additional provisioning properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } + + /// + /// Gets or sets a collection of Dedicated capacity administrators + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.administration")] + public DedicatedCapacityAdministrators Administration {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Sku != null) + { + this.Sku.Validate(); + } + + + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/ErrorResponse.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/ErrorResponse.cs new file mode 100644 index 000000000000..de05400f242f --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/ErrorResponse.cs @@ -0,0 +1,58 @@ +// 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.PowerBIDedicated.Models +{ + using System.Linq; + + /// + /// Describes the format of Error response. + /// + public partial class ErrorResponse + { + /// + /// Initializes a new instance of the ErrorResponse class. + /// + public ErrorResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + + /// Error code + /// + + /// Error message indicating why the operation failed. + /// + public ErrorResponse(string code = default(string), string message = default(string)) + + { + this.Code = code; + this.Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets error code + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets error message indicating why the operation failed. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/ErrorResponseException.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/ErrorResponseException.cs new file mode 100644 index 000000000000..07354b12e064 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/ErrorResponseException.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.PowerBIDedicated.Models +{ + + /// + /// Exception thrown for an invalid response with ErrorResponse information. + /// + public partial class ErrorResponseException : Microsoft.Rest.RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public Microsoft.Rest.HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public Microsoft.Rest.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 ErrorResponse class. + /// + /// The exception message. + public ErrorResponseException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the ErrorResponse class. + /// + /// The exception message. + /// Inner exception. + public ErrorResponseException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/Operation.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/Operation.cs new file mode 100644 index 000000000000..e2d10fe91357 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/Operation.cs @@ -0,0 +1,58 @@ +// 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.PowerBIDedicated.Models +{ + using System.Linq; + + /// + /// Capacities REST API operation. + /// + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + + /// Operation name: {provider}/{resource}/{operation}. + /// + + /// The object that represents the operation. + /// + public Operation(string name = default(string), OperationDisplay display = default(OperationDisplay)) + + { + this.Name = name; + this.Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets operation name: {provider}/{resource}/{operation}. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } + + /// + /// Gets or sets the object that represents the operation. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "display")] + public OperationDisplay Display {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/OperationDisplay.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..2326292f4f55 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/OperationDisplay.cs @@ -0,0 +1,68 @@ +// 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.PowerBIDedicated.Models +{ + using System.Linq; + + /// + /// The object that represents the operation. + /// + public partial class OperationDisplay + { + /// + /// Initializes a new instance of the OperationDisplay class. + /// + public OperationDisplay() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationDisplay class. + /// + + /// Service provider: Microsoft.PowerBIDedicated. + /// + + /// Resource on which the operation is performed: capacity, etc. + /// + + /// Operation type: create, update, delete, etc. + /// + public OperationDisplay(string provider = default(string), string resource = default(string), string operation = default(string)) + + { + this.Provider = provider; + this.Resource = resource; + this.Operation = operation; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets service provider: Microsoft.PowerBIDedicated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provider")] + public string Provider {get; private set; } + + /// + /// Gets resource on which the operation is performed: capacity, etc. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resource")] + public string Resource {get; private set; } + + /// + /// Gets operation type: create, update, delete, etc. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "operation")] + public string Operation {get; private set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/Page.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/Page.cs new file mode 100644 index 000000000000..2829c4caa207 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/Page.cs @@ -0,0 +1,43 @@ +// 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.PowerBIDedicated.Models +{ + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [Newtonsoft.Json.JsonObject] + public class Page : Microsoft.Rest.Azure.IPage + { + /// + /// Gets the link to the next page. + /// + [Newtonsoft.Json.JsonProperty("")] + public System.String NextPageLink { get; private set; } + + [Newtonsoft.Json.JsonProperty("value")] + private System.Collections.Generic.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 System.Collections.Generic.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. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/Page1.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/Page1.cs new file mode 100644 index 000000000000..d1a0445c554e --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/Page1.cs @@ -0,0 +1,43 @@ +// 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.PowerBIDedicated.Models +{ + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [Newtonsoft.Json.JsonObject] + public class Page1 : Microsoft.Rest.Azure.IPage + { + /// + /// Gets the link to the next page. + /// + [Newtonsoft.Json.JsonProperty("nextLink")] + public System.String NextPageLink { get; private set; } + + [Newtonsoft.Json.JsonProperty("value")] + private System.Collections.Generic.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 System.Collections.Generic.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. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/ProvisioningState.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..178cd04ec905 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/ProvisioningState.cs @@ -0,0 +1,29 @@ +// 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.PowerBIDedicated.Models +{ + + /// + /// Defines values for ProvisioningState. + /// + + + public static class ProvisioningState + { + public const string Deleting = "Deleting"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Paused = "Paused"; + public const string Suspended = "Suspended"; + public const string Provisioning = "Provisioning"; + public const string Updating = "Updating"; + public const string Suspending = "Suspending"; + public const string Pausing = "Pausing"; + public const string Resuming = "Resuming"; + public const string Preparing = "Preparing"; + public const string Scaling = "Scaling"; + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/Resource.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/Resource.cs new file mode 100644 index 000000000000..5225afec8540 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/Resource.cs @@ -0,0 +1,125 @@ +// 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.PowerBIDedicated.Models +{ + using System.Linq; + + /// + /// Represents an instance of an PowerBI Dedicated resource. + /// + public partial class Resource : Microsoft.Rest.Azure.IResource + { + /// + /// Initializes a new instance of the Resource class. + /// + public Resource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Resource class. + /// + + /// An identifier that represents the PowerBI Dedicated resource. + /// + + /// The name of the PowerBI Dedicated resource. + /// + + /// The type of the PowerBI Dedicated resource. + /// + + /// Location of the PowerBI Dedicated resource. + /// + + /// The SKU of the PowerBI Dedicated resource. + /// + + /// Key-value pairs of additional resource provisioning properties. + /// + public Resource(string location, ResourceSku sku, string id = default(string), string name = default(string), string type = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary)) + + { + this.Id = id; + this.Name = name; + this.Type = type; + this.Location = location; + this.Sku = sku; + this.Tags = tags; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets an identifier that represents the PowerBI Dedicated resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; private set; } + + /// + /// Gets the name of the PowerBI Dedicated resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; private set; } + + /// + /// Gets the type of the PowerBI Dedicated resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; private set; } + + /// + /// Gets or sets location of the PowerBI Dedicated resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } + + /// + /// Gets or sets the SKU of the PowerBI Dedicated resource. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sku")] + public ResourceSku Sku {get; set; } + + /// + /// Gets or sets key-value pairs of additional resource provisioning + /// properties. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Location == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Location"); + } + if (this.Sku == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Sku"); + } + + + + + if (this.Sku != null) + { + this.Sku.Validate(); + } + + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/ResourceSku.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/ResourceSku.cs new file mode 100644 index 000000000000..c55ff5d4298b --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/ResourceSku.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.PowerBIDedicated.Models +{ + using System.Linq; + + /// + /// Represents the SKU name and Azure pricing tier for PowerBI Dedicated + /// resource. + /// + public partial class ResourceSku + { + /// + /// Initializes a new instance of the ResourceSku class. + /// + public ResourceSku() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSku class. + /// + + /// Name of the SKU level. + /// + + /// The name of the Azure pricing tier to which the SKU applies. + /// Possible values include: 'PBIE_Azure' + public ResourceSku(string name, string tier = default(string)) + + { + this.Name = name; + this.Tier = tier; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets name of the SKU level. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets the name of the Azure pricing tier to which the SKU applies. Possible values include: 'PBIE_Azure' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tier")] + public string Tier {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Name == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name"); + } + + + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/SkuDetailsForExistingResource.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/SkuDetailsForExistingResource.cs new file mode 100644 index 000000000000..c502568dc78d --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/SkuDetailsForExistingResource.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +namespace Microsoft.Azure.Management.PowerBIDedicated.Models +{ + using System.Linq; + + /// + /// An object that represents SKU details for existing resources + /// + public partial class SkuDetailsForExistingResource + { + /// + /// Initializes a new instance of the SkuDetailsForExistingResource class. + /// + public SkuDetailsForExistingResource() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuDetailsForExistingResource class. + /// + + /// The SKU in SKU details for existing resources. + /// + public SkuDetailsForExistingResource(ResourceSku sku = default(ResourceSku)) + + { + this.Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the SKU in SKU details for existing resources. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sku")] + public ResourceSku Sku {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.Sku != null) + { + this.Sku.Validate(); + } + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/SkuEnumerationForExistingResourceResult.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/SkuEnumerationForExistingResourceResult.cs new file mode 100644 index 000000000000..6835013669d8 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/SkuEnumerationForExistingResourceResult.cs @@ -0,0 +1,48 @@ +// 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.PowerBIDedicated.Models +{ + using System.Linq; + + /// + /// An object that represents enumerating SKUs for existing resources + /// + public partial class SkuEnumerationForExistingResourceResult + { + /// + /// Initializes a new instance of the SkuEnumerationForExistingResourceResult class. + /// + public SkuEnumerationForExistingResourceResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuEnumerationForExistingResourceResult class. + /// + + /// The collection of available SKUs for existing resources + /// + public SkuEnumerationForExistingResourceResult(System.Collections.Generic.IList value = default(System.Collections.Generic.IList)) + + { + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the collection of available SKUs for existing resources + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public System.Collections.Generic.IList Value {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/SkuEnumerationForNewResourceResult.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/SkuEnumerationForNewResourceResult.cs new file mode 100644 index 000000000000..14127ccd697e --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/SkuEnumerationForNewResourceResult.cs @@ -0,0 +1,48 @@ +// 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.PowerBIDedicated.Models +{ + using System.Linq; + + /// + /// An object that represents enumerating SKUs for new resources + /// + public partial class SkuEnumerationForNewResourceResult + { + /// + /// Initializes a new instance of the SkuEnumerationForNewResourceResult class. + /// + public SkuEnumerationForNewResourceResult() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the SkuEnumerationForNewResourceResult class. + /// + + /// The collection of available SKUs for new resources + /// + public SkuEnumerationForNewResourceResult(System.Collections.Generic.IList value = default(System.Collections.Generic.IList)) + + { + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the collection of available SKUs for new resources + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public System.Collections.Generic.IList Value {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/SkuTier.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/SkuTier.cs new file mode 100644 index 000000000000..db7638dfb8d0 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/SkuTier.cs @@ -0,0 +1,18 @@ +// 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.PowerBIDedicated.Models +{ + + /// + /// Defines values for SkuTier. + /// + + + public static class SkuTier + { + public const string PbieAzure = "PBIE_Azure"; + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/State.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/State.cs new file mode 100644 index 000000000000..ae8f38c3ab50 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Models/State.cs @@ -0,0 +1,29 @@ +// 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.PowerBIDedicated.Models +{ + + /// + /// Defines values for State. + /// + + + public static class State + { + public const string Deleting = "Deleting"; + public const string Succeeded = "Succeeded"; + public const string Failed = "Failed"; + public const string Paused = "Paused"; + public const string Suspended = "Suspended"; + public const string Provisioning = "Provisioning"; + public const string Updating = "Updating"; + public const string Suspending = "Suspending"; + public const string Pausing = "Pausing"; + public const string Resuming = "Resuming"; + public const string Preparing = "Preparing"; + public const string Scaling = "Scaling"; + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Operations.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Operations.cs new file mode 100644 index 000000000000..ea15f5c8f84e --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/Operations.cs @@ -0,0 +1,401 @@ +// 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.PowerBIDedicated +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// Operations operations. + /// + internal partial class Operations : Microsoft.Rest.IServiceOperations, IOperations + { + /// + /// Initializes a new instance of the Operations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal Operations (PowerBIDedicatedManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the PowerBIDedicatedManagementClient + /// + public PowerBIDedicatedManagementClient Client { get; private set; } + + /// + /// Lists all of the available PowerBIDedicated REST API operations. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.PowerBIDedicated/operations").ToString(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Lists all of the available PowerBIDedicated REST API operations. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListNextWithHttpMessagesAsync(string nextPageLink, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + if (nextPageLink == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "nextPageLink"); + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("nextPageLink", nextPageLink); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListNext", tracingParameters); + } + // Construct URL + string _url = "{nextLink}"; + _url = _url.Replace("{nextLink}", nextPageLink); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/OperationsExtensions.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/OperationsExtensions.cs new file mode 100644 index 000000000000..1b82fe96ac86 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/OperationsExtensions.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.PowerBIDedicated +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for Operations + /// + public static partial class OperationsExtensions + { + /// + /// Lists all of the available PowerBIDedicated REST API operations. + /// + /// + /// The operations group for this extension method. + /// + public static Microsoft.Rest.Azure.IPage List(this IOperations operations) + { + return ((IOperations)operations).ListAsync().GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available PowerBIDedicated REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Lists all of the available PowerBIDedicated REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + public static Microsoft.Rest.Azure.IPage ListNext(this IOperations operations, string nextPageLink) + { + return ((IOperations)operations).ListNextAsync(nextPageLink).GetAwaiter().GetResult(); + } + + /// + /// Lists all of the available PowerBIDedicated REST API operations. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The NextLink from the previous successful call to List operation. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListNextAsync(this IOperations operations, string nextPageLink, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListNextWithHttpMessagesAsync(nextPageLink, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/PowerBIDedicatedManagementClient.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/PowerBIDedicatedManagementClient.cs new file mode 100644 index 000000000000..3126e0224b7d --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Generated/PowerBIDedicatedManagementClient.cs @@ -0,0 +1,347 @@ +// 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.PowerBIDedicated +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// PowerBI Dedicated Web API provides a RESTful set of web services that + /// enables users to create, retrieve, update, and delete Power BI dedicated + /// capacities + /// + public partial class PowerBIDedicatedManagementClient : Microsoft.Rest.ServiceClient, IPowerBIDedicatedManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + /// + /// Gets or sets json serialization settings. + /// + public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; } + /// + /// Gets or sets json deserialization settings. + /// + public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; } + /// + /// Credentials needed for the client to connect to Azure. + /// + public Microsoft.Rest.ServiceClientCredentials Credentials { get; private set; } + + /// + /// The API version to use for this operation. + /// + public string ApiVersion { get; private set; } + + /// + /// A unique identifier for a Microsoft Azure subscription. The subscription ID + /// forms part of the URI for every service call. + /// + public string SubscriptionId { get; set;} + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set;} + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. + /// + public int? LongRunningOperationRetryTimeout { get; set;} + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set;} + + /// + /// Gets the ICapacitiesOperations + /// + public virtual ICapacitiesOperations Capacities { get; private set; } + /// + /// Gets the IOperations + /// + public virtual IOperations Operations { get; private set; } + /// + /// Initializes a new instance of the PowerBIDedicatedManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling PowerBIDedicatedManagementClient.Dispose(). False: will not dispose provided httpClient + protected PowerBIDedicatedManagementClient(System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the PowerBIDedicatedManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected PowerBIDedicatedManagementClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the PowerBIDedicatedManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected PowerBIDedicatedManagementClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the PowerBIDedicatedManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected PowerBIDedicatedManagementClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + this.BaseUri = baseUri; + } + /// + /// Initializes a new instance of the PowerBIDedicatedManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected PowerBIDedicatedManagementClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + + this.BaseUri = baseUri; + } + /// + /// Initializes a new instance of the PowerBIDedicatedManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public PowerBIDedicatedManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the PowerBIDedicatedManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling PowerBIDedicatedManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public PowerBIDedicatedManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the PowerBIDedicatedManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public PowerBIDedicatedManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the PowerBIDedicatedManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public PowerBIDedicatedManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the PowerBIDedicatedManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Thrown when a required parameter is null + /// + public PowerBIDedicatedManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + + /// + /// Initializes client properties. + /// + private void Initialize() + { + this.Capacities = new CapacitiesOperations(this); + this.Operations = new Operations(this); + this.BaseUri = new System.Uri("https://management.azure.com"); + this.ApiVersion = "2017-10-01"; + this.AcceptLanguage = "en-US"; + this.LongRunningOperationRetryTimeout = 30; + this.GenerateClientRequestId = true; + SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List + { + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() + } + }; + SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List + { + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.TransformationJsonConverter()); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter()); + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/PowerBIDedicated.Management.Sdk.csproj b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/PowerBIDedicated.Management.Sdk.csproj new file mode 100644 index 000000000000..35cc77b468b4 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/PowerBIDedicated.Management.Sdk.csproj @@ -0,0 +1,13 @@ + + + PowerBIEmbedded + + + + netstandard2.0 + Microsoft.Azure.PowerShell.PowerBIDedicated.Management.Sdk + Microsoft.Azure.Management.PowerBIDedicated + $(NoWarn);CS0108;CS1573 + + + \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Properties/AssemblyInfo.cs b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..d0e85ec29ad8 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - PowerBI Dedicated Management SDK")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] + +[assembly: AssemblyVersion("0.11.0.0")] +[assembly: AssemblyFileVersion("0.11.0.0")] \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/README.md b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/README.md new file mode 100644 index 000000000000..63a86fab14dd --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIDedicated.Management.Sdk/README.md @@ -0,0 +1,35 @@ +# Overall +This directory contains PowerBI Dedicated management plane service clients of Az.PowerBIEmbedded module. + +## Run Generation +In this directory, run AutoRest: +``` +autorest --reset +autorest --use:@autorest/powershell@4.x +``` + +### AutoRest Configuration +> see https://aka.ms/autorest +``` yaml +isSdkGenerator: true +powershell: true +clear-output-folder: true +reflect-api-versions: true +openapi-type: arm +azure-arm: true +license-header: MICROSOFT_MIT_NO_VERSION +title: PowerBIDedicatedManagementClient +``` + + + +### +``` yaml +commit: d2bb2feadd0deb1c7212706aa65cab2f56adccc7 +input-file: + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/powerbidedicated/resource-manager/Microsoft.PowerBIdedicated/stable/2017-10-01/powerbidedicated.json + +output-folder: Generated + +namespace: Microsoft.Azure.Management.PowerBIDedicated +``` \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/IPowerBIEmbeddedManagementClient.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/IPowerBIEmbeddedManagementClient.cs new file mode 100644 index 000000000000..361284517796 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/IPowerBIEmbeddedManagementClient.cs @@ -0,0 +1,107 @@ +// 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.PowerBIEmbedded +{ + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// Client to manage your Power BI Embedded workspace collections and retrieve + /// workspaces. + /// + public partial interface IPowerBIEmbeddedManagementClient : System.IDisposable + { + /// + /// The base URI of the service. + /// + System.Uri BaseUri { get; set; } + + /// + /// Gets or sets json serialization settings. + /// + Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; } + + /// + /// Gets or sets json deserialization settings. + /// + Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; } + + /// + /// Credentials needed for the client to connect to Azure. + /// + Microsoft.Rest.ServiceClientCredentials Credentials { get;} + + + /// + /// The API version to use for this operation. + /// + string ApiVersion { get;} + + + /// + /// Gets subscription credentials which uniquely identify a Microsoft Azure + /// subscription. The subscription ID forms part of the URI for every service + /// call. + /// + string SubscriptionId { get; set;} + + + /// + /// The preferred language for the response. + /// + string AcceptLanguage { get; set;} + + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. + /// + int? LongRunningOperationRetryTimeout { get; set;} + + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. + /// + bool? GenerateClientRequestId { get; set;} + + + /// + /// Gets the IWorkspaceCollectionsOperations + /// + IWorkspaceCollectionsOperations WorkspaceCollections { get; } + + /// + /// Gets the IWorkspacesOperations + /// + IWorkspacesOperations Workspaces { get; } + + /// + /// Indicates which operations can be performed by the Power BI Resource + /// Provider. + /// + /// + /// Indicates which operations can be performed by the Power BI Resource + /// Provider. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> GetAvailableOperationsWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/IWorkspaceCollectionsOperations.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/IWorkspaceCollectionsOperations.cs new file mode 100644 index 000000000000..12f2a8964a34 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/IWorkspaceCollectionsOperations.cs @@ -0,0 +1,312 @@ +// 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.PowerBIEmbedded +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// WorkspaceCollectionsOperations operations. + /// + public partial interface IWorkspaceCollectionsOperations + { + /// + /// Retrieves an existing Power BI Workspace Collection. + /// + /// + /// Retrieves an existing Power BI Workspace Collection. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection 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 + /// + System.Threading.Tasks.Task> GetByNameWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Creates a new Power BI Workspace Collection with the specified properties. + /// A Power BI Workspace Collection contains one or more workspaces, and can be + /// used to provision keys that provide API access to those workspaces. + /// + /// + /// Creates a new Power BI Workspace Collection with the specified properties. + /// A Power BI Workspace Collection contains one or more workspaces, and can be + /// used to provision keys that provide API access to those workspaces. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// Create workspace collection request + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, CreateWorkspaceCollectionRequest body, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Update an existing Power BI Workspace Collection with the specified + /// properties. + /// + /// + /// Update an existing Power BI Workspace Collection with the specified + /// properties. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// Update workspace collection request + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, UpdateWorkspaceCollectionRequest body, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a Power BI Workspace Collection. + /// + /// + /// Delete a Power BI Workspace Collection. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Verify the specified Power BI Workspace Collection name is valid and not + /// already in use. + /// + /// + /// Verify the specified Power BI Workspace Collection name is valid and not + /// already in use. + /// + /// + /// Azure location + /// + /// + /// Check name availability request + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> CheckNameAvailabilityWithHttpMessagesAsync(string location, CheckNameRequest body, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Retrieves all existing Power BI workspace collections in the specified + /// resource group. + /// + /// + /// Retrieves all existing Power BI workspace collections in the specified + /// resource group. + /// + /// + /// Azure resource group + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Retrieves all existing Power BI workspace collections in the specified + /// subscription. + /// + /// + /// Retrieves all existing Power BI workspace collections in the specified + /// subscription. + /// + /// + /// 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 + /// + System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Retrieves the primary and secondary access keys for the specified Power BI + /// Workspace Collection. + /// + /// + /// Retrieves the primary and secondary access keys for the specified Power BI + /// Workspace Collection. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection 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 + /// + System.Threading.Tasks.Task> GetAccessKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Regenerates the primary or secondary access key for the specified Power BI + /// Workspace Collection. + /// + /// + /// Regenerates the primary or secondary access key for the specified Power BI + /// Workspace Collection. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// Access key to regenerate + /// + /// + /// 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 + /// + System.Threading.Tasks.Task> RegenerateKeyWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, WorkspaceCollectionAccessKey body, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Migrates an existing Power BI Workspace Collection to a different resource + /// group and/or subscription. + /// + /// + /// Migrates an existing Power BI Workspace Collection to a different resource + /// group and/or subscription. + /// + /// + /// Azure resource group + /// + /// + /// Workspace migration request + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task MigrateWithHttpMessagesAsync(string resourceGroupName, MigrateWorkspaceCollectionRequest body, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + /// + /// Delete a Power BI Workspace Collection. + /// + /// + /// Delete a Power BI Workspace Collection. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/IWorkspacesOperations.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/IWorkspacesOperations.cs new file mode 100644 index 000000000000..c0c099869947 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/IWorkspacesOperations.cs @@ -0,0 +1,45 @@ +// 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.PowerBIEmbedded +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// WorkspacesOperations operations. + /// + public partial interface IWorkspacesOperations + { + /// + /// Retrieves all existing Power BI workspaces in the specified workspace + /// collection. + /// + /// + /// Retrieves all existing Power BI workspaces in the specified workspace + /// collection. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection 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 + /// + System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/AccessKeyName.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/AccessKeyName.cs new file mode 100644 index 000000000000..3151fed94bca --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/AccessKeyName.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.PowerBIEmbedded.Models +{ + + /// + /// Defines values for AccessKeyName. + /// + + + [Newtonsoft.Json.JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))] + public enum AccessKeyName + { + [System.Runtime.Serialization.EnumMember(Value = "key1")] + Key1, + [System.Runtime.Serialization.EnumMember(Value = "key2")] + Key2 + } + internal static class AccessKeyNameEnumExtension + { + internal static string ToSerializedValue(this AccessKeyName? value) + { + return value == null ? null : ((AccessKeyName)value).ToSerializedValue(); + } + internal static string ToSerializedValue(this AccessKeyName value) + { + switch( value ) + { + case AccessKeyName.Key1: + return "key1"; + case AccessKeyName.Key2: + return "key2"; + } + return null; + } + internal static AccessKeyName? ParseAccessKeyName(this string value) + { + switch( value ) + { + case "key1": + return AccessKeyName.Key1; + case "key2": + return AccessKeyName.Key2; + } + return null; + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/AzureSku.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/AzureSku.cs new file mode 100644 index 000000000000..5ad3acdc381d --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/AzureSku.cs @@ -0,0 +1,27 @@ +// 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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class AzureSku + { + /// + /// Initializes a new instance of the AzureSku class. + /// + public AzureSku() + { + CustomInit(); + } + + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/AzureSkuName.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/AzureSkuName.cs new file mode 100644 index 000000000000..fe6827ff56e7 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/AzureSkuName.cs @@ -0,0 +1,18 @@ +// 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.PowerBIEmbedded.Models +{ + + /// + /// Defines values for AzureSkuName. + /// + + + public static class AzureSkuName + { + public const string S1 = "S1"; + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/AzureSkuTier.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/AzureSkuTier.cs new file mode 100644 index 000000000000..7fbafbf5348b --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/AzureSkuTier.cs @@ -0,0 +1,18 @@ +// 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.PowerBIEmbedded.Models +{ + + /// + /// Defines values for AzureSkuTier. + /// + + + public static class AzureSkuTier + { + public const string Standard = "Standard"; + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/CheckNameReason.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/CheckNameReason.cs new file mode 100644 index 000000000000..012c755c3c92 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/CheckNameReason.cs @@ -0,0 +1,19 @@ +// 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.PowerBIEmbedded.Models +{ + + /// + /// Defines values for CheckNameReason. + /// + + + public static class CheckNameReason + { + public const string Unavailable = "Unavailable"; + public const string Invalid = "Invalid"; + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/CheckNameRequest.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/CheckNameRequest.cs new file mode 100644 index 000000000000..029b3ed0e38d --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/CheckNameRequest.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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class CheckNameRequest + { + /// + /// Initializes a new instance of the CheckNameRequest class. + /// + public CheckNameRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameRequest class. + /// + + /// Workspace collection name + /// + + /// Resource type + /// + public CheckNameRequest(string name = default(string), string type = default(string)) + + { + this.Name = name; + this.Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets workspace collection name + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets resource type + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/CheckNameResponse.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/CheckNameResponse.cs new file mode 100644 index 000000000000..cf3e4f1e7657 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/CheckNameResponse.cs @@ -0,0 +1,69 @@ +// 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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class CheckNameResponse + { + /// + /// Initializes a new instance of the CheckNameResponse class. + /// + public CheckNameResponse() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CheckNameResponse class. + /// + + /// Specifies a Boolean value that indicates whether the specified Power BI + /// Workspace Collection name is available to use. + /// + + /// Reason why the workspace collection name cannot be used. + /// Possible values include: 'Unavailable', 'Invalid' + + /// Message indicating an unavailable name due to a conflict, or a description + /// of the naming rules that are violated. + /// + public CheckNameResponse(bool? nameAvailable = default(bool?), string reason = default(string), string message = default(string)) + + { + this.NameAvailable = nameAvailable; + this.Reason = reason; + this.Message = message; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets specifies a Boolean value that indicates whether the specified + /// Power BI Workspace Collection name is available to use. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "nameAvailable")] + public bool? NameAvailable {get; set; } + + /// + /// Gets or sets reason why the workspace collection name cannot be used. Possible values include: 'Unavailable', 'Invalid' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "reason")] + public string Reason {get; set; } + + /// + /// Gets or sets message indicating an unavailable name due to a conflict, or a + /// description of the naming rules that are violated. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/CreateWorkspaceCollectionRequest.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/CreateWorkspaceCollectionRequest.cs new file mode 100644 index 000000000000..382cb6277748 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/CreateWorkspaceCollectionRequest.cs @@ -0,0 +1,65 @@ +// 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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class CreateWorkspaceCollectionRequest + { + /// + /// Initializes a new instance of the CreateWorkspaceCollectionRequest class. + /// + public CreateWorkspaceCollectionRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CreateWorkspaceCollectionRequest class. + /// + + /// Azure location + /// + + /// Dictionary of <string> + /// + + /// + /// + public CreateWorkspaceCollectionRequest(string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), AzureSku sku = default(AzureSku)) + + { + this.Location = location; + this.Tags = tags; + this.Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets azure location + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } + + /// + /// Gets or sets dictionary of <string> + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sku")] + public AzureSku Sku {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Display.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Display.cs new file mode 100644 index 000000000000..d43317519456 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Display.cs @@ -0,0 +1,109 @@ +// 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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class Display + { + /// + /// Initializes a new instance of the Display class. + /// + public Display() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Display class. + /// + + /// The localized friendly form of the resource provider name. This form is + /// also expected to include the publisher/company responsible. Use Title + /// Casing. Begin with “Microsoft” for 1st party services. + /// + + /// The localized friendly form of the resource type related to this + /// action/operation. This form should match the public documentation for the + /// resource provider. Use Title Casing. For examples, refer to the “name” + /// section. + /// + + /// The localized friendly name for the operation as shown to the user. This + /// name should be concise (to fit in drop downs), but clear + /// (self-documenting). Use Title Casing and include the entity/resource to + /// which it applies. + /// + + /// The localized friendly description for the operation as shown to the user. + /// This description should be thorough, yet concise. It will be used in + /// tool-tips and detailed views. + /// + + /// The intended executor of the operation; governs the display of the + /// operation in the RBAC UX and the audit logs UX. Default value is + /// 'user,system' + /// + public Display(string provider = default(string), string resource = default(string), string operation = default(string), string description = default(string), string origin = default(string)) + + { + this.Provider = provider; + this.Resource = resource; + this.Operation = operation; + this.Description = description; + this.Origin = origin; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the localized friendly form of the resource provider name. + /// This form is also expected to include the publisher/company responsible. + /// Use Title Casing. Begin with “Microsoft” for 1st party services. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "provider")] + public string Provider {get; set; } + + /// + /// Gets or sets the localized friendly form of the resource type related to + /// this action/operation. This form should match the public documentation for + /// the resource provider. Use Title Casing. For examples, refer to the “name” + /// section. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resource")] + public string Resource {get; set; } + + /// + /// Gets or sets the localized friendly name for the operation as shown to the + /// user. This name should be concise (to fit in drop downs), but clear + /// (self-documenting). Use Title Casing and include the entity/resource to + /// which it applies. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "operation")] + public string Operation {get; set; } + + /// + /// Gets or sets the localized friendly description for the operation as shown + /// to the user. This description should be thorough, yet concise. It will be + /// used in tool-tips and detailed views. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "description")] + public string Description {get; set; } + + /// + /// Gets or sets the intended executor of the operation; governs the display of + /// the operation in the RBAC UX and the audit logs UX. Default value is + /// 'user,system' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "origin")] + public string Origin {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Error.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Error.cs new file mode 100644 index 000000000000..d46603a17b1f --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Error.cs @@ -0,0 +1,75 @@ +// 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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class Error + { + /// + /// Initializes a new instance of the Error class. + /// + public Error() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Error class. + /// + + /// + /// + + /// + /// + + /// + /// + + /// + /// + public Error(string code = default(string), string message = default(string), string target = default(string), System.Collections.Generic.IList details = default(System.Collections.Generic.IList)) + + { + this.Code = code; + this.Message = message; + this.Target = target; + this.Details = details; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "target")] + public string Target {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "details")] + public System.Collections.Generic.IList Details {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/ErrorDetail.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/ErrorDetail.cs new file mode 100644 index 000000000000..d1fef3478878 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/ErrorDetail.cs @@ -0,0 +1,65 @@ +// 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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class ErrorDetail + { + /// + /// Initializes a new instance of the ErrorDetail class. + /// + public ErrorDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ErrorDetail class. + /// + + /// + /// + + /// + /// + + /// + /// + public ErrorDetail(string code = default(string), string message = default(string), string target = default(string)) + + { + this.Code = code; + this.Message = message; + this.Target = target; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "code")] + public string Code {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "message")] + public string Message {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "target")] + public string Target {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/ErrorException.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/ErrorException.cs new file mode 100644 index 000000000000..efcbf60df5f0 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/ErrorException.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.PowerBIEmbedded.Models +{ + + /// + /// Exception thrown for an invalid response with Error information. + /// + public partial class ErrorException : Microsoft.Rest.RestException + { + /// + /// Gets information about the associated HTTP request. + /// + public Microsoft.Rest.HttpRequestMessageWrapper Request { get; set; } + + /// + /// Gets information about the associated HTTP response. + /// + public Microsoft.Rest.HttpResponseMessageWrapper Response { get; set; } + + /// + /// Gets or sets the body object. + /// + public Error Body { get; set; } + + /// + /// Initializes a new instance of the ErrorException class. + /// + public ErrorException() + { + } + + /// + /// Initializes a new instance of the Error class. + /// + /// The exception message. + public ErrorException(string message) + : this(message, null) + { + } + + /// + /// Initializes a new instance of the Error class. + /// + /// The exception message. + /// Inner exception. + public ErrorException(string message, System.Exception innerException) + : base(message, innerException) + { + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/MigrateWorkspaceCollectionRequest.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/MigrateWorkspaceCollectionRequest.cs new file mode 100644 index 000000000000..0ab4eb90b2a7 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/MigrateWorkspaceCollectionRequest.cs @@ -0,0 +1,57 @@ +// 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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class MigrateWorkspaceCollectionRequest + { + /// + /// Initializes a new instance of the MigrateWorkspaceCollectionRequest class. + /// + public MigrateWorkspaceCollectionRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the MigrateWorkspaceCollectionRequest class. + /// + + /// Name of the resource group the Power BI workspace collections will be + /// migrated to. + /// + + /// + /// + public MigrateWorkspaceCollectionRequest(string targetResourceGroup = default(string), System.Collections.Generic.IList resources = default(System.Collections.Generic.IList)) + + { + this.TargetResourceGroup = targetResourceGroup; + this.Resources = resources; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets name of the resource group the Power BI workspace collections + /// will be migrated to. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "targetResourceGroup")] + public string TargetResourceGroup {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "resources")] + public System.Collections.Generic.IList Resources {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Operation.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Operation.cs new file mode 100644 index 000000000000..b876dee4bf13 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Operation.cs @@ -0,0 +1,58 @@ +// 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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class Operation + { + /// + /// Initializes a new instance of the Operation class. + /// + public Operation() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Operation class. + /// + + /// The name of the operation being performed on this particular object. This + /// name should match the action name that appears in RBAC / the event service. + /// + + /// + /// + public Operation(string name = default(string), Display display = default(Display)) + + { + this.Name = name; + this.Display = display; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the name of the operation being performed on this particular + /// object. This name should match the action name that appears in RBAC / the + /// event service. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "display")] + public Display Display {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/OperationList.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/OperationList.cs new file mode 100644 index 000000000000..f4ea44ba7904 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/OperationList.cs @@ -0,0 +1,45 @@ +// 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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class OperationList + { + /// + /// Initializes a new instance of the OperationList class. + /// + public OperationList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the OperationList class. + /// + + /// + /// + public OperationList(System.Collections.Generic.IList value = default(System.Collections.Generic.IList)) + + { + this.Value = value; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "value")] + public System.Collections.Generic.IList Value {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Page.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Page.cs new file mode 100644 index 000000000000..7df0e73520e6 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Page.cs @@ -0,0 +1,43 @@ +// 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.PowerBIEmbedded.Models +{ + + /// + /// Defines a page in Azure responses. + /// + /// Type of the page content items + [Newtonsoft.Json.JsonObject] + public class Page : Microsoft.Rest.Azure.IPage + { + /// + /// Gets the link to the next page. + /// + [Newtonsoft.Json.JsonProperty("")] + public System.String NextPageLink { get; private set; } + + [Newtonsoft.Json.JsonProperty("value")] + private System.Collections.Generic.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 System.Collections.Generic.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. + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/UpdateWorkspaceCollectionRequest.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/UpdateWorkspaceCollectionRequest.cs new file mode 100644 index 000000000000..7c7a8c49ff61 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/UpdateWorkspaceCollectionRequest.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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class UpdateWorkspaceCollectionRequest + { + /// + /// Initializes a new instance of the UpdateWorkspaceCollectionRequest class. + /// + public UpdateWorkspaceCollectionRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateWorkspaceCollectionRequest class. + /// + + /// Dictionary of <string> + /// + + /// + /// + public UpdateWorkspaceCollectionRequest(System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), AzureSku sku = default(AzureSku)) + + { + this.Tags = tags; + this.Sku = sku; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets dictionary of <string> + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sku")] + public AzureSku Sku {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Workspace.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Workspace.cs new file mode 100644 index 000000000000..ff8b6446a3e5 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/Workspace.cs @@ -0,0 +1,75 @@ +// 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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class Workspace + { + /// + /// Initializes a new instance of the Workspace class. + /// + public Workspace() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the Workspace class. + /// + + /// Workspace id + /// + + /// Workspace name + /// + + /// Resource type + /// + + /// Property bag + /// + public Workspace(string id = default(string), string name = default(string), string type = default(string), object properties = default(object)) + + { + this.Id = id; + this.Name = name; + this.Type = type; + this.Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets workspace id + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } + + /// + /// Gets or sets workspace name + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets resource type + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; set; } + + /// + /// Gets or sets property bag + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + public object Properties {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/WorkspaceCollection.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/WorkspaceCollection.cs new file mode 100644 index 000000000000..eb8f9f15042c --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/WorkspaceCollection.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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class WorkspaceCollection + { + /// + /// Initializes a new instance of the WorkspaceCollection class. + /// + public WorkspaceCollection() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkspaceCollection class. + /// + + /// Resource id + /// + + /// Workspace collection name + /// + + /// Resource type + /// + + /// Azure location + /// + + /// Dictionary of <string> + /// + + /// + /// + + /// Properties + /// + public WorkspaceCollection(string id = default(string), string name = default(string), string type = default(string), string location = default(string), System.Collections.Generic.IDictionary tags = default(System.Collections.Generic.IDictionary), AzureSku sku = default(AzureSku), object properties = default(object)) + + { + this.Id = id; + this.Name = name; + this.Type = type; + this.Location = location; + this.Tags = tags; + this.Sku = sku; + this.Properties = properties; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets resource id + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "id")] + public string Id {get; set; } + + /// + /// Gets or sets workspace collection name + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "name")] + public string Name {get; set; } + + /// + /// Gets or sets resource type + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "type")] + public string Type {get; set; } + + /// + /// Gets or sets azure location + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "location")] + public string Location {get; set; } + + /// + /// Gets or sets dictionary of <string> + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "tags")] + public System.Collections.Generic.IDictionary Tags {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "sku")] + public AzureSku Sku {get; set; } + + /// + /// Gets or sets properties + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties")] + public object Properties {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/WorkspaceCollectionAccessKey.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/WorkspaceCollectionAccessKey.cs new file mode 100644 index 000000000000..871c150166a0 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/WorkspaceCollectionAccessKey.cs @@ -0,0 +1,45 @@ +// 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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class WorkspaceCollectionAccessKey + { + /// + /// Initializes a new instance of the WorkspaceCollectionAccessKey class. + /// + public WorkspaceCollectionAccessKey() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkspaceCollectionAccessKey class. + /// + + /// Key name + /// Possible values include: 'key1', 'key2' + public WorkspaceCollectionAccessKey(AccessKeyName? keyName = default(AccessKeyName?)) + + { + this.KeyName = keyName; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets key name Possible values include: 'key1', 'key2' + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "keyName")] + public AccessKeyName? KeyName {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/WorkspaceCollectionAccessKeys.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/WorkspaceCollectionAccessKeys.cs new file mode 100644 index 000000000000..b93a17ddb71c --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/Models/WorkspaceCollectionAccessKeys.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.PowerBIEmbedded.Models +{ + using System.Linq; + + public partial class WorkspaceCollectionAccessKeys + { + /// + /// Initializes a new instance of the WorkspaceCollectionAccessKeys class. + /// + public WorkspaceCollectionAccessKeys() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the WorkspaceCollectionAccessKeys class. + /// + + /// Access key 1 + /// + + /// Access key 2 + /// + public WorkspaceCollectionAccessKeys(string key1 = default(string), string key2 = default(string)) + + { + this.Key1 = key1; + this.Key2 = key2; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets access key 1 + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "key1")] + public string Key1 {get; set; } + + /// + /// Gets or sets access key 2 + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "key2")] + public string Key2 {get; set; } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/PowerBIEmbeddedManagementClient.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/PowerBIEmbeddedManagementClient.cs new file mode 100644 index 000000000000..08a49524f79c --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/PowerBIEmbeddedManagementClient.cs @@ -0,0 +1,528 @@ +// 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.PowerBIEmbedded +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// Client to manage your Power BI Embedded workspace collections and retrieve + /// workspaces. + /// + public partial class PowerBIEmbeddedManagementClient : Microsoft.Rest.ServiceClient, IPowerBIEmbeddedManagementClient, IAzureClient + { + /// + /// The base URI of the service. + /// + public System.Uri BaseUri { get; set; } + /// + /// Gets or sets json serialization settings. + /// + public Newtonsoft.Json.JsonSerializerSettings SerializationSettings { get; private set; } + /// + /// Gets or sets json deserialization settings. + /// + public Newtonsoft.Json.JsonSerializerSettings DeserializationSettings { get; private set; } + /// + /// Credentials needed for the client to connect to Azure. + /// + public Microsoft.Rest.ServiceClientCredentials Credentials { get; private set; } + + /// + /// The API version to use for this operation. + /// + public string ApiVersion { get; private set; } + + /// + /// Gets subscription credentials which uniquely identify a Microsoft Azure + /// subscription. The subscription ID forms part of the URI for every service + /// call. + /// + public string SubscriptionId { get; set;} + + /// + /// The preferred language for the response. + /// + public string AcceptLanguage { get; set;} + + /// + /// The retry timeout in seconds for Long Running Operations. Default + /// /// value is 30. + /// + public int? LongRunningOperationRetryTimeout { get; set;} + + /// + /// Whether a unique x-ms-client-request-id should be generated. When + /// /// set to true a unique x-ms-client-request-id value is generated and + /// /// included in each request. Default is true. + /// + public bool? GenerateClientRequestId { get; set;} + + /// + /// Gets the IWorkspaceCollectionsOperations + /// + public virtual IWorkspaceCollectionsOperations WorkspaceCollections { get; private set; } + /// + /// Gets the IWorkspacesOperations + /// + public virtual IWorkspacesOperations Workspaces { get; private set; } + /// + /// Initializes a new instance of the PowerBIEmbeddedManagementClient class. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling PowerBIEmbeddedManagementClient.Dispose(). False: will not dispose provided httpClient + protected PowerBIEmbeddedManagementClient(System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the PowerBIEmbeddedManagementClient class. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected PowerBIEmbeddedManagementClient(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the PowerBIEmbeddedManagementClient class. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + protected PowerBIEmbeddedManagementClient(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers) + { + this.Initialize(); + } + /// + /// Initializes a new instance of the PowerBIEmbeddedManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected PowerBIEmbeddedManagementClient(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + this.BaseUri = baseUri; + } + /// + /// Initializes a new instance of the PowerBIEmbeddedManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + protected PowerBIEmbeddedManagementClient(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + + this.BaseUri = baseUri; + } + /// + /// Initializes a new instance of the PowerBIEmbeddedManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public PowerBIEmbeddedManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the PowerBIEmbeddedManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// HttpClient to be used + /// + /// + /// True: will dispose the provided httpClient on calling PowerBIEmbeddedManagementClient.Dispose(). False: will not dispose provided httpClient + /// + /// Thrown when a required parameter is null + /// + public PowerBIEmbeddedManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the PowerBIEmbeddedManagementClient class. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public PowerBIEmbeddedManagementClient(Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the PowerBIEmbeddedManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The delegating handlers to add to the http client pipeline. + /// + /// + /// Thrown when a required parameter is null + /// + public PowerBIEmbeddedManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// Initializes a new instance of the PowerBIEmbeddedManagementClient class. + /// + /// + /// Optional. The base URI of the service. + /// + /// + /// Required. Credentials needed for the client to connect to Azure. + /// + /// + /// Optional. The http client handler used to handle http transport. + /// + /// + /// Thrown when a required parameter is null + /// + public PowerBIEmbeddedManagementClient(System.Uri baseUri, Microsoft.Rest.ServiceClientCredentials credentials, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers) + { + if (baseUri == null) + { + throw new System.ArgumentNullException("baseUri"); + } + if (credentials == null) + { + throw new System.ArgumentNullException("credentials"); + } + this.BaseUri = baseUri; + this.Credentials = credentials; + if (this.Credentials != null) + { + this.Credentials.InitializeServiceClient(this); + } + + } + /// + /// An optional partial-method to perform custom initialization. + /// + partial void CustomInitialize(); + + /// + /// Initializes client properties. + /// + private void Initialize() + { + this.WorkspaceCollections = new WorkspaceCollectionsOperations(this); + this.Workspaces = new WorkspacesOperations(this); + this.BaseUri = new System.Uri("https://management.azure.com"); + this.ApiVersion = "2016-01-29"; + this.AcceptLanguage = "en-US"; + this.LongRunningOperationRetryTimeout = 30; + this.GenerateClientRequestId = true; + SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings + { + Formatting = Newtonsoft.Json.Formatting.Indented, + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List + { + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() + } + }; + DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings + { + DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, + DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, + NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, + ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(), + Converters = new System.Collections.Generic.List + { + new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter() + } + }; + CustomInitialize(); + DeserializationSettings.Converters.Add(new Microsoft.Rest.Azure.CloudErrorJsonConverter()); + } + /// + /// Indicates which operations can be performed by the Power BI Resource + /// Provider. + /// + /// + /// 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 System.Threading.Tasks.Task> GetAvailableOperationsWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetAvailableOperations", tracingParameters); + } + // Construct URL + + var _baseUrl = this.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.PowerBI/operations").ToString(); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.GenerateClientRequestId != null && this.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/PowerBIEmbeddedManagementClientExtensions.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/PowerBIEmbeddedManagementClientExtensions.cs new file mode 100644 index 000000000000..5d6836ebb5a8 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/PowerBIEmbeddedManagementClientExtensions.cs @@ -0,0 +1,45 @@ +// 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.PowerBIEmbedded +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for PowerBIEmbeddedManagementClient + /// + public static partial class PowerBIEmbeddedManagementClientExtensions + { + /// + /// Indicates which operations can be performed by the Power BI Resource + /// Provider. + /// + /// + /// The operations group for this extension method. + /// + public static OperationList GetAvailableOperations(this IPowerBIEmbeddedManagementClient operations) + { + return ((IPowerBIEmbeddedManagementClient)operations).GetAvailableOperationsAsync().GetAwaiter().GetResult(); + } + + /// + /// Indicates which operations can be performed by the Power BI Resource + /// Provider. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAvailableOperationsAsync(this IPowerBIEmbeddedManagementClient operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetAvailableOperationsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/WorkspaceCollectionsOperations.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/WorkspaceCollectionsOperations.cs new file mode 100644 index 000000000000..aedbd4d7a661 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/WorkspaceCollectionsOperations.cs @@ -0,0 +1,2135 @@ +// 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.PowerBIEmbedded +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// WorkspaceCollectionsOperations operations. + /// + internal partial class WorkspaceCollectionsOperations : Microsoft.Rest.IServiceOperations, IWorkspaceCollectionsOperations + { + /// + /// Initializes a new instance of the WorkspaceCollectionsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkspaceCollectionsOperations (PowerBIEmbeddedManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the PowerBIEmbeddedManagementClient + /// + public PowerBIEmbeddedManagementClient Client { get; private set; } + + /// + /// Retrieves an existing Power BI Workspace Collection. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection 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 System.Threading.Tasks.Task> GetByNameWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (workspaceCollectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceCollectionName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceCollectionName", workspaceCollectionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetByName", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Creates a new Power BI Workspace Collection with the specified properties. + /// A Power BI Workspace Collection contains one or more workspaces, and can be + /// used to provision keys that provide API access to those workspaces. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// Create workspace collection request + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, CreateWorkspaceCollectionRequest body, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (body == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "body"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (workspaceCollectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceCollectionName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceCollectionName", workspaceCollectionName); + + tracingParameters.Add("body", body); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PUT"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Update an existing Power BI Workspace Collection with the specified + /// properties. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// Update workspace collection request + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, UpdateWorkspaceCollectionRequest body, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (body == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "body"); + } + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (workspaceCollectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceCollectionName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceCollectionName", workspaceCollectionName); + + tracingParameters.Add("body", body); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete a Power BI Workspace Collection. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + + /// + /// Verify the specified Power BI Workspace Collection name is valid and not + /// already in use. + /// + /// + /// Azure location + /// + /// + /// Check name availability request + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async System.Threading.Tasks.Task> CheckNameAvailabilityWithHttpMessagesAsync(string location, CheckNameRequest body, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (body == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "body"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (location == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "location"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("location", location); + + tracingParameters.Add("body", body); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/locations/{location}/checkNameAvailability").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{location}", System.Uri.EscapeDataString(location)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Retrieves all existing Power BI workspace collections in the specified + /// resource group. + /// + /// + /// Azure resource group + /// + /// + /// 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 System.Threading.Tasks.Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Retrieves all existing Power BI workspace collections in the specified + /// subscription. + /// + /// + /// 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 System.Threading.Tasks.Task>> ListBySubscriptionWithHttpMessagesAsync(System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/providers/Microsoft.PowerBI/workspaceCollections").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Retrieves the primary and secondary access keys for the specified Power BI + /// Workspace Collection. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection 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 System.Threading.Tasks.Task> GetAccessKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (workspaceCollectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceCollectionName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceCollectionName", workspaceCollectionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "GetAccessKeys", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}/listKeys").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Regenerates the primary or secondary access key for the specified Power BI + /// Workspace Collection. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// Access key to regenerate + /// + /// + /// 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 System.Threading.Tasks.Task> RegenerateKeyWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, WorkspaceCollectionAccessKey body, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (body == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "body"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (workspaceCollectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceCollectionName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceCollectionName", workspaceCollectionName); + + tracingParameters.Add("body", body); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "RegenerateKey", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}/regenerateKey").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Migrates an existing Power BI Workspace Collection to a different resource + /// group and/or subscription. + /// + /// + /// Azure resource group + /// + /// + /// Workspace migration request + /// + /// + /// 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 System.Threading.Tasks.Task MigrateWithHttpMessagesAsync(string resourceGroupName, MigrateWorkspaceCollectionRequest body, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (body == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "body"); + } + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + + tracingParameters.Add("body", body); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Migrate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/moveResources").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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(body != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(body, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + /// + /// Delete a Power BI Workspace Collection. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection 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 System.Threading.Tasks.Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (workspaceCollectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceCollectionName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceCollectionName", workspaceCollectionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("DELETE"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 202) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/WorkspaceCollectionsOperationsExtensions.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/WorkspaceCollectionsOperationsExtensions.cs new file mode 100644 index 000000000000..d861a66342da --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/WorkspaceCollectionsOperationsExtensions.cs @@ -0,0 +1,424 @@ +// 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.PowerBIEmbedded +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for WorkspaceCollectionsOperations + /// + public static partial class WorkspaceCollectionsOperationsExtensions + { + /// + /// Retrieves an existing Power BI Workspace Collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + public static WorkspaceCollection GetByName(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName) + { + return ((IWorkspaceCollectionsOperations)operations).GetByNameAsync(resourceGroupName, workspaceCollectionName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves an existing Power BI Workspace Collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetByNameAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetByNameWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Creates a new Power BI Workspace Collection with the specified properties. + /// A Power BI Workspace Collection contains one or more workspaces, and can be + /// used to provision keys that provide API access to those workspaces. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + public static WorkspaceCollection Create(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, CreateWorkspaceCollectionRequest body) + { + return ((IWorkspaceCollectionsOperations)operations).CreateAsync(resourceGroupName, workspaceCollectionName, body).GetAwaiter().GetResult(); + } + + /// + /// Creates a new Power BI Workspace Collection with the specified properties. + /// A Power BI Workspace Collection contains one or more workspaces, and can be + /// used to provision keys that provide API access to those workspaces. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CreateAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, CreateWorkspaceCollectionRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Update an existing Power BI Workspace Collection with the specified + /// properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + public static WorkspaceCollection Update(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, UpdateWorkspaceCollectionRequest body) + { + return ((IWorkspaceCollectionsOperations)operations).UpdateAsync(resourceGroupName, workspaceCollectionName, body).GetAwaiter().GetResult(); + } + + /// + /// Update an existing Power BI Workspace Collection with the specified + /// properties. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, UpdateWorkspaceCollectionRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Delete a Power BI Workspace Collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + public static void Delete(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName) + { + ((IWorkspaceCollectionsOperations)operations).DeleteAsync(resourceGroupName, workspaceCollectionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a Power BI Workspace Collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task DeleteAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.DeleteWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Verify the specified Power BI Workspace Collection name is valid and not + /// already in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure location + /// + public static CheckNameResponse CheckNameAvailability(this IWorkspaceCollectionsOperations operations, string location, CheckNameRequest body) + { + return ((IWorkspaceCollectionsOperations)operations).CheckNameAvailabilityAsync(location, body).GetAwaiter().GetResult(); + } + + /// + /// Verify the specified Power BI Workspace Collection name is valid and not + /// already in use. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure location + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task CheckNameAvailabilityAsync(this IWorkspaceCollectionsOperations operations, string location, CheckNameRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(location, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Retrieves all existing Power BI workspace collections in the specified + /// resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + public static System.Collections.Generic.IEnumerable ListByResourceGroup(this IWorkspaceCollectionsOperations operations, string resourceGroupName) + { + return ((IWorkspaceCollectionsOperations)operations).ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all existing Power BI workspace collections in the specified + /// resource group. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListByResourceGroupAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListByResourceGroupWithHttpMessagesAsync(resourceGroupName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Retrieves all existing Power BI workspace collections in the specified + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + public static System.Collections.Generic.IEnumerable ListBySubscription(this IWorkspaceCollectionsOperations operations) + { + return ((IWorkspaceCollectionsOperations)operations).ListBySubscriptionAsync().GetAwaiter().GetResult(); + } + + /// + /// Retrieves all existing Power BI workspace collections in the specified + /// subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListBySubscriptionAsync(this IWorkspaceCollectionsOperations operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListBySubscriptionWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Retrieves the primary and secondary access keys for the specified Power BI + /// Workspace Collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + public static WorkspaceCollectionAccessKeys GetAccessKeys(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName) + { + return ((IWorkspaceCollectionsOperations)operations).GetAccessKeysAsync(resourceGroupName, workspaceCollectionName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves the primary and secondary access keys for the specified Power BI + /// Workspace Collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task GetAccessKeysAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.GetAccessKeysWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Regenerates the primary or secondary access key for the specified Power BI + /// Workspace Collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + public static WorkspaceCollectionAccessKeys RegenerateKey(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, WorkspaceCollectionAccessKey body) + { + return ((IWorkspaceCollectionsOperations)operations).RegenerateKeyAsync(resourceGroupName, workspaceCollectionName, body).GetAwaiter().GetResult(); + } + + /// + /// Regenerates the primary or secondary access key for the specified Power BI + /// Workspace Collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task RegenerateKeyAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, WorkspaceCollectionAccessKey body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.RegenerateKeyWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, body, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// + /// Migrates an existing Power BI Workspace Collection to a different resource + /// group and/or subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + public static void Migrate(this IWorkspaceCollectionsOperations operations, string resourceGroupName, MigrateWorkspaceCollectionRequest body) + { + ((IWorkspaceCollectionsOperations)operations).MigrateAsync(resourceGroupName, body).GetAwaiter().GetResult(); + } + + /// + /// Migrates an existing Power BI Workspace Collection to a different resource + /// group and/or subscription. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task MigrateAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, MigrateWorkspaceCollectionRequest body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.MigrateWithHttpMessagesAsync(resourceGroupName, body, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// + /// Delete a Power BI Workspace Collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + public static void BeginDelete(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName) + { + ((IWorkspaceCollectionsOperations)operations).BeginDeleteAsync(resourceGroupName, workspaceCollectionName).GetAwaiter().GetResult(); + } + + /// + /// Delete a Power BI Workspace Collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginDeleteAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + } +} diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/WorkspacesOperations.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/WorkspacesOperations.cs new file mode 100644 index 000000000000..06a14911f9bb --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/WorkspacesOperations.cs @@ -0,0 +1,251 @@ +// 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.PowerBIEmbedded +{ + using System.Linq; + using Microsoft.Rest; + using Microsoft.Rest.Azure; + using Models; + + /// + /// WorkspacesOperations operations. + /// + internal partial class WorkspacesOperations : Microsoft.Rest.IServiceOperations, IWorkspacesOperations + { + /// + /// Initializes a new instance of the WorkspacesOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + internal WorkspacesOperations (PowerBIEmbeddedManagementClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + this.Client = client; + } + + /// + /// Gets a reference to the PowerBIEmbeddedManagementClient + /// + public PowerBIEmbeddedManagementClient Client { get; private set; } + + /// + /// Retrieves all existing Power BI workspaces in the specified workspace + /// collection. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection 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 System.Threading.Tasks.Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.SubscriptionId == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.SubscriptionId"); + } + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + + if (workspaceCollectionName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "workspaceCollectionName"); + } + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("workspaceCollectionName", workspaceCollectionName); + + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}/workspaces").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(this.Client.SubscriptionId)); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("GET"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.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 (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200) + { + var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + Error _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + + } + } +} \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/WorkspacesOperationsExtensions.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/WorkspacesOperationsExtensions.cs new file mode 100644 index 000000000000..b77425b76938 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Generated/WorkspacesOperationsExtensions.cs @@ -0,0 +1,57 @@ +// 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.PowerBIEmbedded +{ + using Microsoft.Rest.Azure; + using Models; + + /// + /// Extension methods for WorkspacesOperations + /// + public static partial class WorkspacesOperationsExtensions + { + /// + /// Retrieves all existing Power BI workspaces in the specified workspace + /// collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + public static System.Collections.Generic.IEnumerable List(this IWorkspacesOperations operations, string resourceGroupName, string workspaceCollectionName) + { + return ((IWorkspacesOperations)operations).ListAsync(resourceGroupName, workspaceCollectionName).GetAwaiter().GetResult(); + } + + /// + /// Retrieves all existing Power BI workspaces in the specified workspace + /// collection. + /// + /// + /// The operations group for this extension method. + /// + /// + /// Azure resource group + /// + /// + /// Power BI Embedded Workspace Collection name + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task> ListAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceCollectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } +} diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/PowerBIEmbedded.Management.Sdk.csproj b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/PowerBIEmbedded.Management.Sdk.csproj new file mode 100644 index 000000000000..9042ebe87949 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/PowerBIEmbedded.Management.Sdk.csproj @@ -0,0 +1,13 @@ + + + PowerBIEmbedded + + + + netstandard2.0 + Microsoft.Azure.PowerShell.PowerBIEmbedded.Management.Sdk + Microsoft.Azure.Management.PowerBIEmbedded + $(NoWarn);CS0108;CS1573 + + + \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Properties/AssemblyInfo.cs b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..468033f1db80 --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/Properties/AssemblyInfo.cs @@ -0,0 +1,29 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using System; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Microsoft Azure Powershell - Power BI Embedded Management SDK")] +[assembly: AssemblyCompany(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCompany)] +[assembly: AssemblyProduct(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyProduct)] +[assembly: AssemblyCopyright(Microsoft.WindowsAzure.Commands.Common.AzurePowerShell.AssemblyCopyright)] + +[assembly: ComVisible(false)] +[assembly: CLSCompliant(false)] + +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.1.0.0")] \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/README.md b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/README.md new file mode 100644 index 000000000000..ebcc6633f99d --- /dev/null +++ b/src/PowerBIEmbedded/PowerBIEmbedded.Management.Sdk/README.md @@ -0,0 +1,35 @@ +# Overall +This directory contains PowerBI Embedded management plane service clients of Az.PowerBIEmbedded module. + +## Run Generation +In this directory, run AutoRest: +``` +autorest --reset +autorest --use:@autorest/powershell@4.x +``` + +### AutoRest Configuration +> see https://aka.ms/autorest +``` yaml +isSdkGenerator: true +powershell: true +clear-output-folder: true +reflect-api-versions: true +openapi-type: arm +azure-arm: true +license-header: MICROSOFT_MIT_NO_VERSION +title: PowerBIEmbeddedManagementClient +``` + + + +### +``` yaml +commit: d2bb2feadd0deb1c7212706aa65cab2f56adccc7 +input-file: + - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/powerbiembedded/resource-manager/Microsoft.PowerBI/stable/2016-01-29/powerbiembedded.json + +output-folder: Generated + +namespace: Microsoft.Azure.Management.PowerBIEmbedded +``` \ No newline at end of file diff --git a/src/PowerBIEmbedded/PowerBIEmbedded.sln b/src/PowerBIEmbedded/PowerBIEmbedded.sln index 352fd724891d..9610ca097762 100644 --- a/src/PowerBIEmbedded/PowerBIEmbedded.sln +++ b/src/PowerBIEmbedded/PowerBIEmbedded.sln @@ -5,38 +5,39 @@ VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Accounts", "Accounts", "{65142181-54A9-4908-8624-9951869B4997}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{53DC6945-8393-4423-8DA0-695CFCAAD531}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Accounts", "..\Accounts\Accounts\Accounts.csproj", "{53DC6945-8393-4423-8DA0-695CFCAAD531}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{66A761BE-AEDF-4725-A510-20D8F4114B25}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyLoading", "..\Accounts\AssemblyLoading\AssemblyLoading.csproj", "{66A761BE-AEDF-4725-A510-20D8F4114B25}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{5DCFDE72-BE29-4EE7-A713-BD32CA274FE6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication.ResourceManager", "..\Accounts\Authentication.ResourceManager\Authentication.ResourceManager.csproj", "{5DCFDE72-BE29-4EE7-A713-BD32CA274FE6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{ADB8B07E-E657-41E0-8B69-9EA657A016A6}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authentication", "..\Accounts\Authentication\Authentication.csproj", "{ADB8B07E-E657-41E0-8B69-9EA657A016A6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{3644A074-9F7D-4196-94ED-33A947A7D1C7}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AuthenticationAssemblyLoadContext", "..\Accounts\AuthenticationAssemblyLoadContext\AuthenticationAssemblyLoadContext.csproj", "{3644A074-9F7D-4196-94ED-33A947A7D1C7}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{C1FC9720-3FBD-4F61-BFC0-2D3ED1B8093A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Authenticators", "..\Accounts\Authenticators\Authenticators.csproj", "{C1FC9720-3FBD-4F61-BFC0-2D3ED1B8093A}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test", "Test", "{63A63F4C-005D-46B1-97B2-BA1CF29B6A15}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerBI.Test", "PowerBI.Test\PowerBI.Test.csproj", "{F7312B0E-ECFC-4C2B-BA34-800F7452866D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerBI.Test", "PowerBI.Test\PowerBI.Test.csproj", "{F7312B0E-ECFC-4C2B-BA34-800F7452866D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerBI", "PowerBI\PowerBI.csproj", "{7FDA4392-6FB3-408D-A3DD-873AC69C0161}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerBI", "PowerBI\PowerBI.csproj", "{7FDA4392-6FB3-408D-A3DD-873AC69C0161}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerBIEmbedded.Test", "PowerBIEmbedded.Test\PowerBIEmbedded.Test.csproj", "{930D677A-D08F-4223-A977-80C7F0E589FD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerBIEmbedded.Test", "PowerBIEmbedded.Test\PowerBIEmbedded.Test.csproj", "{930D677A-D08F-4223-A977-80C7F0E589FD}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PowerBIEmbedded", "PowerBIEmbedded\PowerBIEmbedded.csproj", "{49278376-BF51-4280-9050-E925AEBC5B40}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerBIEmbedded", "PowerBIEmbedded\PowerBIEmbedded.csproj", "{49278376-BF51-4280-9050-E925AEBC5B40}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{300C47B5-2E1E-4676-8DD4-3E9C3660AED8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFx", "..\..\tools\TestFx\TestFx.csproj", "{300C47B5-2E1E-4676-8DD4-3E9C3660AED8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerBIEmbedded.Management.Sdk", "PowerBIEmbedded.Management.Sdk\PowerBIEmbedded.Management.Sdk.csproj", "{600B336F-4D21-4264-AD1A-1BD8C75ECDE2}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PowerBIDedicated.Management.Sdk", "PowerBIDedicated.Management.Sdk\PowerBIDedicated.Management.Sdk.csproj", "{C725AC88-2EFC-4D8D-A3B3-ABA09B58C1B8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {53DC6945-8393-4423-8DA0-695CFCAAD531}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {53DC6945-8393-4423-8DA0-695CFCAAD531}.Debug|Any CPU.Build.0 = Debug|Any CPU @@ -82,6 +83,17 @@ Global {300C47B5-2E1E-4676-8DD4-3E9C3660AED8}.Debug|Any CPU.Build.0 = Debug|Any CPU {300C47B5-2E1E-4676-8DD4-3E9C3660AED8}.Release|Any CPU.ActiveCfg = Release|Any CPU {300C47B5-2E1E-4676-8DD4-3E9C3660AED8}.Release|Any CPU.Build.0 = Release|Any CPU + {600B336F-4D21-4264-AD1A-1BD8C75ECDE2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {600B336F-4D21-4264-AD1A-1BD8C75ECDE2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {600B336F-4D21-4264-AD1A-1BD8C75ECDE2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {600B336F-4D21-4264-AD1A-1BD8C75ECDE2}.Release|Any CPU.Build.0 = Release|Any CPU + {C725AC88-2EFC-4D8D-A3B3-ABA09B58C1B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C725AC88-2EFC-4D8D-A3B3-ABA09B58C1B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C725AC88-2EFC-4D8D-A3B3-ABA09B58C1B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C725AC88-2EFC-4D8D-A3B3-ABA09B58C1B8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {53DC6945-8393-4423-8DA0-695CFCAAD531} = {65142181-54A9-4908-8624-9951869B4997} diff --git a/src/PowerBIEmbedded/PowerBIEmbedded/Az.PowerBIEmbedded.psd1 b/src/PowerBIEmbedded/PowerBIEmbedded/Az.PowerBIEmbedded.psd1 index d4d98ccb28ba..e77b692c8844 100644 --- a/src/PowerBIEmbedded/PowerBIEmbedded/Az.PowerBIEmbedded.psd1 +++ b/src/PowerBIEmbedded/PowerBIEmbedded/Az.PowerBIEmbedded.psd1 @@ -56,8 +56,8 @@ DotNetFrameworkVersion = '4.7.2' RequiredModules = @(@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.13.2'; }) # Assemblies that must be loaded prior to importing this module -RequiredAssemblies = 'Microsoft.Azure.Management.PowerBIDedicated.dll', - 'Microsoft.Azure.Management.PowerBIEmbedded.dll' +RequiredAssemblies = 'Microsoft.Azure.PowerShell.PowerBIDedicated.Management.Sdk.dll', + 'Microsoft.Azure.PowerShell.PowerBIEmbedded.Management.Sdk.dll' # Script files (.ps1) that are run in the caller's environment prior to importing this module. ScriptsToProcess = @() diff --git a/src/PowerBIEmbedded/PowerBIEmbedded/ChangeLog.md b/src/PowerBIEmbedded/PowerBIEmbedded/ChangeLog.md index 7bf562ff533f..6ce6e78ba25d 100644 --- a/src/PowerBIEmbedded/PowerBIEmbedded/ChangeLog.md +++ b/src/PowerBIEmbedded/PowerBIEmbedded/ChangeLog.md @@ -18,6 +18,8 @@ - Additional information about change #1 --> ## Upcoming Release +* Removed "Microsoft.Azure.Management.PowerBIEmbedded" Version "1.1.1-preview" PackageReference +* Removed "Microsoft.Azure.Management.PowerBIDedicated" Version "0.11.0-preview" PackageReference ## Version 2.0.0 * Removed deprecated workspace collection cmdlets diff --git a/src/PowerBIEmbedded/PowerBIEmbedded/PowerBIEmbedded.csproj b/src/PowerBIEmbedded/PowerBIEmbedded/PowerBIEmbedded.csproj index cf544f41275a..893ab041b7f6 100644 --- a/src/PowerBIEmbedded/PowerBIEmbedded/PowerBIEmbedded.csproj +++ b/src/PowerBIEmbedded/PowerBIEmbedded/PowerBIEmbedded.csproj @@ -10,10 +10,10 @@ $(LegacyAssemblyPrefix)Management.$(PsModuleName) + + - + - -