diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/IPowerBIEmbeddedManagementClient.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/IPowerBIEmbeddedManagementClient.cs
new file mode 100644
index 000000000000..88d97ae56e31
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/IPowerBIEmbeddedManagementClient.cs
@@ -0,0 +1,102 @@
+//
+// 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;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// 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.
+ ///
+ JsonSerializerSettings SerializationSettings { get; }
+
+ ///
+ /// Gets or sets json deserialization settings.
+ ///
+ JsonSerializerSettings DeserializationSettings { get; }
+
+ ///
+ /// Credentials needed for the client to connect to Azure.
+ ///
+ ServiceClientCredentials Credentials { 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; }
+
+ ///
+ /// Client Api Version.
+ ///
+ string ApiVersion { get; }
+
+ ///
+ /// 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.
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ Task> GetAvailableOperationsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/IWorkspaceCollectionsOperations.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/IWorkspaceCollectionsOperations.cs
new file mode 100644
index 000000000000..8a98592741f0
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/IWorkspaceCollectionsOperations.cs
@@ -0,0 +1,310 @@
+//
+// 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;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// WorkspaceCollectionsOperations operations.
+ ///
+ public partial interface IWorkspaceCollectionsOperations
+ {
+ ///
+ /// 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
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetByNameWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(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.
+ ///
+ ///
+ /// Azure resource group
+ ///
+ ///
+ /// Power BI Embedded Workspace Collection name
+ ///
+ ///
+ /// Azure location
+ ///
+ ///
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CreateWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, string location = default(string), IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Update an existing Power BI Workspace Collection with the specified
+ /// properties.
+ ///
+ ///
+ /// 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
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// 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
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Verify the specified Power BI Workspace Collection name is valid
+ /// and not already in use.
+ ///
+ ///
+ /// Azure location
+ ///
+ ///
+ /// Workspace collection name
+ ///
+ ///
+ /// Resource type
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> CheckNameAvailabilityWithHttpMessagesAsync(string location, string name = default(string), string type = "Microsoft.PowerBI/workspaceCollections", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// 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
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// 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
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// 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
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> GetAccessKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Regenerates the primary or secondary access key for the specified
+ /// Power BI Workspace Collection.
+ ///
+ ///
+ /// Azure resource group
+ ///
+ ///
+ /// Power BI Embedded Workspace Collection name
+ ///
+ ///
+ /// Key name. Possible values include: 'key1', 'key2'
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task> RegenerateKeyWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, AccessKeyName? keyName = default(AccessKeyName?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// Migrates an existing Power BI Workspace Collection to a different
+ /// resource group and/or subscription.
+ ///
+ ///
+ /// Azure resource group
+ ///
+ ///
+ /// Name of the resource group the Power BI workspace collections will
+ /// be migrated to.
+ ///
+ ///
+ ///
+ ///
+ /// The headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task MigrateWithHttpMessagesAsync(string resourceGroupName, string targetResourceGroup = default(string), IList resources = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ ///
+ /// 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
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/IWorkspacesOperations.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/IWorkspacesOperations.cs
new file mode 100644
index 000000000000..6897d92f3f26
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/IWorkspacesOperations.cs
@@ -0,0 +1,53 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.PowerBIEmbedded
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// WorkspacesOperations operations.
+ ///
+ public partial interface IWorkspacesOperations
+ {
+ ///
+ /// 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
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/AccessKeyName.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/AccessKeyName.cs
new file mode 100644
index 000000000000..e868aa371340
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/AccessKeyName.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.PowerBIEmbedded.Models
+{
+ using Newtonsoft.Json;
+ using Newtonsoft.Json.Converters;
+ using System.Runtime;
+ using System.Runtime.Serialization;
+
+ ///
+ /// Defines values for AccessKeyName.
+ ///
+ [JsonConverter(typeof(StringEnumConverter))]
+ public enum AccessKeyName
+ {
+ [EnumMember(Value = "key1")]
+ Key1,
+ [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;
+ }
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/AzureSku.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/AzureSku.cs
new file mode 100644
index 000000000000..59e9be22186d
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/AzureSku.cs
@@ -0,0 +1,53 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.PowerBIEmbedded.Models
+{
+ using Newtonsoft.Json;
+ using System.Linq;
+
+ public partial class AzureSku
+ {
+ ///
+ /// Initializes a new instance of the AzureSku class.
+ ///
+ public AzureSku()
+ {
+ CustomInit();
+ }
+
+ ///
+ /// Static constructor for AzureSku class.
+ ///
+ static AzureSku()
+ {
+ Name = "S1";
+ Tier = "Standard";
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// SKU name
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public static string Name { get; private set; }
+
+ ///
+ /// SKU tier
+ ///
+ [JsonProperty(PropertyName = "tier")]
+ public static string Tier { get; private set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/CheckNameReason.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/CheckNameReason.cs
new file mode 100644
index 000000000000..de90e8ad35cc
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/CheckNameReason.cs
@@ -0,0 +1,22 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.PowerBIEmbedded.Models
+{
+
+ ///
+ /// Defines values for CheckNameReason.
+ ///
+ public static class CheckNameReason
+ {
+ public const string Unavailable = "Unavailable";
+ public const string Invalid = "Invalid";
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/CheckNameRequest.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/CheckNameRequest.cs
new file mode 100644
index 000000000000..3ad0ca2caf2b
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/CheckNameRequest.cs
@@ -0,0 +1,56 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.PowerBIEmbedded.Models
+{
+ using Newtonsoft.Json;
+ 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))
+ {
+ Name = name;
+ Type = type;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets workspace collection name
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets resource type
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/CheckNameResponse.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/CheckNameResponse.cs
new file mode 100644
index 000000000000..f8462196e1e7
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/CheckNameResponse.cs
@@ -0,0 +1,73 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.PowerBIEmbedded.Models
+{
+ using Newtonsoft.Json;
+ 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))
+ {
+ NameAvailable = nameAvailable;
+ Reason = reason;
+ 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.
+ ///
+ [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'
+ ///
+ [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.
+ ///
+ [JsonProperty(PropertyName = "message")]
+ public string Message { get; set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/CreateWorkspaceCollectionRequest.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/CreateWorkspaceCollectionRequest.cs
new file mode 100644
index 000000000000..e18f2a08445c
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/CreateWorkspaceCollectionRequest.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.PowerBIEmbedded.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ 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
+ public CreateWorkspaceCollectionRequest(string location = default(string), IDictionary tags = default(IDictionary))
+ {
+ Location = location;
+ Tags = tags;
+ CustomInit();
+ }
+ ///
+ /// Static constructor for CreateWorkspaceCollectionRequest class.
+ ///
+ static CreateWorkspaceCollectionRequest()
+ {
+ Sku = new AzureSku();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets azure location
+ ///
+ [JsonProperty(PropertyName = "location")]
+ public string Location { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "tags")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "sku")]
+ public static AzureSku Sku { get; private set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Display.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Display.cs
new file mode 100644
index 000000000000..a79cc8f3cdd4
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Display.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.Models
+{
+ using Newtonsoft.Json;
+ 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))
+ {
+ Provider = provider;
+ Resource = resource;
+ Operation = operation;
+ Description = description;
+ 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.
+ ///
+ [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.
+ ///
+ [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.
+ ///
+ [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.
+ ///
+ [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'
+ ///
+ [JsonProperty(PropertyName = "origin")]
+ public string Origin { get; set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Error.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Error.cs
new file mode 100644
index 000000000000..a75610e53b8c
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Error.cs
@@ -0,0 +1,66 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.PowerBIEmbedded.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ 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), IList details = default(IList))
+ {
+ Code = code;
+ Message = message;
+ Target = target;
+ Details = details;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "code")]
+ public string Code { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "message")]
+ public string Message { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "target")]
+ public string Target { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "details")]
+ public IList Details { get; set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/ErrorDetail.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/ErrorDetail.cs
new file mode 100644
index 000000000000..900da4785aad
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/ErrorDetail.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 Newtonsoft.Json;
+ 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))
+ {
+ Code = code;
+ Message = message;
+ Target = target;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "code")]
+ public string Code { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "message")]
+ public string Message { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "target")]
+ public string Target { get; set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/ErrorException.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/ErrorException.cs
new file mode 100644
index 000000000000..ecee4d11f2d2
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/ErrorException.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.PowerBIEmbedded.Models
+{
+ using Microsoft.Rest;
+
+ ///
+ /// Exception thrown for an invalid response with Error information.
+ ///
+ public partial class ErrorException : RestException
+ {
+ ///
+ /// Gets information about the associated HTTP request.
+ ///
+ public HttpRequestMessageWrapper Request { get; set; }
+
+ ///
+ /// Gets information about the associated HTTP response.
+ ///
+ public HttpResponseMessageWrapper Response { get; set; }
+
+ ///
+ /// Gets or sets the body object.
+ ///
+ public Error Body { get; set; }
+
+ ///
+ /// Initializes a new instance of the ErrorException class.
+ ///
+ public ErrorException()
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorException class.
+ ///
+ /// The exception message.
+ public ErrorException(string message)
+ : this(message, null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the ErrorException class.
+ ///
+ /// The exception message.
+ /// Inner exception.
+ public ErrorException(string message, System.Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/MigrateWorkspaceCollectionRequest.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/MigrateWorkspaceCollectionRequest.cs
new file mode 100644
index 000000000000..5e7bb354d420
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/MigrateWorkspaceCollectionRequest.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.PowerBIEmbedded.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ 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), IList resources = default(IList))
+ {
+ TargetResourceGroup = targetResourceGroup;
+ 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.
+ ///
+ [JsonProperty(PropertyName = "targetResourceGroup")]
+ public string TargetResourceGroup { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "resources")]
+ public IList Resources { get; set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Operation.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Operation.cs
new file mode 100644
index 000000000000..f756d5ca6864
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/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 Newtonsoft.Json;
+ 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))
+ {
+ Name = name;
+ 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.
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "display")]
+ public Display Display { get; set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/OperationList.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/OperationList.cs
new file mode 100644
index 000000000000..55a7e24189c3
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/OperationList.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.PowerBIEmbedded.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ 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(IList value = default(IList))
+ {
+ Value = value;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "value")]
+ public IList Value { get; set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Page.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Page.cs
new file mode 100644
index 000000000000..5e98d8e07b79
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Page.cs
@@ -0,0 +1,53 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.PowerBIEmbedded.Models
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+
+ ///
+ /// Defines a page in Azure responses.
+ ///
+ /// Type of the page content items
+ [JsonObject]
+ public class Page : IPage
+ {
+ ///
+ /// Gets the link to the next page.
+ ///
+ [JsonProperty("")]
+ public string NextPageLink { get; private set; }
+
+ [JsonProperty("value")]
+ private IList Items{ get; set; }
+
+ ///
+ /// Returns an enumerator that iterates through the collection.
+ ///
+ /// A an enumerator that can be used to iterate through the collection.
+ public IEnumerator GetEnumerator()
+ {
+ return Items == null ? System.Linq.Enumerable.Empty().GetEnumerator() : Items.GetEnumerator();
+ }
+
+ ///
+ /// Returns an enumerator that iterates through the collection.
+ ///
+ /// A an enumerator that can be used to iterate through the collection.
+ IEnumerator IEnumerable.GetEnumerator()
+ {
+ return GetEnumerator();
+ }
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/UpdateWorkspaceCollectionRequest.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/UpdateWorkspaceCollectionRequest.cs
new file mode 100644
index 000000000000..0b626b3d44af
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/UpdateWorkspaceCollectionRequest.cs
@@ -0,0 +1,62 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.PowerBIEmbedded.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ 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.
+ ///
+ public UpdateWorkspaceCollectionRequest(IDictionary tags = default(IDictionary))
+ {
+ Tags = tags;
+ CustomInit();
+ }
+ ///
+ /// Static constructor for UpdateWorkspaceCollectionRequest class.
+ ///
+ static UpdateWorkspaceCollectionRequest()
+ {
+ Sku = new AzureSku();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "tags")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "sku")]
+ public static AzureSku Sku { get; private set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Workspace.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Workspace.cs
new file mode 100644
index 000000000000..69d892d5c621
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/Workspace.cs
@@ -0,0 +1,72 @@
+//
+// 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 Newtonsoft.Json;
+ 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))
+ {
+ Id = id;
+ Name = name;
+ Type = type;
+ Properties = properties;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets workspace id
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; set; }
+
+ ///
+ /// Gets or sets workspace name
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets resource type
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; set; }
+
+ ///
+ /// Gets or sets property bag
+ ///
+ [JsonProperty(PropertyName = "properties")]
+ public object Properties { get; set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/WorkspaceCollection.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/WorkspaceCollection.cs
new file mode 100644
index 000000000000..36049a5460b5
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/WorkspaceCollection.cs
@@ -0,0 +1,100 @@
+//
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License. See License.txt in the project root for
+// license information.
+//
+// Code generated by Microsoft (R) AutoRest Code Generator.
+// Changes may cause incorrect behavior and will be lost if the code is
+// regenerated.
+//
+
+namespace Microsoft.Azure.Management.PowerBIEmbedded.Models
+{
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ 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
+ /// Properties
+ public WorkspaceCollection(string id = default(string), string name = default(string), string type = default(string), string location = default(string), IDictionary tags = default(IDictionary), object properties = default(object))
+ {
+ Id = id;
+ Name = name;
+ Type = type;
+ Location = location;
+ Tags = tags;
+ Properties = properties;
+ CustomInit();
+ }
+ ///
+ /// Static constructor for WorkspaceCollection class.
+ ///
+ static WorkspaceCollection()
+ {
+ Sku = new AzureSku();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets resource id
+ ///
+ [JsonProperty(PropertyName = "id")]
+ public string Id { get; set; }
+
+ ///
+ /// Gets or sets workspace collection name
+ ///
+ [JsonProperty(PropertyName = "name")]
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets resource type
+ ///
+ [JsonProperty(PropertyName = "type")]
+ public string Type { get; set; }
+
+ ///
+ /// Gets or sets azure location
+ ///
+ [JsonProperty(PropertyName = "location")]
+ public string Location { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "tags")]
+ public IDictionary Tags { get; set; }
+
+ ///
+ /// Gets or sets properties
+ ///
+ [JsonProperty(PropertyName = "properties")]
+ public object Properties { get; set; }
+
+ ///
+ ///
+ [JsonProperty(PropertyName = "sku")]
+ public static AzureSku Sku { get; private set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/WorkspaceCollectionAccessKey.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/WorkspaceCollectionAccessKey.cs
new file mode 100644
index 000000000000..36f014987777
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/WorkspaceCollectionAccessKey.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
+{
+ using Newtonsoft.Json;
+ 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?))
+ {
+ 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'
+ ///
+ [JsonProperty(PropertyName = "keyName")]
+ public AccessKeyName? KeyName { get; set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/WorkspaceCollectionAccessKeys.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/WorkspaceCollectionAccessKeys.cs
new file mode 100644
index 000000000000..c09f5c26994e
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/Models/WorkspaceCollectionAccessKeys.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 Newtonsoft.Json;
+ 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))
+ {
+ Key1 = key1;
+ Key2 = key2;
+ CustomInit();
+ }
+
+ ///
+ /// An initialization method that performs custom operations like setting defaults
+ ///
+ partial void CustomInit();
+
+ ///
+ /// Gets or sets access key 1
+ ///
+ [JsonProperty(PropertyName = "key1")]
+ public string Key1 { get; set; }
+
+ ///
+ /// Gets or sets access key 2
+ ///
+ [JsonProperty(PropertyName = "key2")]
+ public string Key2 { get; set; }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/PowerBIEmbeddedManagementClient.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/PowerBIEmbeddedManagementClient.cs
new file mode 100644
index 000000000000..daa745dcff0d
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/PowerBIEmbeddedManagementClient.cs
@@ -0,0 +1,538 @@
+//
+// 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 Microsoft.Rest.Serialization;
+ using Models;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Client to manage your Power BI Embedded workspace collections and
+ /// retrieve workspaces.
+ ///
+ public partial class PowerBIEmbeddedManagementClient : ServiceClient, IPowerBIEmbeddedManagementClient, IAzureClient
+ {
+ ///
+ /// The base URI of the service.
+ ///
+ public System.Uri BaseUri { get; set; }
+
+ ///
+ /// Gets or sets json serialization settings.
+ ///
+ public JsonSerializerSettings SerializationSettings { get; private set; }
+
+ ///
+ /// Gets or sets json deserialization settings.
+ ///
+ public JsonSerializerSettings DeserializationSettings { get; private set; }
+
+ ///
+ /// Credentials needed for the client to connect to Azure.
+ ///
+ public ServiceClientCredentials Credentials { 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; }
+
+ ///
+ /// Client Api Version.
+ ///
+ public string ApiVersion { get; private 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(HttpClient httpClient, bool disposeHttpClient) : base(httpClient, disposeHttpClient)
+ {
+ Initialize();
+ }
+
+ ///
+ /// Initializes a new instance of the PowerBIEmbeddedManagementClient class.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ protected PowerBIEmbeddedManagementClient(params DelegatingHandler[] handlers) : base(handlers)
+ {
+ 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(HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : base(rootHandler, handlers)
+ {
+ 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 DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ 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, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ 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(ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ 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(ServiceClientCredentials credentials, HttpClient httpClient, bool disposeHttpClient) : this(httpClient, disposeHttpClient)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ 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(ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ {
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ 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, ServiceClientCredentials credentials, params DelegatingHandler[] handlers) : this(handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ BaseUri = baseUri;
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ 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.
+ ///
+ ///
+ /// Optional. The delegating handlers to add to the http client pipeline.
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ public PowerBIEmbeddedManagementClient(System.Uri baseUri, ServiceClientCredentials credentials, HttpClientHandler rootHandler, params DelegatingHandler[] handlers) : this(rootHandler, handlers)
+ {
+ if (baseUri == null)
+ {
+ throw new System.ArgumentNullException("baseUri");
+ }
+ if (credentials == null)
+ {
+ throw new System.ArgumentNullException("credentials");
+ }
+ BaseUri = baseUri;
+ Credentials = credentials;
+ if (Credentials != null)
+ {
+ Credentials.InitializeServiceClient(this);
+ }
+ }
+
+ ///
+ /// An optional partial-method to perform custom initialization.
+ ///
+ partial void CustomInitialize();
+ ///
+ /// Initializes client properties.
+ ///
+ private void Initialize()
+ {
+ WorkspaceCollections = new WorkspaceCollectionsOperations(this);
+ Workspaces = new WorkspacesOperations(this);
+ BaseUri = new System.Uri("https://management.azure.com");
+ ApiVersion = "2016-01-29";
+ AcceptLanguage = "en-US";
+ LongRunningOperationRetryTimeout = 30;
+ GenerateClientRequestId = true;
+ SerializationSettings = new 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 ReadOnlyJsonContractResolver(),
+ Converters = new List
+ {
+ new Iso8601TimeSpanConverter()
+ }
+ };
+ DeserializationSettings = new JsonSerializerSettings
+ {
+ DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
+ DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
+ NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
+ ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
+ ContractResolver = new ReadOnlyJsonContractResolver(),
+ Converters = new List
+ {
+ new Iso8601TimeSpanConverter()
+ }
+ };
+ CustomInitialize();
+ DeserializationSettings.Converters.Add(new 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 Task> GetAvailableOperationsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetAvailableOperations", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.PowerBI/operations").ToString();
+ List _queryParameters = new List();
+ if (ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (GenerateClientRequestId != null && GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/PowerBIEmbeddedManagementClientExtensions.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/PowerBIEmbeddedManagementClientExtensions.cs
new file mode 100644
index 000000000000..2dcd4bf43f05
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/PowerBIEmbeddedManagementClientExtensions.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
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// 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 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 Task GetAvailableOperationsAsync(this IPowerBIEmbeddedManagementClient operations, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.GetAvailableOperationsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/SdkInfo_PowerBIEmbeddedManagementClient.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/SdkInfo_PowerBIEmbeddedManagementClient.cs
new file mode 100644
index 000000000000..980b459c99d6
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/SdkInfo_PowerBIEmbeddedManagementClient.cs
@@ -0,0 +1,30 @@
+
+//
+// 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;
+ using System.Collections.Generic;
+ using System.Linq;
+
+ internal static partial class SdkInfo
+ {
+ public static IEnumerable> ApiInfo_PowerBIEmbeddedManagementClient
+ {
+ get
+ {
+ return new Tuple[]
+ {
+ new Tuple("PowerBI", "WorkspaceCollections", "2016-01-29"),
+ new Tuple("PowerBI", "Workspaces", "2016-01-29"),
+ new Tuple("PowerBI", "getAvailableOperations", "2016-01-29"),
+ new Tuple("PowerBIEmbeddedManagementClient", "WorkspaceCollections", "2016-01-29"),
+ }.AsEnumerable();
+ }
+ }
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/WorkspaceCollectionsOperations.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/WorkspaceCollectionsOperations.cs
new file mode 100644
index 000000000000..e3372b11ede6
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/WorkspaceCollectionsOperations.cs
@@ -0,0 +1,1993 @@
+//
+// 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;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// WorkspaceCollectionsOperations operations.
+ ///
+ internal partial class WorkspaceCollectionsOperations : 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");
+ }
+ 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 Task> GetByNameWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (workspaceCollectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceCollectionName");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("workspaceCollectionName", workspaceCollectionName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetByName", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// 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
+ ///
+ ///
+ /// Azure location
+ ///
+ ///
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, string location = default(string), IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (workspaceCollectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceCollectionName");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ CreateWorkspaceCollectionRequest body = new CreateWorkspaceCollectionRequest();
+ if (location != null || tags != null)
+ {
+ body.Location = location;
+ body.Tags = tags;
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("workspaceCollectionName", workspaceCollectionName);
+ tracingParameters.Add("body", body);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Create", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PUT");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(body != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Update an existing Power BI Workspace Collection with the specified
+ /// properties.
+ ///
+ ///
+ /// 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 Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, IDictionary tags = default(IDictionary), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (workspaceCollectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceCollectionName");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ UpdateWorkspaceCollectionRequest body = new UpdateWorkspaceCollectionRequest();
+ if (tags != null)
+ {
+ body.Tags = tags;
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("workspaceCollectionName", workspaceCollectionName);
+ tracingParameters.Add("body", body);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Update", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("PATCH");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(body != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// 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.
+ ///
+ public async Task DeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ // Send request
+ AzureOperationResponse _response = await BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, customHeaders, cancellationToken).ConfigureAwait(false);
+ return await Client.GetPostOrDeleteOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false);
+ }
+
+ ///
+ /// Verify the specified Power BI Workspace Collection name is valid and not
+ /// already in use.
+ ///
+ ///
+ /// Azure location
+ ///
+ ///
+ /// Workspace collection name
+ ///
+ ///
+ /// Resource type
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> CheckNameAvailabilityWithHttpMessagesAsync(string location, string name = default(string), string type = "Microsoft.PowerBI/workspaceCollections", Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (location == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "location");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ CheckNameRequest body = new CheckNameRequest();
+ if (name != null || type != null)
+ {
+ body.Name = name;
+ body.Type = type;
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("location", location);
+ tracingParameters.Add("body", body);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "CheckNameAvailability", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = 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(Client.SubscriptionId));
+ _url = _url.Replace("{location}", System.Uri.EscapeDataString(location));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(body != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// 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 Task>> ListByResourceGroupWithHttpMessagesAsync(string resourceGroupName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListByResourceGroup", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// 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 Task>> ListBySubscriptionWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "ListBySubscription", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = 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(Client.SubscriptionId));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// 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 Task> GetAccessKeysWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (workspaceCollectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceCollectionName");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("workspaceCollectionName", workspaceCollectionName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "GetAccessKeys", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}/listKeys").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 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 = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Regenerates the primary or secondary access key for the specified Power BI
+ /// Workspace Collection.
+ ///
+ ///
+ /// Azure resource group
+ ///
+ ///
+ /// Power BI Embedded Workspace Collection name
+ ///
+ ///
+ /// Key name. Possible values include: 'key1', 'key2'
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when unable to deserialize the response
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task> RegenerateKeyWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, AccessKeyName? keyName = default(AccessKeyName?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (workspaceCollectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceCollectionName");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ WorkspaceCollectionAccessKey body = new WorkspaceCollectionAccessKey();
+ if (keyName != null)
+ {
+ body.KeyName = keyName;
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("workspaceCollectionName", workspaceCollectionName);
+ tracingParameters.Add("body", body);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "RegenerateKey", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}/regenerateKey").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(body != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// Migrates an existing Power BI Workspace Collection to a different resource
+ /// group and/or subscription.
+ ///
+ ///
+ /// Azure resource group
+ ///
+ ///
+ /// Name of the resource group the Power BI workspace collections will be
+ /// migrated to.
+ ///
+ ///
+ ///
+ ///
+ /// Headers that will be added to request.
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ ///
+ /// Thrown when the operation returned an invalid status code
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// Thrown when a required parameter is null
+ ///
+ ///
+ /// A response object containing the response body and response headers.
+ ///
+ public async Task MigrateWithHttpMessagesAsync(string resourceGroupName, string targetResourceGroup = default(string), IList resources = default(IList), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ MigrateWorkspaceCollectionRequest body = new MigrateWorkspaceCollectionRequest();
+ if (targetResourceGroup != null || resources != null)
+ {
+ body.TargetResourceGroup = targetResourceGroup;
+ body.Resources = resources;
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("body", body);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "Migrate", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = 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(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("POST");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ if(body != null)
+ {
+ _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(body, Client.SerializationSettings);
+ _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8);
+ _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
+ }
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ ///
+ /// 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 Task BeginDeleteWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (workspaceCollectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceCollectionName");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("workspaceCollectionName", workspaceCollectionName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "BeginDelete", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("DELETE");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 202)
+ {
+ var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/WorkspaceCollectionsOperationsExtensions.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/WorkspaceCollectionsOperationsExtensions.cs
new file mode 100644
index 000000000000..40751f56243f
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/WorkspaceCollectionsOperationsExtensions.cs
@@ -0,0 +1,490 @@
+//
+// 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;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// 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 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 Task GetByNameAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, CancellationToken cancellationToken = default(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
+ ///
+ ///
+ /// Azure location
+ ///
+ ///
+ ///
+ public static WorkspaceCollection Create(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, string location = default(string), IDictionary tags = default(IDictionary))
+ {
+ return operations.CreateAsync(resourceGroupName, workspaceCollectionName, location, tags).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
+ ///
+ ///
+ /// Azure location
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CreateAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, string location = default(string), IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CreateWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, location, tags, 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, IDictionary tags = default(IDictionary))
+ {
+ return operations.UpdateAsync(resourceGroupName, workspaceCollectionName, tags).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 Task UpdateAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, IDictionary tags = default(IDictionary), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, tags, 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)
+ {
+ 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 Task DeleteAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, CancellationToken cancellationToken = default(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
+ ///
+ ///
+ /// Workspace collection name
+ ///
+ ///
+ /// Resource type
+ ///
+ public static CheckNameResponse CheckNameAvailability(this IWorkspaceCollectionsOperations operations, string location, string name = default(string), string type = "Microsoft.PowerBI/workspaceCollections")
+ {
+ return operations.CheckNameAvailabilityAsync(location, name, type).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
+ ///
+ ///
+ /// Workspace collection name
+ ///
+ ///
+ /// Resource type
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task CheckNameAvailabilityAsync(this IWorkspaceCollectionsOperations operations, string location, string name = default(string), string type = "Microsoft.PowerBI/workspaceCollections", CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.CheckNameAvailabilityWithHttpMessagesAsync(location, name, type, 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 IEnumerable ListByResourceGroup(this IWorkspaceCollectionsOperations operations, string resourceGroupName)
+ {
+ return 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 Task> ListByResourceGroupAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, CancellationToken cancellationToken = default(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 IEnumerable ListBySubscription(this IWorkspaceCollectionsOperations operations)
+ {
+ return 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 Task> ListBySubscriptionAsync(this IWorkspaceCollectionsOperations operations, CancellationToken cancellationToken = default(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 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 Task GetAccessKeysAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, CancellationToken cancellationToken = default(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
+ ///
+ ///
+ /// Key name. Possible values include: 'key1', 'key2'
+ ///
+ public static WorkspaceCollectionAccessKeys RegenerateKey(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, AccessKeyName? keyName = default(AccessKeyName?))
+ {
+ return operations.RegenerateKeyAsync(resourceGroupName, workspaceCollectionName, keyName).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
+ ///
+ ///
+ /// Key name. Possible values include: 'key1', 'key2'
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task RegenerateKeyAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, AccessKeyName? keyName = default(AccessKeyName?), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.RegenerateKeyWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, keyName, 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
+ ///
+ ///
+ /// Name of the resource group the Power BI workspace collections will be
+ /// migrated to.
+ ///
+ ///
+ ///
+ public static void Migrate(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string targetResourceGroup = default(string), IList resources = default(IList))
+ {
+ operations.MigrateAsync(resourceGroupName, targetResourceGroup, resources).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
+ ///
+ ///
+ /// Name of the resource group the Power BI workspace collections will be
+ /// migrated to.
+ ///
+ ///
+ ///
+ ///
+ /// The cancellation token.
+ ///
+ public static async Task MigrateAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string targetResourceGroup = default(string), IList resources = default(IList), CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.MigrateWithHttpMessagesAsync(resourceGroupName, targetResourceGroup, resources, 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)
+ {
+ 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 Task BeginDeleteAsync(this IWorkspaceCollectionsOperations operations, string resourceGroupName, string workspaceCollectionName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ (await operations.BeginDeleteWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, null, cancellationToken).ConfigureAwait(false)).Dispose();
+ }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/WorkspacesOperations.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/WorkspacesOperations.cs
new file mode 100644
index 000000000000..909ada372186
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/WorkspacesOperations.cs
@@ -0,0 +1,246 @@
+//
+// 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;
+ using Newtonsoft.Json;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Linq;
+ using System.Net;
+ using System.Net.Http;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// WorkspacesOperations operations.
+ ///
+ internal partial class WorkspacesOperations : 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");
+ }
+ 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 Task>> ListWithHttpMessagesAsync(string resourceGroupName, string workspaceCollectionName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ if (Client.SubscriptionId == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.SubscriptionId");
+ }
+ if (resourceGroupName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "resourceGroupName");
+ }
+ if (workspaceCollectionName == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "workspaceCollectionName");
+ }
+ if (Client.ApiVersion == null)
+ {
+ throw new ValidationException(ValidationRules.CannotBeNull, "this.Client.ApiVersion");
+ }
+ // Tracing
+ bool _shouldTrace = ServiceClientTracing.IsEnabled;
+ string _invocationId = null;
+ if (_shouldTrace)
+ {
+ _invocationId = ServiceClientTracing.NextInvocationId.ToString();
+ Dictionary tracingParameters = new Dictionary();
+ tracingParameters.Add("resourceGroupName", resourceGroupName);
+ tracingParameters.Add("workspaceCollectionName", workspaceCollectionName);
+ tracingParameters.Add("cancellationToken", cancellationToken);
+ ServiceClientTracing.Enter(_invocationId, this, "List", tracingParameters);
+ }
+ // Construct URL
+ var _baseUrl = Client.BaseUri.AbsoluteUri;
+ var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PowerBI/workspaceCollections/{workspaceCollectionName}/workspaces").ToString();
+ _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Client.SubscriptionId));
+ _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName));
+ _url = _url.Replace("{workspaceCollectionName}", System.Uri.EscapeDataString(workspaceCollectionName));
+ List _queryParameters = new List();
+ if (Client.ApiVersion != null)
+ {
+ _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(Client.ApiVersion)));
+ }
+ if (_queryParameters.Count > 0)
+ {
+ _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters);
+ }
+ // Create HTTP transport objects
+ var _httpRequest = new HttpRequestMessage();
+ HttpResponseMessage _httpResponse = null;
+ _httpRequest.Method = new HttpMethod("GET");
+ _httpRequest.RequestUri = new System.Uri(_url);
+ // Set Headers
+ if (Client.GenerateClientRequestId != null && Client.GenerateClientRequestId.Value)
+ {
+ _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString());
+ }
+ if (Client.AcceptLanguage != null)
+ {
+ if (_httpRequest.Headers.Contains("accept-language"))
+ {
+ _httpRequest.Headers.Remove("accept-language");
+ }
+ _httpRequest.Headers.TryAddWithoutValidation("accept-language", Client.AcceptLanguage);
+ }
+
+
+ if (customHeaders != null)
+ {
+ foreach(var _header in customHeaders)
+ {
+ if (_httpRequest.Headers.Contains(_header.Key))
+ {
+ _httpRequest.Headers.Remove(_header.Key);
+ }
+ _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
+ }
+ }
+
+ // Serialize Request
+ string _requestContent = null;
+ // Set Credentials
+ if (Client.Credentials != null)
+ {
+ cancellationToken.ThrowIfCancellationRequested();
+ await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ }
+ // Send Request
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
+ }
+ cancellationToken.ThrowIfCancellationRequested();
+ _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
+ }
+ HttpStatusCode _statusCode = _httpResponse.StatusCode;
+ cancellationToken.ThrowIfCancellationRequested();
+ string _responseContent = null;
+ if ((int)_statusCode != 200)
+ {
+ var ex = new ErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
+ try
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ Error _errorBody = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings);
+ if (_errorBody != null)
+ {
+ ex.Body = _errorBody;
+ }
+ }
+ catch (JsonException)
+ {
+ // Ignore the exception
+ }
+ ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent);
+ ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent);
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Error(_invocationId, ex);
+ }
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw ex;
+ }
+ // Create Result
+ var _result = new AzureOperationResponse>();
+ _result.Request = _httpRequest;
+ _result.Response = _httpResponse;
+ if (_httpResponse.Headers.Contains("x-ms-request-id"))
+ {
+ _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
+ }
+ // Deserialize Response
+ if ((int)_statusCode == 200)
+ {
+ _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
+ try
+ {
+ _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject>(_responseContent, Client.DeserializationSettings);
+ }
+ catch (JsonException ex)
+ {
+ _httpRequest.Dispose();
+ if (_httpResponse != null)
+ {
+ _httpResponse.Dispose();
+ }
+ throw new SerializationException("Unable to deserialize the response.", _responseContent, ex);
+ }
+ }
+ if (_shouldTrace)
+ {
+ ServiceClientTracing.Exit(_invocationId, _result);
+ }
+ return _result;
+ }
+
+ }
+}
diff --git a/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/WorkspacesOperationsExtensions.cs b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/WorkspacesOperationsExtensions.cs
new file mode 100644
index 000000000000..0eb4fc09b661
--- /dev/null
+++ b/sdk/powerbiembedded/Microsoft.Azure.Management.PowerBIEmbedded/src/Generated/WorkspacesOperationsExtensions.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
+{
+ using Microsoft.Rest;
+ using Microsoft.Rest.Azure;
+ using Models;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Threading;
+ using System.Threading.Tasks;
+
+ ///
+ /// Extension methods for 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 IEnumerable List(this IWorkspacesOperations operations, string resourceGroupName, string workspaceCollectionName)
+ {
+ return 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 Task> ListAsync(this IWorkspacesOperations operations, string resourceGroupName, string workspaceCollectionName, CancellationToken cancellationToken = default(CancellationToken))
+ {
+ using (var _result = await operations.ListWithHttpMessagesAsync(resourceGroupName, workspaceCollectionName, null, cancellationToken).ConfigureAwait(false))
+ {
+ return _result.Body;
+ }
+ }
+
+ }
+}