From c3ea7f70148635c65ab3d6293828d8ac5ba60908 Mon Sep 17 00:00:00 2001 From: Simon Gordon Date: Wed, 26 Jul 2023 15:26:55 +0000 Subject: [PATCH 01/35] Merged PR 416563: Correcting permissions documentation on execute queries api Correcting permissions documentation on execute queries api Related work items: #1128868 --- sdk/PowerBI.Api/Source/DatasetsOperations.cs | 6 ++++-- .../Source/DatasetsOperationsExtensions.cs | 12 ++++++++---- sdk/PowerBI.Api/Source/IDatasetsOperations.cs | 6 ++++-- sdk/swaggers/swagger.json | 4 ++-- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/sdk/PowerBI.Api/Source/DatasetsOperations.cs b/sdk/PowerBI.Api/Source/DatasetsOperations.cs index 80996114..c66f3fc1 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperations.cs @@ -819,7 +819,8 @@ public DatasetsOperations(PowerBIClient client) /// /// ## Permissions /// - /// The user must have [Manage dataset access + /// The user must have dataset read permissions. For more information, see + /// [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope @@ -9912,7 +9913,8 @@ public DatasetsOperations(PowerBIClient client) /// /// ## Permissions /// - /// The user must have [Manage dataset access + /// The user must have dataset read permissions. For more information, see + /// [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope diff --git a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs index 35b4ae1c..d4109a92 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs @@ -301,7 +301,8 @@ public static void DeleteDataset(this IDatasetsOperations operations, string dat /// /// ## Permissions /// - /// The user must have [Manage dataset access + /// The user must have dataset read permissions. For more information, see + /// [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope @@ -375,7 +376,8 @@ public static DatasetExecuteQueriesResponse ExecuteQueries(this IDatasetsOperati /// /// ## Permissions /// - /// The user must have [Manage dataset access + /// The user must have dataset read permissions. For more information, see + /// [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope @@ -4676,7 +4678,8 @@ public static void TakeOverInGroup(this IDatasetsOperations operations, System.G /// /// ## Permissions /// - /// The user must have [Manage dataset access + /// The user must have dataset read permissions. For more information, see + /// [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope @@ -4753,7 +4756,8 @@ public static DatasetExecuteQueriesResponse ExecuteQueriesInGroup(this IDatasets /// /// ## Permissions /// - /// The user must have [Manage dataset access + /// The user must have dataset read permissions. For more information, see + /// [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope diff --git a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs index acd9ebc0..9a341a5b 100644 --- a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs @@ -196,7 +196,8 @@ public partial interface IDatasetsOperations /// /// ## Permissions /// - /// The user must have [Manage dataset access + /// The user must have dataset read permissions. For more information, + /// see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope @@ -2645,7 +2646,8 @@ public partial interface IDatasetsOperations /// /// ## Permissions /// - /// The user must have [Manage dataset access + /// The user must have dataset read permissions. For more information, + /// see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index d09ead21..5b520113 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -343,7 +343,7 @@ "Datasets" ], "summary": "Executes Data Analysis Expressions (DAX) queries against the provided dataset. The dataset must reside in **My workspace** or another workspace.", - "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- Maximum of 120 requests per user per minute. Target dataset does not impact this rate limit.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", + "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have dataset read permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- Maximum of 120 requests per user per minute. Target dataset does not impact this rate limit.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", "operationId": "Datasets_ExecuteQueries", "consumes": [], "produces": [ @@ -6500,7 +6500,7 @@ "Datasets" ], "summary": "Executes Data Analysis Expressions (DAX) queries against the provided dataset.", - "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- Maximum of 120 requests per user per minute. Target dataset does not impact this rate limit.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", + "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have dataset read permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- Maximum of 120 requests per user per minute. Target dataset does not impact this rate limit.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", "operationId": "Datasets_ExecuteQueriesInGroup", "consumes": [], "produces": [ From 31f77a70e7664ddaa8a6baa8448f203b3dc4e159 Mon Sep 17 00:00:00 2001 From: Xian Chen Date: Thu, 27 Jul 2023 14:20:22 +0000 Subject: [PATCH 02/35] Merged PR 397041: Doc/SDK: Support get/set DefaultDatasetStorageFormat for both admin and user API 1. **_GetGroupsAsAdmin, GetGroupAsAdmin, PatchGroupAsAdmin_** - Business logic PR !374148 !396174 - Affected documents [GetGroupsAsAdmin](https://review.learn.microsoft.com/en-us/rest/api/power-bi/admin/groups-get-groups-as-admin?branch=test-xian) - Example and AdminGroup section [GetGroupAsAdmin](https://review.learn.microsoft.com/en-us/rest/api/power-bi/admin/groups-get-group-as-admin?branch=test-xian) - Example and AdminGroup section [UpdateGroupAsAdmin](https://review.learn.microsoft.com/en-us/rest/api/power-bi/admin/groups-update-group-as-admin?branch=test-xian) - Description, Limitation, Requst Body, Example and AdminGroup section --- 2. **_GetGroupsAsUser, GetGroupAsUser_** - Business logic PR !363144 - Affected documents [GetGroups](https://review.learn.microsoft.com/en-us/rest/api/power-bi/groups/get-groups?branch=test-xian) - Example and Group section [GetGroup](https://review.learn.microsoft.com/en-us/rest/api/power-bi/groups/get-group?branch=test-xian) - _New page_ --- 3. **_PatchGroupAsUser_** - Business logic PR !393667 - Affected documents [UpdateGroup](https://review.learn.microsoft.com/en-us/rest/api/power-bi/groups/update-group?branch=test-xian) - _New Page_ --- 4. **`Scanner API`** - Business logic PR !374148 - Affected documents [GetScanResult](https://review.learn.microsoft.com/en-us/rest/api/power-bi/admin/workspace-info-get-scan-result?branch=test-xian) - Example and WorkspaceInfo section Related work items: #1029534 --- sdk/PowerBI.Api/Source/GroupsOperations.cs | 363 ++++++++++++++++-- .../Source/GroupsOperationsExtensions.cs | 275 ++++++++++--- sdk/PowerBI.Api/Source/IGroupsOperations.cs | 154 ++++++-- sdk/PowerBI.Api/Source/Models/AdminGroup.cs | 15 +- .../Models/DefaultDatasetStorageFormat.cs | 24 ++ sdk/PowerBI.Api/Source/Models/Group.cs | 15 +- .../Source/Models/GroupExtendedProperties.cs | 15 +- .../Source/Models/UpdateGroupRequest.cs | 58 +++ .../Source/Models/WorkspaceInfo.cs | 15 +- sdk/swaggers/swagger.json | 207 ++++++++-- 10 files changed, 999 insertions(+), 142 deletions(-) create mode 100644 sdk/PowerBI.Api/Source/Models/DefaultDatasetStorageFormat.cs create mode 100644 sdk/PowerBI.Api/Source/Models/UpdateGroupRequest.cs diff --git a/sdk/PowerBI.Api/Source/GroupsOperations.cs b/sdk/PowerBI.Api/Source/GroupsOperations.cs index dea014dc..9d3de011 100644 --- a/sdk/PowerBI.Api/Source/GroupsOperations.cs +++ b/sdk/PowerBI.Api/Source/GroupsOperations.cs @@ -51,11 +51,6 @@ public GroupsOperations(PowerBIClient client) /// /// /// - /// When user permissions to a workspace have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For more @@ -65,6 +60,13 @@ public GroupsOperations(PowerBIClient client) /// ## Required Scope /// /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. /// <br><br> /// /// @@ -396,6 +398,157 @@ public GroupsOperations(PowerBIClient client) return _result; } + /// + /// Returns a specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetGroupWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + /// /// Deletes the specified workspace. /// @@ -413,7 +566,7 @@ public GroupsOperations(PowerBIClient client) /// <br><br> /// /// - /// The workspace ID to delete + /// The workspace ID /// /// /// Headers that will be added to request. @@ -520,16 +673,159 @@ public GroupsOperations(PowerBIClient client) } /// - /// Returns a list of users that have access to the specified workspace. + /// Updates a specified workspace. /// /// /// - /// When user permissions to a workspace have been recently updated, the new - /// permissions might not be immediately available through API calls. As a - /// result, this API call might return an HTTP 401 error when a user has - /// permissions to a workspace. To refresh user permissions, use the [Refresh - /// User Permissions](/rest/api/power-bi/users/refresh-user-permissions) API - /// call. + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - For Shared capacities, only the name can be updated. + /// - For Premium capacities, only the name and defaultDatasetStorageFormat can + /// be updated. + /// - The name must be unique inside an organization. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The properties to update + /// + /// + /// 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 UpdateGroupWithHttpMessagesAsync(System.Guid groupId, UpdateGroupRequest groupProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (groupProperties == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "groupProperties"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("groupProperties", groupProperties); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + // 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 (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(groupProperties != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(groupProperties, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of users that have access to the specified workspace. + /// + /// /// /// ## Permissions /// @@ -540,6 +836,13 @@ public GroupsOperations(PowerBIClient client) /// ## Required Scope /// /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. /// <br><br> /// /// @@ -697,11 +1000,6 @@ public GroupsOperations(PowerBIClient client) /// /// /// - /// When user permissions to a workspace have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For more @@ -711,6 +1009,13 @@ public GroupsOperations(PowerBIClient client) /// ## Required Scope /// /// Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. /// <br><br> /// /// @@ -849,11 +1154,6 @@ public GroupsOperations(PowerBIClient client) /// /// /// - /// When user permissions to a workspace have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For more @@ -863,6 +1163,13 @@ public GroupsOperations(PowerBIClient client) /// ## Required Scope /// /// Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. /// <br><br> /// /// @@ -2240,9 +2547,7 @@ public GroupsOperations(PowerBIClient client) /// /// /// - /// Only the name, description and Log Analytics workspace can be updated. The - /// name must be unique inside an organization. To unassign a Log Analytics - /// workspace, explicitly set the value to null. + /// To unassign a Log Analytics workspace, explicitly set the value to null. /// /// ## Permissions /// @@ -2255,7 +2560,11 @@ public GroupsOperations(PowerBIClient client) /// /// ## Limitations /// - /// Maximum 200 requests per hour. + /// - Maximum 200 requests per hour. + /// - For Shared capacities, only the name and description can be updated. + /// - For Premium capacities, only the name, description, + /// defaultDatasetStorageFormat and Log Analytics workspace can be updated. + /// - The name must be unique inside an organization. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/GroupsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/GroupsOperationsExtensions.cs index 742c7f86..4bed590a 100644 --- a/sdk/PowerBI.Api/Source/GroupsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/GroupsOperationsExtensions.cs @@ -20,11 +20,6 @@ public static partial class GroupsOperationsExtensions /// /// /// - /// When user permissions to a workspace have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For more @@ -34,6 +29,13 @@ public static partial class GroupsOperationsExtensions /// ## Required Scope /// /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. /// <br><br> /// /// @@ -58,11 +60,6 @@ public static partial class GroupsOperationsExtensions /// /// /// - /// When user permissions to a workspace have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For more @@ -72,6 +69,13 @@ public static partial class GroupsOperationsExtensions /// ## Required Scope /// /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. /// <br><br> /// /// @@ -165,6 +169,80 @@ public static partial class GroupsOperationsExtensions } } + /// + /// Returns a specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + public static Group GetGroup(this IGroupsOperations operations, System.Guid groupId) + { + return operations.GetGroupAsync(groupId).GetAwaiter().GetResult(); + } + + /// + /// Returns a specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The cancellation token. + /// + public static async Task GetGroupAsync(this IGroupsOperations operations, System.Guid groupId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetGroupWithHttpMessagesAsync(groupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Deletes the specified workspace. /// @@ -185,7 +263,7 @@ public static partial class GroupsOperationsExtensions /// The operations group for this extension method. /// /// - /// The workspace ID to delete + /// The workspace ID /// public static void DeleteGroup(this IGroupsOperations operations, System.Guid groupId) { @@ -212,7 +290,7 @@ public static void DeleteGroup(this IGroupsOperations operations, System.Guid gr /// The operations group for this extension method. /// /// - /// The workspace ID to delete + /// The workspace ID /// /// /// The cancellation token. @@ -223,16 +301,86 @@ public static void DeleteGroup(this IGroupsOperations operations, System.Guid gr } /// - /// Returns a list of users that have access to the specified workspace. + /// Updates a specified workspace. /// /// /// - /// When user permissions to a workspace have been recently updated, the new - /// permissions might not be immediately available through API calls. As a - /// result, this API call might return an HTTP 401 error when a user has - /// permissions to a workspace. To refresh user permissions, use the [Refresh - /// User Permissions](/rest/api/power-bi/users/refresh-user-permissions) API - /// call. + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - For Shared capacities, only the name can be updated. + /// - For Premium capacities, only the name and defaultDatasetStorageFormat can + /// be updated. + /// - The name must be unique inside an organization. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The properties to update + /// + public static void UpdateGroup(this IGroupsOperations operations, System.Guid groupId, UpdateGroupRequest groupProperties) + { + operations.UpdateGroupAsync(groupId, groupProperties).GetAwaiter().GetResult(); + } + + /// + /// Updates a specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - For Shared capacities, only the name can be updated. + /// - For Premium capacities, only the name and defaultDatasetStorageFormat can + /// be updated. + /// - The name must be unique inside an organization. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The properties to update + /// + /// + /// The cancellation token. + /// + public static async Task UpdateGroupAsync(this IGroupsOperations operations, System.Guid groupId, UpdateGroupRequest groupProperties, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateGroupWithHttpMessagesAsync(groupId, groupProperties, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns a list of users that have access to the specified workspace. + /// + /// /// /// ## Permissions /// @@ -243,6 +391,13 @@ public static void DeleteGroup(this IGroupsOperations operations, System.Guid gr /// ## Required Scope /// /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. /// <br><br> /// /// @@ -267,13 +422,6 @@ public static void DeleteGroup(this IGroupsOperations operations, System.Guid gr /// /// /// - /// When user permissions to a workspace have been recently updated, the new - /// permissions might not be immediately available through API calls. As a - /// result, this API call might return an HTTP 401 error when a user has - /// permissions to a workspace. To refresh user permissions, use the [Refresh - /// User Permissions](/rest/api/power-bi/users/refresh-user-permissions) API - /// call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For more @@ -283,6 +431,13 @@ public static void DeleteGroup(this IGroupsOperations operations, System.Guid gr /// ## Required Scope /// /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. /// <br><br> /// /// @@ -314,11 +469,6 @@ public static void DeleteGroup(this IGroupsOperations operations, System.Guid gr /// /// /// - /// When user permissions to a workspace have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For more @@ -328,6 +478,13 @@ public static void DeleteGroup(this IGroupsOperations operations, System.Guid gr /// ## Required Scope /// /// Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. /// <br><br> /// /// @@ -350,11 +507,6 @@ public static void AddGroupUser(this IGroupsOperations operations, System.Guid g /// /// /// - /// When user permissions to a workspace have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For more @@ -364,6 +516,13 @@ public static void AddGroupUser(this IGroupsOperations operations, System.Guid g /// ## Required Scope /// /// Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. /// <br><br> /// /// @@ -388,11 +547,6 @@ public static void AddGroupUser(this IGroupsOperations operations, System.Guid g /// /// /// - /// When user permissions to a workspace have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For more @@ -402,6 +556,13 @@ public static void AddGroupUser(this IGroupsOperations operations, System.Guid g /// ## Required Scope /// /// Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. /// <br><br> /// /// @@ -423,11 +584,6 @@ public static void UpdateGroupUser(this IGroupsOperations operations, System.Gui /// /// /// - /// When user permissions to a workspace have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For more @@ -437,6 +593,13 @@ public static void UpdateGroupUser(this IGroupsOperations operations, System.Gui /// ## Required Scope /// /// Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may not be + /// immediately available when using API calls. To refresh user permissions, + /// use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. /// <br><br> /// /// @@ -1033,9 +1196,7 @@ public static void AssignToDataflowStorage(this IGroupsOperations operations, Sy /// /// /// - /// Only the name, description and Log Analytics workspace can be updated. The - /// name must be unique inside an organization. To unassign a Log Analytics - /// workspace, explicitly set the value to null. + /// To unassign a Log Analytics workspace, explicitly set the value to null. /// /// ## Permissions /// @@ -1048,7 +1209,11 @@ public static void AssignToDataflowStorage(this IGroupsOperations operations, Sy /// /// ## Limitations /// - /// Maximum 200 requests per hour. + /// - Maximum 200 requests per hour. + /// - For Shared capacities, only the name and description can be updated. + /// - For Premium capacities, only the name, description, + /// defaultDatasetStorageFormat and Log Analytics workspace can be updated. + /// - The name must be unique inside an organization. /// <br><br> /// /// @@ -1070,9 +1235,7 @@ public static void UpdateGroupAsAdmin(this IGroupsOperations operations, System. /// /// /// - /// Only the name, description and Log Analytics workspace can be updated. The - /// name must be unique inside an organization. To unassign a Log Analytics - /// workspace, explicitly set the value to null. + /// To unassign a Log Analytics workspace, explicitly set the value to null. /// /// ## Permissions /// @@ -1085,7 +1248,11 @@ public static void UpdateGroupAsAdmin(this IGroupsOperations operations, System. /// /// ## Limitations /// - /// Maximum 200 requests per hour. + /// - Maximum 200 requests per hour. + /// - For Shared capacities, only the name and description can be updated. + /// - For Premium capacities, only the name, description, + /// defaultDatasetStorageFormat and Log Analytics workspace can be updated. + /// - The name must be unique inside an organization. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/IGroupsOperations.cs b/sdk/PowerBI.Api/Source/IGroupsOperations.cs index ed6db5b9..8893b721 100644 --- a/sdk/PowerBI.Api/Source/IGroupsOperations.cs +++ b/sdk/PowerBI.Api/Source/IGroupsOperations.cs @@ -23,12 +23,6 @@ public partial interface IGroupsOperations /// /// /// - /// When user permissions to a workspace have been recently updated, - /// the new permissions might not be immediately available through API - /// calls. To refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API - /// call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For @@ -38,6 +32,14 @@ public partial interface IGroupsOperations /// ## Required Scope /// /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may + /// not be immediately available when using API calls. To refresh user + /// permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API + /// call. /// <br><br> /// /// @@ -102,6 +104,46 @@ public partial interface IGroupsOperations /// Task> CreateGroupWithHttpMessagesAsync(GroupCreationRequest requestParameters, bool? workspaceV2 = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Returns a specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may + /// not be immediately available when using API calls. To refresh user + /// permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API + /// call. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// 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 + /// + Task> GetGroupWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Deletes the specified workspace. /// /// @@ -118,7 +160,7 @@ public partial interface IGroupsOperations /// <br><br> /// /// - /// The workspace ID to delete + /// The workspace ID /// /// /// The headers that will be added to request. @@ -131,19 +173,53 @@ public partial interface IGroupsOperations /// Task DeleteGroupWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Updates a specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - For Shared capacities, only the name can be updated. + /// - For Premium capacities, only the name and + /// defaultDatasetStorageFormat can be updated. + /// - The name must be unique inside an organization. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The properties to update + /// + /// + /// 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 UpdateGroupWithHttpMessagesAsync(System.Guid groupId, UpdateGroupRequest groupProperties, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Returns a list of users that have access to the specified /// workspace. /// /// /// - /// When user permissions to a workspace have been recently updated, - /// the new permissions might not be immediately available through API - /// calls. As a result, this API call might return an HTTP 401 error - /// when a user has permissions to a workspace. To refresh user - /// permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API - /// call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For @@ -153,6 +229,14 @@ public partial interface IGroupsOperations /// ## Required Scope /// /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may + /// not be immediately available when using API calls. To refresh user + /// permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API + /// call. /// <br><br> /// /// @@ -183,12 +267,6 @@ public partial interface IGroupsOperations /// /// /// - /// When user permissions to a workspace have been recently updated, - /// the new permissions might not be immediately available through API - /// calls. To refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API - /// call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For @@ -198,6 +276,14 @@ public partial interface IGroupsOperations /// ## Required Scope /// /// Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may + /// not be immediately available when using API calls. To refresh user + /// permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API + /// call. /// <br><br> /// /// @@ -224,12 +310,6 @@ public partial interface IGroupsOperations /// /// /// - /// When user permissions to a workspace have been recently updated, - /// the new permissions might not be immediately available through API - /// calls. To refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API - /// call. - /// /// ## Permissions /// /// This API call can be called by a service principal profile. For @@ -239,6 +319,14 @@ public partial interface IGroupsOperations /// ## Required Scope /// /// Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// - User permissions for workspaces take time to get updated and may + /// not be immediately available when using API calls. To refresh user + /// permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API + /// call. /// <br><br> /// /// @@ -579,9 +667,7 @@ public partial interface IGroupsOperations /// /// /// - /// Only the name, description and Log Analytics workspace can be - /// updated. The name must be unique inside an organization. To - /// unassign a Log Analytics workspace, explicitly set the value to + /// To unassign a Log Analytics workspace, explicitly set the value to /// null. /// /// ## Permissions @@ -595,7 +681,13 @@ public partial interface IGroupsOperations /// /// ## Limitations /// - /// Maximum 200 requests per hour. + /// - Maximum 200 requests per hour. + /// - For Shared capacities, only the name and description can be + /// updated. + /// - For Premium capacities, only the name, description, + /// defaultDatasetStorageFormat and Log Analytics workspace can be + /// updated. + /// - The name must be unique inside an organization. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/Models/AdminGroup.cs b/sdk/PowerBI.Api/Source/Models/AdminGroup.cs index f5ff8bb6..f9d3be7b 100644 --- a/sdk/PowerBI.Api/Source/Models/AdminGroup.cs +++ b/sdk/PowerBI.Api/Source/Models/AdminGroup.cs @@ -35,6 +35,10 @@ public AdminGroup() /// The capacity ID /// The Power BI dataflow storage /// account ID + /// The default dataset + /// storage format in the workspace. Returned only when + /// `isOnDedicatedCapacity` is `true`. Possible values include: + /// 'Small', 'Large' /// The Log Analytics workspace /// assigned to the group. This is returned only when retrieving a /// single group. @@ -65,7 +69,7 @@ public AdminGroup() /// workspace is assigned to. /// Whether the workspace has /// custom settings - public AdminGroup(System.Guid id, string name = default(string), bool? isReadOnly = default(bool?), bool? isOnDedicatedCapacity = default(bool?), System.Guid? capacityId = default(System.Guid?), System.Guid? dataflowStorageId = default(System.Guid?), AzureResource logAnalyticsWorkspace = default(AzureResource), string description = default(string), GroupType? type = default(GroupType?), string state = default(string), IList users = default(IList), IList reports = default(IList), IList dashboards = default(IList), IList datasets = default(IList), IList dataflows = default(IList), IList workbooks = default(IList), System.Guid? pipelineId = default(System.Guid?), bool? hasWorkspaceLevelSettings = default(bool?)) + public AdminGroup(System.Guid id, string name = default(string), bool? isReadOnly = default(bool?), bool? isOnDedicatedCapacity = default(bool?), System.Guid? capacityId = default(System.Guid?), System.Guid? dataflowStorageId = default(System.Guid?), string defaultDatasetStorageFormat = default(string), AzureResource logAnalyticsWorkspace = default(AzureResource), string description = default(string), GroupType? type = default(GroupType?), string state = default(string), IList users = default(IList), IList reports = default(IList), IList dashboards = default(IList), IList datasets = default(IList), IList dataflows = default(IList), IList workbooks = default(IList), System.Guid? pipelineId = default(System.Guid?), bool? hasWorkspaceLevelSettings = default(bool?)) { Id = id; Name = name; @@ -73,6 +77,7 @@ public AdminGroup() IsOnDedicatedCapacity = isOnDedicatedCapacity; CapacityId = capacityId; DataflowStorageId = dataflowStorageId; + DefaultDatasetStorageFormat = defaultDatasetStorageFormat; LogAnalyticsWorkspace = logAnalyticsWorkspace; Description = description; Type = type; @@ -129,6 +134,14 @@ public AdminGroup() [JsonProperty(PropertyName = "dataflowStorageId")] public System.Guid? DataflowStorageId { get; set; } + /// + /// Gets or sets the default dataset storage format in the workspace. + /// Returned only when `isOnDedicatedCapacity` is `true`. Possible + /// values include: 'Small', 'Large' + /// + [JsonProperty(PropertyName = "defaultDatasetStorageFormat")] + public string DefaultDatasetStorageFormat { get; set; } + /// /// Gets or sets the Log Analytics workspace assigned to the group. /// This is returned only when retrieving a single group. diff --git a/sdk/PowerBI.Api/Source/Models/DefaultDatasetStorageFormat.cs b/sdk/PowerBI.Api/Source/Models/DefaultDatasetStorageFormat.cs new file mode 100644 index 00000000..098583bb --- /dev/null +++ b/sdk/PowerBI.Api/Source/Models/DefaultDatasetStorageFormat.cs @@ -0,0 +1,24 @@ +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.PowerBI.Api.Models +{ + + /// + /// Defines values for DefaultDatasetStorageFormat. + /// + public static class DefaultDatasetStorageFormat + { + /// + /// Small dataset storage format + /// + public const string Small = "Small"; + /// + /// Large dataset storage format + /// + public const string Large = "Large"; + } +} diff --git a/sdk/PowerBI.Api/Source/Models/Group.cs b/sdk/PowerBI.Api/Source/Models/Group.cs index b760b41e..4f6129a6 100644 --- a/sdk/PowerBI.Api/Source/Models/Group.cs +++ b/sdk/PowerBI.Api/Source/Models/Group.cs @@ -33,10 +33,14 @@ public Group() /// The capacity ID /// The Power BI dataflow storage /// account ID + /// The default dataset + /// storage format in the workspace. Returned only when + /// `isOnDedicatedCapacity` is `true`. Possible values include: + /// 'Small', 'Large' /// The Log Analytics workspace /// assigned to the group. This is returned only when retrieving a /// single group. - public Group(System.Guid id, string name = default(string), bool? isReadOnly = default(bool?), bool? isOnDedicatedCapacity = default(bool?), System.Guid? capacityId = default(System.Guid?), System.Guid? dataflowStorageId = default(System.Guid?), AzureResource logAnalyticsWorkspace = default(AzureResource)) + public Group(System.Guid id, string name = default(string), bool? isReadOnly = default(bool?), bool? isOnDedicatedCapacity = default(bool?), System.Guid? capacityId = default(System.Guid?), System.Guid? dataflowStorageId = default(System.Guid?), string defaultDatasetStorageFormat = default(string), AzureResource logAnalyticsWorkspace = default(AzureResource)) { Id = id; Name = name; @@ -44,6 +48,7 @@ public Group() IsOnDedicatedCapacity = isOnDedicatedCapacity; CapacityId = capacityId; DataflowStorageId = dataflowStorageId; + DefaultDatasetStorageFormat = defaultDatasetStorageFormat; LogAnalyticsWorkspace = logAnalyticsWorkspace; CustomInit(); } @@ -89,6 +94,14 @@ public Group() [JsonProperty(PropertyName = "dataflowStorageId")] public System.Guid? DataflowStorageId { get; set; } + /// + /// Gets or sets the default dataset storage format in the workspace. + /// Returned only when `isOnDedicatedCapacity` is `true`. Possible + /// values include: 'Small', 'Large' + /// + [JsonProperty(PropertyName = "defaultDatasetStorageFormat")] + public string DefaultDatasetStorageFormat { get; set; } + /// /// Gets or sets the Log Analytics workspace assigned to the group. /// This is returned only when retrieving a single group. diff --git a/sdk/PowerBI.Api/Source/Models/GroupExtendedProperties.cs b/sdk/PowerBI.Api/Source/Models/GroupExtendedProperties.cs index aff4220b..7251a61b 100644 --- a/sdk/PowerBI.Api/Source/Models/GroupExtendedProperties.cs +++ b/sdk/PowerBI.Api/Source/Models/GroupExtendedProperties.cs @@ -28,15 +28,20 @@ public GroupExtendedProperties() /// The capacity ID /// The Power BI dataflow storage /// account ID + /// The default dataset + /// storage format in the workspace. Returned only when + /// `isOnDedicatedCapacity` is `true`. Possible values include: + /// 'Small', 'Large' /// The Log Analytics workspace /// assigned to the group. This is returned only when retrieving a /// single group. - public GroupExtendedProperties(bool? isReadOnly = default(bool?), bool? isOnDedicatedCapacity = default(bool?), System.Guid? capacityId = default(System.Guid?), System.Guid? dataflowStorageId = default(System.Guid?), AzureResource logAnalyticsWorkspace = default(AzureResource)) + public GroupExtendedProperties(bool? isReadOnly = default(bool?), bool? isOnDedicatedCapacity = default(bool?), System.Guid? capacityId = default(System.Guid?), System.Guid? dataflowStorageId = default(System.Guid?), string defaultDatasetStorageFormat = default(string), AzureResource logAnalyticsWorkspace = default(AzureResource)) { IsReadOnly = isReadOnly; IsOnDedicatedCapacity = isOnDedicatedCapacity; CapacityId = capacityId; DataflowStorageId = dataflowStorageId; + DefaultDatasetStorageFormat = defaultDatasetStorageFormat; LogAnalyticsWorkspace = logAnalyticsWorkspace; CustomInit(); } @@ -70,6 +75,14 @@ public GroupExtendedProperties() [JsonProperty(PropertyName = "dataflowStorageId")] public System.Guid? DataflowStorageId { get; set; } + /// + /// Gets or sets the default dataset storage format in the workspace. + /// Returned only when `isOnDedicatedCapacity` is `true`. Possible + /// values include: 'Small', 'Large' + /// + [JsonProperty(PropertyName = "defaultDatasetStorageFormat")] + public string DefaultDatasetStorageFormat { get; set; } + /// /// Gets or sets the Log Analytics workspace assigned to the group. /// This is returned only when retrieving a single group. diff --git a/sdk/PowerBI.Api/Source/Models/UpdateGroupRequest.cs b/sdk/PowerBI.Api/Source/Models/UpdateGroupRequest.cs new file mode 100644 index 00000000..53f8f2d6 --- /dev/null +++ b/sdk/PowerBI.Api/Source/Models/UpdateGroupRequest.cs @@ -0,0 +1,58 @@ +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.PowerBI.Api.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An update request for the group + /// + public partial class UpdateGroupRequest + { + /// + /// Initializes a new instance of the UpdateGroupRequest class. + /// + public UpdateGroupRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the UpdateGroupRequest class. + /// + /// The group name + /// The default dataset + /// storage format in the group. Possible values include: 'Small', + /// 'Large' + public UpdateGroupRequest(string name = default(string), string defaultDatasetStorageFormat = default(string)) + { + Name = name; + DefaultDatasetStorageFormat = defaultDatasetStorageFormat; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the group name + /// + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or sets the default dataset storage format in the group. + /// Possible values include: 'Small', 'Large' + /// + [JsonProperty(PropertyName = "defaultDatasetStorageFormat")] + public string DefaultDatasetStorageFormat { get; set; } + + } +} diff --git a/sdk/PowerBI.Api/Source/Models/WorkspaceInfo.cs b/sdk/PowerBI.Api/Source/Models/WorkspaceInfo.cs index a632505d..a4614fed 100644 --- a/sdk/PowerBI.Api/Source/Models/WorkspaceInfo.cs +++ b/sdk/PowerBI.Api/Source/Models/WorkspaceInfo.cs @@ -37,6 +37,10 @@ public WorkspaceInfo() /// Whether the workspace is /// assigned to a dedicated capacity /// The workspace capacity ID + /// The default dataset + /// storage format in the workspace. Returned only when + /// `isOnDedicatedCapacity` is `true`. Possible values include: + /// 'Small', 'Large' /// The reports associated with this workspace. /// The list of report properties returned varies for different API /// calls, so you might not see all report properties in an API @@ -61,7 +65,7 @@ public WorkspaceInfo() /// list is returned only when explicitly requested. To retrieve a list /// of users for a classic workspace, use the Azure Active Directory /// Graph API. - public WorkspaceInfo(System.Guid id, string name = default(string), string description = default(string), string type = default(string), string state = default(string), string dataRetrievalState = default(string), bool? isOnDedicatedCapacity = default(bool?), string capacityId = default(string), IList reports = default(IList), IList dashboards = default(IList), IList datasets = default(IList), IList dataflows = default(IList), IList datamarts = default(IList), IList users = default(IList)) + public WorkspaceInfo(System.Guid id, string name = default(string), string description = default(string), string type = default(string), string state = default(string), string dataRetrievalState = default(string), bool? isOnDedicatedCapacity = default(bool?), string capacityId = default(string), string defaultDatasetStorageFormat = default(string), IList reports = default(IList), IList dashboards = default(IList), IList datasets = default(IList), IList dataflows = default(IList), IList datamarts = default(IList), IList users = default(IList)) { Id = id; Name = name; @@ -71,6 +75,7 @@ public WorkspaceInfo() DataRetrievalState = dataRetrievalState; IsOnDedicatedCapacity = isOnDedicatedCapacity; CapacityId = capacityId; + DefaultDatasetStorageFormat = defaultDatasetStorageFormat; Reports = reports; Dashboards = dashboards; Datasets = datasets; @@ -134,6 +139,14 @@ public WorkspaceInfo() [JsonProperty(PropertyName = "capacityId")] public string CapacityId { get; set; } + /// + /// Gets or sets the default dataset storage format in the workspace. + /// Returned only when `isOnDedicatedCapacity` is `true`. Possible + /// values include: 'Small', 'Large' + /// + [JsonProperty(PropertyName = "defaultDatasetStorageFormat")] + public string DefaultDatasetStorageFormat { get; set; } + /// /// Gets or sets the reports associated with this workspace. The list /// of report properties returned varies for different API calls, so diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 5b520113..954ac21e 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -10925,7 +10925,7 @@ "Groups" ], "summary": "Returns a list of workspaces the user has access to.", - "description": "\nWhen user permissions to a workspace have been recently updated, the new permissions might not be immediately available through API calls. To refresh user permissions, use the [Refresh User Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call.\n\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nWorkspace.Read.All or Workspace.ReadWrite.All\n

", + "description": "\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nWorkspace.Read.All or Workspace.ReadWrite.All\n\n## Limitations\n\n- User permissions for workspaces take time to get updated and may not be immediately available when using API calls. To refresh user permissions, use the [Refresh User Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call.\n

", "operationId": "Groups_GetGroups", "consumes": [], "produces": [ @@ -10979,13 +10979,17 @@ { "id": "3d9b93c6-7b6d-4801-a491-1738910904fd", "isReadOnly": false, - "isOnDedicatedCapacity": false, + "isOnDedicatedCapacity": true, + "capacityId": "0f084df7-c13d-451b-af5f-ed0c466403b2", + "defaultDatasetStorageFormat": "Small", "name": "marketing group" }, { "id": "a2f89923-421a-464e-bf4c-25eab39bb09f", "isReadOnly": false, - "isOnDedicatedCapacity": false, + "isOnDedicatedCapacity": true, + "capacityId": "0f084df7-c13d-451b-af5f-ed0c466403b2", + "defaultDatasetStorageFormat": "Large", "name": "contoso", "dataflowStorageId": "d692ae06-708c-485e-9987-06ff0fbdbb1f" } @@ -11103,6 +11107,54 @@ } }, "/v1.0/myorg/groups/{groupId}": { + "get": { + "tags": [ + "Groups" + ], + "summary": "Returns a specified workspace.", + "description": "\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nWorkspace.Read.All or Workspace.ReadWrite.All\n\n## Limitations\n\n- User permissions for workspaces take time to get updated and may not be immediately available when using API calls. To refresh user permissions, use the [Refresh User Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call.\n

", + "operationId": "Groups_GetGroup", + "consumes": [], + "produces": [], + "parameters": [ + { + "name": "groupId", + "in": "path", + "required": true, + "description": "The workspace ID", + "type": "string", + "format": "uuid" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "$ref": "#/definitions/Group" + } + } + }, + "x-ms-examples": { + "Example": { + "parameters": { + "groupId": "f089354e-8366-4e18-aea3-4cb4a3a50b48" + }, + "responses": { + "200": { + "body": { + "id": "f089354e-8366-4e18-aea3-4cb4a3a50b48", + "isReadOnly": false, + "isOnDedicatedCapacity": true, + "capacityId": "0f084df7-c13d-451b-af5f-ed0c466403b2", + "defaultDatasetStorageFormat": "Small", + "name": "Sample Group 1" + } + } + } + } + }, + "deprecated": false + }, "delete": { "tags": [ "Groups" @@ -11117,7 +11169,7 @@ "name": "groupId", "in": "path", "required": true, - "description": "The workspace ID to delete", + "description": "The workspace ID", "type": "string", "format": "uuid" } @@ -11138,6 +11190,55 @@ } }, "deprecated": false + }, + "patch": { + "tags": [ + "Groups" + ], + "summary": "Updates a specified workspace.", + "description": "\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nWorkspace.ReadWrite.All\n\n## Limitations\n\n- For Shared capacities, only the name can be updated.\n- For Premium capacities, only the name and defaultDatasetStorageFormat can be updated.\n- The name must be unique inside an organization.\n

", + "operationId": "Groups_UpdateGroup", + "consumes": [], + "produces": [], + "parameters": [ + { + "name": "groupId", + "in": "path", + "required": true, + "description": "The workspace ID", + "type": "string", + "format": "uuid" + }, + { + "name": "groupProperties", + "in": "body", + "required": true, + "description": "The properties to update", + "schema": { + "$ref": "#/definitions/UpdateGroupRequest" + } + } + ], + "responses": { + "200": { + "description": "OK" + } + }, + "x-ms-examples": { + "Example": { + "parameters": { + "groupId": "e2284830-c8dc-416b-b19a-8cdcd2729332", + "groupProperties": { + "name": "Updated Sales Results", + "defaultDatasetStorageFormat": "Large" + } + }, + "responses": { + "200": {} + } + } + }, + "deprecated": false } }, "/v1.0/myorg/groups/{groupId}/users": { @@ -11146,7 +11247,7 @@ "Groups" ], "summary": "Returns a list of users that have access to the specified workspace.", - "description": "\nWhen user permissions to a workspace have been recently updated, the new permissions might not be immediately available through API calls. As a result, this API call might return an HTTP 401 error when a user has permissions to a workspace. To refresh user permissions, use the [Refresh User Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call.\n\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nWorkspace.Read.All or Workspace.ReadWrite.All\n

", + "description": "\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nWorkspace.Read.All or Workspace.ReadWrite.All\n\n## Limitations\n\n- User permissions for workspaces take time to get updated and may not be immediately available when using API calls. To refresh user permissions, use the [Refresh User Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call.\n

", "operationId": "Groups_GetGroupUsers", "consumes": [], "produces": [ @@ -11226,7 +11327,7 @@ "Groups" ], "summary": "Grants the specified user the specified permissions to the specified workspace.", - "description": "\nWhen user permissions to a workspace have been recently updated, the new permissions might not be immediately available through API calls. To refresh user permissions, use the [Refresh User Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call.\n\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nWorkspace.ReadWrite.All\n

", + "description": "\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nWorkspace.ReadWrite.All\n\n## Limitations\n\n- User permissions for workspaces take time to get updated and may not be immediately available when using API calls. To refresh user permissions, use the [Refresh User Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call.\n

", "operationId": "Groups_AddGroupUser", "consumes": [ "application/json" @@ -11290,7 +11391,7 @@ "Groups" ], "summary": "Updates the specified user permissions to the specified workspace.", - "description": "\nWhen user permissions to a workspace have been recently updated, the new permissions might not be immediately available through API calls. To refresh user permissions, use the [Refresh User Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call.\n\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nWorkspace.ReadWrite.All\n

", + "description": "\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nWorkspace.ReadWrite.All\n\n## Limitations\n\n- User permissions for workspaces take time to get updated and may not be immediately available when using API calls. To refresh user permissions, use the [Refresh User Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call.\n

", "operationId": "Groups_UpdateGroupUser", "consumes": [ "application/json" @@ -13987,7 +14088,9 @@ "name": "V2 shared", "type": "Workspace", "state": "Active", - "isOnDedicatedCapacity": false, + "isOnDedicatedCapacity": true, + "capacityId": "0f084df7-c13d-451b-af5f-ed0c466403b2", + "defaultDatasetStorageFormat": "Small", "reports": [ { "id": "c6d072d1-ed20-4b60-8329-16c4b934203b", @@ -14699,7 +14802,9 @@ { "id": "e380d1d0-1fa6-460b-9a90-1a5c6b02414c", "isReadOnly": false, - "isOnDedicatedCapacity": false, + "isOnDedicatedCapacity": true, + "capacityId": "0f084df7-c13d-451b-af5f-ed0c466403b2", + "defaultDatasetStorageFormat": "Small", "name": "Sample Group 1", "description": "Sample group", "type": "Workspace", @@ -14933,7 +15038,9 @@ { "id": "e380d1d0-1fa6-460b-9a90-1a5c6b02414c", "isReadOnly": false, - "isOnDedicatedCapacity": false, + "isOnDedicatedCapacity": true, + "capacityId": "0f084df7-c13d-451b-af5f-ed0c466403b2", + "defaultDatasetStorageFormat": "Small", "name": "Sample Group 1", "description": "Sample group", "type": "Workspace", @@ -15051,19 +15158,23 @@ }, "responses": { "200": { - "id": "e380d1d0-1fa6-460b-9a90-1a5c6b02414c", - "isReadOnly": false, - "isOnDedicatedCapacity": false, - "name": "Sample Group 1", - "description": "Sample group", - "type": "Workspace", - "state": "Active", - "users": [ - { - "emailAddress": "john@contoso.com", - "groupUserAccessRight": "Admin" - } - ] + "body": { + "id": "e380d1d0-1fa6-460b-9a90-1a5c6b02414c", + "isReadOnly": false, + "isOnDedicatedCapacity": true, + "capacityId": "0f084df7-c13d-451b-af5f-ed0c466403b2", + "defaultDatasetStorageFormat": "Small", + "name": "Sample Group 1", + "description": "Sample group", + "type": "Workspace", + "state": "Active", + "users": [ + { + "emailAddress": "john@contoso.com", + "groupUserAccessRight": "Admin" + } + ] + } } } } @@ -15075,7 +15186,7 @@ "Admin" ], "summary": "Updates the properties of the specified workspace.", - "description": "\nOnly the name, description and Log Analytics workspace can be updated. The name must be unique inside an organization. To unassign a Log Analytics workspace, explicitly set the value to null.\n\n## Permissions\n\nThe user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator).\n\n## Required Scope\n\nTenant.ReadWrite.All\n\n## Limitations\n\nMaximum 200 requests per hour.\n

", + "description": "\nTo unassign a Log Analytics workspace, explicitly set the value to null.\n\n## Permissions\n\nThe user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator).\n\n## Required Scope\n\nTenant.ReadWrite.All\n\n## Limitations\n\n- Maximum 200 requests per hour.\n- For Shared capacities, only the name and description can be updated.\n- For Premium capacities, only the name, description, defaultDatasetStorageFormat and Log Analytics workspace can be updated.\n- The name must be unique inside an organization.\n

", "operationId": "Groups_UpdateGroupAsAdmin", "consumes": [], "produces": [], @@ -15104,12 +15215,13 @@ } }, "x-ms-examples": { - "Example of updating group description": { + "Example of updating group description and defaultDatasetStorageFormat": { "parameters": { "groupId": "e2284830-c8dc-416b-b19a-8cdcd2729332", "groupProperties": { "name": "Updated Sales Results", - "description": "Refreshed sales numbers" + "description": "Refreshed sales numbers", + "defaultDatasetStorageFormat": "Large" } }, "responses": { @@ -22063,6 +22175,10 @@ "type": "string", "description": "The workspace capacity ID" }, + "defaultDatasetStorageFormat": { + "description": "The default dataset storage format in the workspace. Returned only when `isOnDedicatedCapacity` is `true`", + "$ref": "#/definitions/DefaultDatasetStorageFormat" + }, "reports": { "type": "array", "description": "The reports associated with this workspace. The list of report properties returned varies for different API calls, so you might not see all report properties in an API response.", @@ -24441,6 +24557,10 @@ "format": "uuid", "description": "The Power BI dataflow storage account ID" }, + "defaultDatasetStorageFormat": { + "description": "The default dataset storage format in the workspace. Returned only when `isOnDedicatedCapacity` is `true`", + "$ref": "#/definitions/DefaultDatasetStorageFormat" + }, "logAnalyticsWorkspace": { "description": "The Log Analytics workspace assigned to the group. This is returned only when retrieving a single group.", "$ref": "#/definitions/AzureResource" @@ -24522,6 +24642,19 @@ } ] }, + "UpdateGroupRequest": { + "description": "An update request for the group", + "properties": { + "name": { + "type": "string", + "description": "The group name" + }, + "defaultDatasetStorageFormat": { + "description": "The default dataset storage format in the group", + "$ref": "#/definitions/DefaultDatasetStorageFormat" + } + } + }, "Group": { "description": "A Power BI group", "allOf": [ @@ -25420,6 +25553,28 @@ } } }, + "DefaultDatasetStorageFormat": { + "type": "string", + "description": "The default dataset storage format in the group", + "enum": [ + "Small", + "Large" + ], + "x-ms-enum": { + "name": "DefaultDatasetStorageFormat", + "modelAsString": true, + "values": [ + { + "value": "Small", + "description": "Small dataset storage format" + }, + { + "value": "Large", + "description": "Large dataset storage format" + } + ] + } + }, "DirectQueryRefreshScheduleRequest": { "required": [ "value" From 3cb70bf217c0e6a69dcb28ead3d06ec4a06a1718 Mon Sep 17 00:00:00 2001 From: Kesem Sharabi Date: Mon, 31 Jul 2023 05:28:59 +0000 Subject: [PATCH 03/35] Merged PR 429098: Execute query Execute query --- sdk/PowerBI.Api/Source/DatasetsOperations.cs | 8 ++++---- .../Source/DatasetsOperationsExtensions.cs | 16 ++++++++-------- sdk/PowerBI.Api/Source/IDatasetsOperations.cs | 8 ++++---- sdk/swaggers/swagger.json | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/sdk/PowerBI.Api/Source/DatasetsOperations.cs b/sdk/PowerBI.Api/Source/DatasetsOperations.cs index c66f3fc1..e420642a 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperations.cs @@ -842,8 +842,8 @@ public DatasetsOperations(PowerBIClient client) /// (1 million divided by 20). /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row /// will be completed but no additional rows will be written. - /// - Maximum of 120 requests per user per minute. Target dataset does not - /// impact this rate limit. + /// - There's a limit of 120 query requests per minute per user, regardless of + /// the dataset that's queried. /// - Service Principals aren't supported for datasets with RLS per [RLS /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) /// or with SSO enabled. To use Service Principals, make sure the admin tenant @@ -9936,8 +9936,8 @@ public DatasetsOperations(PowerBIClient client) /// (1 million divided by 20). /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row /// will be completed but no additional rows will be written. - /// - Maximum of 120 requests per user per minute. Target dataset does not - /// impact this rate limit. + /// - There's a limit of 120 query requests per minute per user, regardless of + /// the dataset that's queried. /// - Service Principals aren't supported for datasets with RLS per [RLS /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) /// or with SSO enabled. To use Service Principals, make sure the admin tenant diff --git a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs index d4109a92..f8f315f6 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs @@ -324,8 +324,8 @@ public static void DeleteDataset(this IDatasetsOperations operations, string dat /// (1 million divided by 20). /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row /// will be completed but no additional rows will be written. - /// - Maximum of 120 requests per user per minute. Target dataset does not - /// impact this rate limit. + /// - There's a limit of 120 query requests per minute per user, regardless of + /// the dataset that's queried. /// - Service Principals aren't supported for datasets with RLS per [RLS /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) /// or with SSO enabled. To use Service Principals, make sure the admin tenant @@ -399,8 +399,8 @@ public static DatasetExecuteQueriesResponse ExecuteQueries(this IDatasetsOperati /// (1 million divided by 20). /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row /// will be completed but no additional rows will be written. - /// - Maximum of 120 requests per user per minute. Target dataset does not - /// impact this rate limit. + /// - There's a limit of 120 query requests per minute per user, regardless of + /// the dataset that's queried. /// - Service Principals aren't supported for datasets with RLS per [RLS /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) /// or with SSO enabled. To use Service Principals, make sure the admin tenant @@ -4701,8 +4701,8 @@ public static void TakeOverInGroup(this IDatasetsOperations operations, System.G /// (1 million divided by 20). /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row /// will be completed but no additional rows will be written. - /// - Maximum of 120 requests per user per minute. Target dataset does not - /// impact this rate limit. + /// - There's a limit of 120 query requests per minute per user, regardless of + /// the dataset that's queried. /// - Service Principals aren't supported for datasets with RLS per [RLS /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) /// or with SSO enabled. To use Service Principals, make sure the admin tenant @@ -4779,8 +4779,8 @@ public static DatasetExecuteQueriesResponse ExecuteQueriesInGroup(this IDatasets /// (1 million divided by 20). /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row /// will be completed but no additional rows will be written. - /// - Maximum of 120 requests per user per minute. Target dataset does not - /// impact this rate limit. + /// - There's a limit of 120 query requests per minute per user, regardless of + /// the dataset that's queried. /// - Service Principals aren't supported for datasets with RLS per [RLS /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) /// or with SSO enabled. To use Service Principals, make sure the admin tenant diff --git a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs index 9a341a5b..c4619694 100644 --- a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs @@ -220,8 +220,8 @@ public partial interface IDatasetsOperations /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the /// current row will be completed but no additional rows will be /// written. - /// - Maximum of 120 requests per user per minute. Target dataset does - /// not impact this rate limit. + /// - There's a limit of 120 query requests per minute per user, + /// regardless of the dataset that's queried. /// - Service Principals aren't supported for datasets with RLS per /// [RLS /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) @@ -2670,8 +2670,8 @@ public partial interface IDatasetsOperations /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the /// current row will be completed but no additional rows will be /// written. - /// - Maximum of 120 requests per user per minute. Target dataset does - /// not impact this rate limit. + /// - There's a limit of 120 query requests per minute per user, + /// regardless of the dataset that's queried. /// - Service Principals aren't supported for datasets with RLS per /// [RLS /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 954ac21e..0ef1a119 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -343,7 +343,7 @@ "Datasets" ], "summary": "Executes Data Analysis Expressions (DAX) queries against the provided dataset. The dataset must reside in **My workspace** or another workspace.", - "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have dataset read permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- Maximum of 120 requests per user per minute. Target dataset does not impact this rate limit.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", + "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have dataset read permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- There's a limit of 120 query requests per minute per user, regardless of the dataset that's queried.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", "operationId": "Datasets_ExecuteQueries", "consumes": [], "produces": [ @@ -6500,7 +6500,7 @@ "Datasets" ], "summary": "Executes Data Analysis Expressions (DAX) queries against the provided dataset.", - "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have dataset read permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- Maximum of 120 requests per user per minute. Target dataset does not impact this rate limit.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", + "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have dataset read permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- There's a limit of 120 query requests per minute per user, regardless of the dataset that's queried.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", "operationId": "Datasets_ExecuteQueriesInGroup", "consumes": [], "produces": [ From 85d27b49b7690b0c17f533463f0ec15ca965b94e Mon Sep 17 00:00:00 2001 From: Sabre Ammar Date: Tue, 8 Aug 2023 12:34:33 +0000 Subject: [PATCH 04/35] Merged PR 433075: updating update datasource description Updating update datasource API description with PowerShell Scripts [Review docs](https://review.learn.microsoft.com/en-us/rest/api/power-bi/gateways/update-datasource?branch=drafts_alony1) --- sdk/PowerBI.Api/Source/GatewaysOperations.cs | 11 ++++++++-- .../Source/GatewaysOperationsExtensions.cs | 22 +++++++++++++++---- sdk/PowerBI.Api/Source/IGatewaysOperations.cs | 11 ++++++++-- sdk/swaggers/swagger.json | 3 +-- 4 files changed, 37 insertions(+), 10 deletions(-) diff --git a/sdk/PowerBI.Api/Source/GatewaysOperations.cs b/sdk/PowerBI.Api/Source/GatewaysOperations.cs index 5f35c4ff..2090ff15 100644 --- a/sdk/PowerBI.Api/Source/GatewaysOperations.cs +++ b/sdk/PowerBI.Api/Source/GatewaysOperations.cs @@ -973,14 +973,21 @@ public GatewaysOperations(PowerBIClient client) /// [On-premise encrypted credentials /// example](/rest/api/power-bi/gateways/update-datasource#on-premise-encrypted-credentials-example). /// + /// See the [Patch Datasource + /// Credentials](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/PatchDatasourceCredentials.ps1) + /// PowerShell script for an example of using this API, this script uses the + /// PowerShell script mentioned in the note below for encrypting the + /// credentials. + /// /// > [!NOTE] /// > - To encrypt credentials, see [Configure credentials /// programmatically](/power-bi/developer/embedded/configure-credentials) for /// Power BI and review the EncryptCredentials [.NET /// Core](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/.NET%20Core/EncryptCredentials), - /// [Java](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Java/EncryptCredentials) - /// and + /// [Java](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Java/EncryptCredentials), /// [Python](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Python/Encrypt%20credentials) + /// and + /// [PowerShell](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/EncryptGatewayCredentials.ps1) /// examples. /// > - Windows credentials before encryption look like the credentials in /// the credentials of [Basic credentials diff --git a/sdk/PowerBI.Api/Source/GatewaysOperationsExtensions.cs b/sdk/PowerBI.Api/Source/GatewaysOperationsExtensions.cs index 4bd2ed40..ef3fea79 100644 --- a/sdk/PowerBI.Api/Source/GatewaysOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/GatewaysOperationsExtensions.cs @@ -484,14 +484,21 @@ public static void DeleteDatasource(this IGatewaysOperations operations, System. /// [On-premise encrypted credentials /// example](/rest/api/power-bi/gateways/update-datasource#on-premise-encrypted-credentials-example). /// + /// See the [Patch Datasource + /// Credentials](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/PatchDatasourceCredentials.ps1) + /// PowerShell script for an example of using this API, this script uses the + /// PowerShell script mentioned in the note below for encrypting the + /// credentials. + /// /// > [!NOTE] /// > - To encrypt credentials, see [Configure credentials /// programmatically](/power-bi/developer/embedded/configure-credentials) for /// Power BI and review the EncryptCredentials [.NET /// Core](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/.NET%20Core/EncryptCredentials), - /// [Java](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Java/EncryptCredentials) - /// and + /// [Java](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Java/EncryptCredentials), /// [Python](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Python/Encrypt%20credentials) + /// and + /// [PowerShell](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/EncryptGatewayCredentials.ps1) /// examples. /// > - Windows credentials before encryption look like the credentials in /// the credentials of [Basic credentials @@ -567,14 +574,21 @@ public static void UpdateDatasource(this IGatewaysOperations operations, System. /// [On-premise encrypted credentials /// example](/rest/api/power-bi/gateways/update-datasource#on-premise-encrypted-credentials-example). /// + /// See the [Patch Datasource + /// Credentials](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/PatchDatasourceCredentials.ps1) + /// PowerShell script for an example of using this API, this script uses the + /// PowerShell script mentioned in the note below for encrypting the + /// credentials. + /// /// > [!NOTE] /// > - To encrypt credentials, see [Configure credentials /// programmatically](/power-bi/developer/embedded/configure-credentials) for /// Power BI and review the EncryptCredentials [.NET /// Core](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/.NET%20Core/EncryptCredentials), - /// [Java](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Java/EncryptCredentials) - /// and + /// [Java](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Java/EncryptCredentials), /// [Python](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Python/Encrypt%20credentials) + /// and + /// [PowerShell](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/EncryptGatewayCredentials.ps1) /// examples. /// > - Windows credentials before encryption look like the credentials in /// the credentials of [Basic credentials diff --git a/sdk/PowerBI.Api/Source/IGatewaysOperations.cs b/sdk/PowerBI.Api/Source/IGatewaysOperations.cs index 5881d823..d0b7999a 100644 --- a/sdk/PowerBI.Api/Source/IGatewaysOperations.cs +++ b/sdk/PowerBI.Api/Source/IGatewaysOperations.cs @@ -271,14 +271,21 @@ public partial interface IGatewaysOperations /// in the [On-premise encrypted credentials /// example](/rest/api/power-bi/gateways/update-datasource#on-premise-encrypted-credentials-example). /// + /// See the [Patch Datasource + /// Credentials](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/PatchDatasourceCredentials.ps1) + /// PowerShell script for an example of using this API, this script + /// uses the PowerShell script mentioned in the note below for + /// encrypting the credentials. + /// /// > [!NOTE] /// > - To encrypt credentials, see [Configure credentials /// programmatically](/power-bi/developer/embedded/configure-credentials) /// for Power BI and review the EncryptCredentials [.NET /// Core](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/.NET%20Core/EncryptCredentials), - /// [Java](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Java/EncryptCredentials) - /// and + /// [Java](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Java/EncryptCredentials), /// [Python](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Python/Encrypt%20credentials) + /// and + /// [PowerShell](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/EncryptGatewayCredentials.ps1) /// examples. /// > - Windows credentials before encryption look like the /// credentials in the credentials of [Basic credentials diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 0ef1a119..6a9b0e70 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -10502,8 +10502,7 @@ "Gateways" ], "summary": "Updates the credentials of the specified data source from the specified gateway.", - "description": "\nOn Premises data source credentials must be encrypted, as described in the [On-premise encrypted credentials example](/rest/api/power-bi/gateways/update-datasource#on-premise-encrypted-credentials-example). \n\n> [!NOTE]\n> - To encrypt credentials, see [Configure credentials programmatically](/power-bi/developer/embedded/configure-credentials) for Power BI and review the EncryptCredentials [.NET Core](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/.NET%20Core/EncryptCredentials), [Java](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Java/EncryptCredentials) and [Python](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Python/Encrypt%20credentials) examples.\n> - Windows credentials before encryption look like the credentials in the credentials of [Basic credentials example](/rest/api/power-bi/gateways/update-datasource#basic-credentials-example).\n\nWhen changing from single sign-on to other credential types, such as `Basic` or `OAuth2`, set the parameter `useEndUserOAuth2Credentials` to `false` as described in the [Basic credentials example](/rest/api/power-bi/gateways/update-datasource#basic-credentials-example).\n\nOAuth 2.0 credentials are valid as long as the provided token is valid. When using the OAuth 2.0 credential type, do the following: \n- Set the OAuth 2.0 token audience correctly, according to the data source type. \n- Send the OAuth 2.0 token in the payload as shown in the [OAuth 2.0 credentials example](/rest/api/power-bi/gateways/update-datasource#oauth-2.0-credentials-example).\n- If you're using **Extension** data sources, don't set `useCallerAADIdentity` to `true`.\n\n## Permissions\n\n- With on-premises gateways, the user must have gateway admin permissions.\n- With cloud data sources, user must be the data source owner. Use [Datasets - Take Over API](/rest/api/power-bi/datasets/take-over-in-group) to transfer ownership over the specified dataset or [Paginated reports - Take Over API](/rest/api/power-bi/reports/take-over-in-group) to transfer ownership of the data sources over the specified paginated report.\n- This API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nDataset.ReadWrite.All\n\n## Limitations\n\n- When setting OAuth credentials, a refresh token isn't incorporated as it is when setting credentials through the UI in Power BI service. Therefore, credentials can only be used for one hour.\n- Virtual network (VNet) gateways aren't supported.\n- SAS Token credentials are supported only with AzureBlobStorage and AzureDataLakeStorage.\n

", - "operationId": "Gateways_UpdateDatasource", + "description": "\nOn Premises data source credentials must be encrypted, as described in the [On-premise encrypted credentials example](/rest/api/power-bi/gateways/update-datasource#on-premise-encrypted-credentials-example). \n\n See the [Patch Datasource Credentials](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/PatchDatasourceCredentials.ps1) PowerShell script for an example of using this API, this script uses the PowerShell script mentioned in the note below for encrypting the credentials. \n\n> [!NOTE]\n> - To encrypt credentials, see [Configure credentials programmatically](/power-bi/developer/embedded/configure-credentials) for Power BI and review the EncryptCredentials [.NET Core](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/.NET%20Core/EncryptCredentials), [Java](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Java/EncryptCredentials), [Python](https://github.com/microsoft/PowerBI-Developer-Samples/tree/master/Python/Encrypt%20credentials) and [PowerShell](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/EncryptGatewayCredentials.ps1) examples.\n> - Windows credentials before encryption look like the credentials in the credentials of [Basic credentials example](/rest/api/power-bi/gateways/update-datasource#basic-credentials-example).\n\nWhen changing from single sign-on to other credential types, such as `Basic` or `OAuth2`, set the parameter `useEndUserOAuth2Credentials` to `false` as described in the [Basic credentials example](/rest/api/power-bi/gateways/update-datasource#basic-credentials-example).\n\nOAuth 2.0 credentials are valid as long as the provided token is valid. When using the OAuth 2.0 credential type, do the following: \n- Set the OAuth 2.0 token audience correctly, according to the data source type. \n- Send the OAuth 2.0 token in the payload as shown in the [OAuth 2.0 credentials example](/rest/api/power-bi/gateways/update-datasource#oauth-2.0-credentials-example).\n- If you're using **Extension** data sources, don't set `useCallerAADIdentity` to `true`.\n\n## Permissions\n\n- With on-premises gateways, the user must have gateway admin permissions.\n- With cloud data sources, user must be the data source owner. Use [Datasets - Take Over API](/rest/api/power-bi/datasets/take-over-in-group) to transfer ownership over the specified dataset or [Paginated reports - Take Over API](/rest/api/power-bi/reports/take-over-in-group) to transfer ownership of the data sources over the specified paginated report.\n- This API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nDataset.ReadWrite.All\n\n## Limitations\n\n- When setting OAuth credentials, a refresh token isn't incorporated as it is when setting credentials through the UI in Power BI service. Therefore, credentials can only be used for one hour.\n- Virtual network (VNet) gateways aren't supported.\n- SAS Token credentials are supported only with AzureBlobStorage and AzureDataLakeStorage.\n

", "operationId": "Gateways_UpdateDatasource", "consumes": [], "produces": [], "parameters": [ From 571c0c8b55946862d49f72c883d5e724df386e25 Mon Sep 17 00:00:00 2001 From: Sabre Ammar Date: Mon, 21 Aug 2023 05:44:57 +0000 Subject: [PATCH 05/35] Merged PR 438492: Export report docs update adding a note which link the PowerShell script and states that Try-it feature doesn't support this API. --- sdk/PowerBI.Api/Source/IReportsOperations.cs | 12 ++++++++++ sdk/PowerBI.Api/Source/ReportsOperations.cs | 12 ++++++++++ .../Source/ReportsOperationsExtensions.cs | 24 +++++++++++++++++++ sdk/swaggers/swagger.json | 4 ++-- 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/sdk/PowerBI.Api/Source/IReportsOperations.cs b/sdk/PowerBI.Api/Source/IReportsOperations.cs index 9f9b5f81..e4128b8a 100644 --- a/sdk/PowerBI.Api/Source/IReportsOperations.cs +++ b/sdk/PowerBI.Api/Source/IReportsOperations.cs @@ -166,6 +166,12 @@ public partial interface IReportsOperations /// [Download a report from the Power BI service to Power BI /// Desktop](/power-bi/create-reports/service-export-to-pbix). /// + /// > [!NOTE] + /// > Try-it feature is not supported for this API. + /// See [Export Power BI + /// Report](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/Export-PowerBIReport.ps1) + /// Powershell script for an example of how to use this API. + /// /// ## Required Scope /// /// Report.ReadWrite.All or both Report.Read.All and Dataset.Read.All @@ -713,6 +719,12 @@ public partial interface IReportsOperations /// more information see: [Service principal profiles in Power BI /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). /// + /// > [!NOTE] + /// > Try-it feature is not supported for this API. + /// See [Export Power BI + /// Report](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/Export-PowerBIReport.ps1) + /// Powershell script for an example of how to use this API. + /// /// ## Required Scope /// /// Report.ReadWrite.All or both Report.Read.All and Dataset.Read.All diff --git a/sdk/PowerBI.Api/Source/ReportsOperations.cs b/sdk/PowerBI.Api/Source/ReportsOperations.cs index 2c55344f..f8381c31 100644 --- a/sdk/PowerBI.Api/Source/ReportsOperations.cs +++ b/sdk/PowerBI.Api/Source/ReportsOperations.cs @@ -636,6 +636,12 @@ public ReportsOperations(PowerBIClient client) /// report from the Power BI service to Power BI /// Desktop](/power-bi/create-reports/service-export-to-pbix). /// + /// > [!NOTE] + /// > Try-it feature is not supported for this API. + /// See [Export Power BI + /// Report](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/Export-PowerBIReport.ps1) + /// Powershell script for an example of how to use this API. + /// /// ## Required Scope /// /// Report.ReadWrite.All or both Report.Read.All and Dataset.Read.All @@ -2801,6 +2807,12 @@ public ReportsOperations(PowerBIClient client) /// information see: [Service principal profiles in Power BI /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). /// + /// > [!NOTE] + /// > Try-it feature is not supported for this API. + /// See [Export Power BI + /// Report](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/Export-PowerBIReport.ps1) + /// Powershell script for an example of how to use this API. + /// /// ## Required Scope /// /// Report.ReadWrite.All or both Report.Read.All and Dataset.Read.All diff --git a/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs index 820597e8..604b92b7 100644 --- a/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs @@ -268,6 +268,12 @@ public static Report CloneReport(this IReportsOperations operations, System.Guid /// report from the Power BI service to Power BI /// Desktop](/power-bi/create-reports/service-export-to-pbix). /// + /// > [!NOTE] + /// > Try-it feature is not supported for this API. + /// See [Export Power BI + /// Report](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/Export-PowerBIReport.ps1) + /// Powershell script for an example of how to use this API. + /// /// ## Required Scope /// /// Report.ReadWrite.All or both Report.Read.All and Dataset.Read.All @@ -308,6 +314,12 @@ public static Stream ExportReport(this IReportsOperations operations, System.Gui /// report from the Power BI service to Power BI /// Desktop](/power-bi/create-reports/service-export-to-pbix). /// + /// > [!NOTE] + /// > Try-it feature is not supported for this API. + /// See [Export Power BI + /// Report](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/Export-PowerBIReport.ps1) + /// Powershell script for an example of how to use this API. + /// /// ## Required Scope /// /// Report.ReadWrite.All or both Report.Read.All and Dataset.Read.All @@ -1238,6 +1250,12 @@ public static Report CloneReportInGroup(this IReportsOperations operations, Syst /// information see: [Service principal profiles in Power BI /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). /// + /// > [!NOTE] + /// > Try-it feature is not supported for this API. + /// See [Export Power BI + /// Report](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/Export-PowerBIReport.ps1) + /// Powershell script for an example of how to use this API. + /// /// ## Required Scope /// /// Report.ReadWrite.All or both Report.Read.All and Dataset.Read.All @@ -1285,6 +1303,12 @@ public static Stream ExportReportInGroup(this IReportsOperations operations, Sys /// information see: [Service principal profiles in Power BI /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). /// + /// > [!NOTE] + /// > Try-it feature is not supported for this API. + /// See [Export Power BI + /// Report](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/Export-PowerBIReport.ps1) + /// Powershell script for an example of how to use this API. + /// /// ## Required Scope /// /// Report.ReadWrite.All or both Report.Read.All and Dataset.Read.All diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 6a9b0e70..b062f494 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -3236,7 +3236,7 @@ "Reports" ], "summary": "Exports the specified report from **My workspace** to a Power BI .pbix or .rdl file.", - "description": "\n- For .pbix reports - \n As a [workaround](/power-bi/developer/embedded/troubleshoot-rest-api#fix-timeout-exceptions-when-using-import-and-export-apis) for timeout issues, set the `preferClientRouting` URL query parameter to `true`.\n- Large files are downloaded to a temporary blob. Their URL is returned in the response, and stored in the locally downloaded Power BI .pbix file.\n- For more information on requirements and limitations, see [Download a report from the Power BI service to Power BI Desktop](/power-bi/create-reports/service-export-to-pbix).\n\n## Required Scope\n\nReport.ReadWrite.All or both Report.Read.All and Dataset.Read.All\n\n## Limitations\n\nFor .pbix report, after calling [Rebind Report](/rest/api/power-bi/reports/rebind-report), export of a report with a [Power BI service live connection](/power-bi/desktop-report-lifecycle-datasets) isn't supported.\n

", + "description": "\n- For .pbix reports - \n As a [workaround](/power-bi/developer/embedded/troubleshoot-rest-api#fix-timeout-exceptions-when-using-import-and-export-apis) for timeout issues, set the `preferClientRouting` URL query parameter to `true`.\n- Large files are downloaded to a temporary blob. Their URL is returned in the response, and stored in the locally downloaded Power BI .pbix file.\n- For more information on requirements and limitations, see [Download a report from the Power BI service to Power BI Desktop](/power-bi/create-reports/service-export-to-pbix).\n\n> [!NOTE]\n> Try-it feature is not supported for this API.\n See [Export Power BI Report](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/Export-PowerBIReport.ps1) Powershell script for an example of how to use this API.\n\n## Required Scope\n\nReport.ReadWrite.All or both Report.Read.All and Dataset.Read.All\n\n## Limitations\n\nFor .pbix report, after calling [Rebind Report](/rest/api/power-bi/reports/rebind-report), export of a report with a [Power BI service live connection](/power-bi/desktop-report-lifecycle-datasets) isn't supported.\n

", "operationId": "Reports_ExportReport", "consumes": [], "produces": [ @@ -7336,7 +7336,7 @@ "Reports" ], "summary": "Exports the specified report from the specified workspace to a Power BI .pbix or .rdl file.", - "description": "\n- For .pbix reports - \n You can set the `preferClientRouting` URL query parameter to `true` as a [workaround](/power-bi/developer/embedded/troubleshoot-rest-api#fix-timeout-exceptions-when-using-import-and-export-apis) for timeout issues.\n- Large files are downloaded to a temporary blob. Their URL is returned in the response and stored in the locally downloaded Power BI .pbix file.\n- For more information on requirements and limitations, see [Download a report from the Power BI service to Power BI Desktop](/power-bi/create-reports/service-export-to-pbix).\n\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nReport.ReadWrite.All or both Report.Read.All and Dataset.Read.All\n\n## Limitations\n\nFor .pbix reports, exporting a report with a [Power BI service live connection](/power-bi/desktop-report-lifecycle-datasets) isn't supported after calling [Rebind Report](/rest/api/power-bi/reports/rebind-report).\n

", + "description": "\n- For .pbix reports - \n You can set the `preferClientRouting` URL query parameter to `true` as a [workaround](/power-bi/developer/embedded/troubleshoot-rest-api#fix-timeout-exceptions-when-using-import-and-export-apis) for timeout issues.\n- Large files are downloaded to a temporary blob. Their URL is returned in the response and stored in the locally downloaded Power BI .pbix file.\n- For more information on requirements and limitations, see [Download a report from the Power BI service to Power BI Desktop](/power-bi/create-reports/service-export-to-pbix).\n\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n> [!NOTE]\n> Try-it feature is not supported for this API.\n See [Export Power BI Report](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/Export-PowerBIReport.ps1) Powershell script for an example of how to use this API.\n\n## Required Scope\n\nReport.ReadWrite.All or both Report.Read.All and Dataset.Read.All\n\n## Limitations\n\nFor .pbix reports, exporting a report with a [Power BI service live connection](/power-bi/desktop-report-lifecycle-datasets) isn't supported after calling [Rebind Report](/rest/api/power-bi/reports/rebind-report).\n

", "operationId": "Reports_ExportReportInGroup", "consumes": [], "produces": [ From 26a766ff5d193a57e11ed8d3bf59f27abb4f920e Mon Sep 17 00:00:00 2001 From: Alon Yeshurun Date: Tue, 22 Aug 2023 09:00:55 +0000 Subject: [PATCH 06/35] Merged PR 438747: Bump version to 4.16.0 Bump version to 4.16.0 --- .pipelines/OneBranch.Official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/OneBranch.Official.yml b/.pipelines/OneBranch.Official.yml index 1fdfdd17..1ecc8f7f 100644 --- a/.pipelines/OneBranch.Official.yml +++ b/.pipelines/OneBranch.Official.yml @@ -28,7 +28,7 @@ variables: ${{ if eq(variables['Build.DefinitionName'], 'PowerBI-CSharp-Official') }}: obpTemplate: v2/OneBranch.Official.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates obpMajor: 4 - obpMinor: 15 + obpMinor: 16 ${{ else }}: obpTemplate: v2/OneBranch.NonOfficial.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates obpMajor: 0 From 92033fbde247ee0509727bb6a312eb169a33cb68 Mon Sep 17 00:00:00 2001 From: Mounir Shmordok Date: Thu, 7 Sep 2023 14:56:36 +0000 Subject: [PATCH 07/35] Merged PR 446800: Add AuditableContext to the EffectiveIdentity to enable auditing of RLS Adding the auditableContext param to the EffectiveIdentity in the embed token generate requests This param can be used to enable auditing of the effective identity and its value replace the username in the audit record --- .../Source/Models/EffectiveIdentity.cs | 19 ++++++++++++++++++- sdk/swaggers/swagger.json | 4 ++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/sdk/PowerBI.Api/Source/Models/EffectiveIdentity.cs b/sdk/PowerBI.Api/Source/Models/EffectiveIdentity.cs index d822b002..0bd60ece 100644 --- a/sdk/PowerBI.Api/Source/Models/EffectiveIdentity.cs +++ b/sdk/PowerBI.Api/Source/Models/EffectiveIdentity.cs @@ -37,6 +37,12 @@ public EffectiveIdentity() /// models, the username can contain any ASCII character. For either /// model, the username length must not exceed 256 characters, and the /// username shouldn't contain spaces. + /// The EffectiveIdentity auditable + /// context. If this parameter is provided and isn't empty, it will + /// enable auditing of the EffectiveIdentity and its value will be set + /// to the username in the audit record. Otherwise, the + /// EffectiveIdentity context will be omitted from the GenerateToken + /// audit record. /// An array of datasets for which this identity /// applies /// An array of row-level security (RLS) roles @@ -54,9 +60,10 @@ public EffectiveIdentity() /// SQL. /// An array of reports for which this identity /// applies. Only supported for paginated reports. - public EffectiveIdentity(string username, IList datasets = default(IList), IList roles = default(IList), string customData = default(string), IdentityBlob identityBlob = default(IdentityBlob), IList reports = default(IList)) + public EffectiveIdentity(string username, string auditableContext = default(string), IList datasets = default(IList), IList roles = default(IList), string customData = default(string), IdentityBlob identityBlob = default(IdentityBlob), IList reports = default(IList)) { Username = username; + AuditableContext = auditableContext; Datasets = datasets; Roles = roles; CustomData = customData; @@ -82,6 +89,16 @@ public EffectiveIdentity() [JsonProperty(PropertyName = "username")] public string Username { get; set; } + /// + /// Gets or sets the EffectiveIdentity auditable context. If this + /// parameter is provided and isn't empty, it will enable auditing of + /// the EffectiveIdentity and its value will be set to the username in + /// the audit record. Otherwise, the EffectiveIdentity context will be + /// omitted from the GenerateToken audit record. + /// + [JsonProperty(PropertyName = "auditableContext")] + public string AuditableContext { get; set; } + /// /// Gets or sets an array of datasets for which this identity applies /// diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index b062f494..75f4e768 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -26996,6 +26996,10 @@ "type": "string", "description": "The effective username within a token that applies row-level security rules. For an on-premises model, the username can contain alphanumeric or any of the following characters `.`, `-`, `_`, `!`, `#`, `^`, `~`, `\\\\`, `@`. For cloud models, the username can contain any ASCII character. For either model, the username length must not exceed 256 characters, and the username shouldn't contain spaces." }, + "auditableContext": { + "type": "string", + "description": "The EffectiveIdentity auditable context. If this parameter is provided and isn't empty, it will enable auditing of the EffectiveIdentity and its value will be set to the username in the audit record. Otherwise, the EffectiveIdentity context will be omitted from the GenerateToken audit record." + }, "datasets": { "type": "array", "description": "An array of datasets for which this identity applies", From 580020dd38d5343d0131d24f76fe7de9ff25317e Mon Sep 17 00:00:00 2001 From: Megan Kamiya Date: Tue, 19 Sep 2023 07:42:57 +0000 Subject: [PATCH 08/35] Merged PR 449122: Update execute queries permissions docs Update the permissions needed to mention that you must have access to the workspace when using the Execute Queries in Group API. Related work items: #1188178 --- sdk/PowerBI.Api/Source/DatasetsOperations.cs | 22968 ++++++++-------- .../Source/DatasetsOperationsExtensions.cs | 11072 ++++---- sdk/PowerBI.Api/Source/IDatasetsOperations.cs | 6202 ++--- sdk/swaggers/swagger.json | 2 +- 4 files changed, 20122 insertions(+), 20122 deletions(-) diff --git a/sdk/PowerBI.Api/Source/DatasetsOperations.cs b/sdk/PowerBI.Api/Source/DatasetsOperations.cs index e420642a..4afe89c6 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperations.cs @@ -1,11484 +1,11484 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.PowerBI.Api -{ - using Microsoft.Rest; - using Models; - using Newtonsoft.Json; - using System.Collections; - using System.Collections.Generic; - using System.IO; - using System.Linq; - using System.Net; - using System.Net.Http; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DatasetsOperations operations. - /// - public partial class DatasetsOperations : IServiceOperations, IDatasetsOperations - { - /// - /// Initializes a new instance of the DatasetsOperations class. - /// - /// - /// Reference to the service client. - /// - /// - /// Thrown when a required parameter is null - /// - public DatasetsOperations(PowerBIClient client) - { - if (client == null) - { - throw new System.ArgumentNullException("client"); - } - Client = client; - } - - /// - /// Gets a reference to the PowerBIClient - /// - public PowerBIClient Client { get; private set; } - - /// - /// Returns a list of datasets from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetDatasetsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // 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, "GetDatasets", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets").ToString(); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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 dataset on **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// Dataset definition to create - /// - /// - /// The default retention policy. Possible values include: 'None', 'basicFIFO' - /// - /// - /// 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> PostDatasetWithHttpMessagesAsync(CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (dataset == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "dataset"); - } - if (dataset != null) - { - dataset.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("dataset", dataset); - tracingParameters.Add("defaultRetentionPolicy", defaultRetentionPolicy); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "PostDataset", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets").ToString(); - List _queryParameters = new List(); - if (defaultRetentionPolicy != null) - { - _queryParameters.Add(string.Format("defaultRetentionPolicy={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(defaultRetentionPolicy, Client.SerializationSettings).Trim('"')))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (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(dataset != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataset, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 201 && (int)_statusCode != 202) - { - var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 202) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns the specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDatasetWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDataset", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Updates the properties for the specified dataset from **My workspace**. - /// - /// - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// Update dataset request parameters - /// - /// - /// 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 UpdateDatasetWithHttpMessagesAsync(string datasetId, UpdateDatasetRequest updateDatasetRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (updateDatasetRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "updateDatasetRequest"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("updateDatasetRequest", updateDatasetRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateDataset", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(updateDatasetRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateDatasetRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes the specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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 DeleteDatasetWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteDataset", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Executes Data Analysis Expressions (DAX) queries against the provided - /// dataset. The dataset must reside in **My workspace** or another workspace. - /// - /// - /// - /// DAX query errors will result in: - /// - /// - A response error, such as `DAX query failure`. - /// - A failure HTTP status code (400). - /// - /// A query that requests more than one table, or more than the allowed number - /// of table rows, will result in: - /// - /// - Limited data being returned. - /// - A response error, such as `More than one result table in a query` or - /// `More than {allowed number} rows in a query result`. - /// - A successful HTTP status code (200). - /// - /// Columns that are fully qualified in the query will be returned with a fully - /// qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed - /// or created in the query will be returned within square bracket, for - /// example, `[MyNewColumn]`. - /// - /// ## Permissions - /// - /// The user must have dataset read permissions. For more information, see - /// [Manage dataset access - /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// - Datasets that are hosted in Azure Analysis Services or that have a live - /// connection to an on-premises Azure Analysis Services model aren't - /// supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found under - /// **Integration settings**, must be enabled. - /// - One query per API call. - /// - One table request per query. - /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit - /// first). For example if you query for 5 columns, you can get back max - /// 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows - /// (1 million divided by 20). - /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row - /// will be completed but no additional rows will be written. - /// - There's a limit of 120 query requests per minute per user, regardless of - /// the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin tenant - /// setting [_Allow service principals to use Power BI - /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. - /// - Only DAX queries are supported at this time. MDX and DMV queries are not - /// supported. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The request message - /// - /// - /// 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> ExecuteQueriesWithHttpMessagesAsync(string datasetId, DatasetExecuteQueriesRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (requestMessage == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "requestMessage"); - } - if (requestMessage != null) - { - requestMessage.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("requestMessage", requestMessage); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ExecuteQueries", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/executeQueries").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(requestMessage != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestMessage, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of tables within the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetTablesWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetTables", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/tables").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Updates the metadata and schema for the specified table within the - /// specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// Table name and columns to update existing table - /// - /// - /// 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> PutTableWithHttpMessagesAsync(string datasetId, string tableName, Table requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (tableName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); - } - if (requestMessage == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "requestMessage"); - } - if (requestMessage != null) - { - requestMessage.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("tableName", tableName); - tracingParameters.Add("requestMessage", requestMessage); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "PutTable", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/tables/{tableName}").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); - // 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 (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(requestMessage != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestMessage, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Adds new data rows to the specified table within the specified dataset from - /// **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - This API call only supports **push datasets**. - /// - See [Power BI REST API - /// limitations](/power-bi/developer/automation/api-rest-api-limitations). - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The request message - /// - /// - /// 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 PostRowsWithHttpMessagesAsync(string datasetId, string tableName, PostRowsRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (tableName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); - } - if (requestMessage == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "requestMessage"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("tableName", tableName); - tracingParameters.Add("requestMessage", requestMessage); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "PostRows", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/tables/{tableName}/rows").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); - // 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 (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(requestMessage != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestMessage, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes all rows from the specified table within the specified dataset from - /// **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The table 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 DeleteRowsWithHttpMessagesAsync(string datasetId, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (tableName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("tableName", tableName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteRows", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/tables/{tableName}/rows").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns the refresh history for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// OneDrive refresh history isn't returned. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The requested number of entries in the refresh history. If not provided, - /// the default is the last available 60 entries. - /// - /// - /// 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> GetRefreshHistoryWithHttpMessagesAsync(string datasetId, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (top < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("top", top); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetRefreshHistory", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/refreshes").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - List _queryParameters = new List(); - if (top != null) - { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Triggers a refresh for the specified dataset from **My workspace**. An - /// [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) is - /// triggered only if a request payload other than `notifyOption` is set. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - For Shared capacities, a maximum of eight requests per day, including - /// refreshes executed by using scheduled refresh, can be initiated. - /// - For Shared capacities, only `notifyOption` can be specified in the - /// request body. - /// - Enhanced refresh is not supported for shared capacities. - /// - For enhanced refresh, `notifyOption` is not required and must be excluded - /// from the request body. However, one or more parameters other than - /// `notifyOption` are required. - /// - For Premium capacities, the maximum requests per day is only limited by - /// the available resources in the capacity. If available resources are - /// overloaded, refreshes are throttled until the load is reduced. The refresh - /// will fail if throttling exceeds 1 hour. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// - /// - /// 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> RefreshDatasetWithHttpMessagesAsync(string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (datasetRefreshRequest != null) - { - datasetRefreshRequest.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("datasetRefreshRequest", datasetRefreshRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "RefreshDataset", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/refreshes").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(datasetRefreshRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(datasetRefreshRequest, 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 != 202) - { - var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationHeaderResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - try - { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns execution details of an [enhanced refresh - /// operation](/power-bi/connect-data/asynchronous-refresh) for the specified - /// dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetRefreshExecutionDetailsWithHttpMessagesAsync(System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("refreshId", refreshId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetRefreshExecutionDetails", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/refreshes/{refreshId}").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(datasetId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{refreshId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(refreshId, Client.SerializationSettings).Trim('"'))); - // 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 (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) - { - var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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); - } - } - // Deserialize Response - if ((int)_statusCode == 202) - { - _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; - } - - /// - /// Cancels the specified refresh operation for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task CancelRefreshWithHttpMessagesAsync(System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("refreshId", refreshId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CancelRefresh", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/refreshes/{refreshId}").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(datasetId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{refreshId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(refreshId, Client.SerializationSettings).Trim('"'))); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns the refresh schedule for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetRefreshScheduleWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetRefreshSchedule", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/refreshSchedule").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Updates the refresh schedule for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// A request that disables the refresh schedule should contain no other - /// changes. - /// - /// At least one day must be specified. If no times are specified, then Power - /// BI will use a default single time per day. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// The limit on the number of time slots per day depends on whether a - /// [Premium](/power-bi/admin/service-premium-what-is) or Shared capacity is - /// used. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// Update Refresh Schedule parameters, by specifying all or some of the - /// parameters - /// - /// - /// 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 UpdateRefreshScheduleWithHttpMessagesAsync(string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (datasetModelRefreshScheduleRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetModelRefreshScheduleRequest"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("datasetModelRefreshScheduleRequest", datasetModelRefreshScheduleRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateRefreshSchedule", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/refreshSchedule").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(datasetModelRefreshScheduleRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(datasetModelRefreshScheduleRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDirectQueryRefreshScheduleWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDirectQueryRefreshSchedule", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/directQueryRefreshSchedule").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Updates the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from **My workspace**. - /// - /// - /// - /// A request should contain either a set of days and times *or* a valid - /// frequency, but not both. If you choose a set of days without specifying any - /// times, then Power BI will use a default single time per day. Setting the - /// frequency will automatically overwrite the days and times setting. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by - /// specifying all or some of the parameters - /// - /// - /// 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 UpdateDirectQueryRefreshScheduleWithHttpMessagesAsync(string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (datasetDQRefreshScheduleRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetDQRefreshScheduleRequest"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("datasetDQRefreshScheduleRequest", datasetDQRefreshScheduleRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateDirectQueryRefreshSchedule", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/directQueryRefreshSchedule").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(datasetDQRefreshScheduleRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(datasetDQRefreshScheduleRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of parameters for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections - /// aren't supported. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetParametersWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetParameters", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/parameters").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Updates the parameters values for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with - /// this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - If you're using **enhanced dataset metadata**, refresh the dataset - /// to apply the new parameter values. - /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes - /// for the update data sources operation to complete, and then refresh the - /// dataset. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. - /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) - /// connections are only supported with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - Datasets with Azure Analysis Services live connections aren't supported. - /// - Maximum of 100 parameters per request. - /// - All specified parameters must exist in the dataset. - /// - Parameters values should be of the expected type. - /// - The parameter list can't be empty or include duplicate parameters. - /// - Parameters names are case-sensitive. - /// - Parameter `IsRequired` must have a non-empty value. - /// - The parameter types `Any` and `Binary` can't be updated. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// - /// - /// 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 UpdateParametersWithHttpMessagesAsync(string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (updateMashupParametersRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "updateMashupParametersRequest"); - } - if (updateMashupParametersRequest != null) - { - updateMashupParametersRequest.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("updateMashupParametersRequest", updateMashupParametersRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateParameters", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/Default.UpdateParameters").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(updateMashupParametersRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateMashupParametersRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of data sources for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDatasourcesWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDatasources", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/datasources").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Updates the data sources of the specified dataset from **My workspace**. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with - /// this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - The original data source and the new data source must have the exact - /// same schema. - /// > - If you're using **enhanced dataset metadata**, refresh the dataset - /// to get data from the new data sources. - /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes - /// for the update data sources operation to complete, and then refresh the - /// dataset. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. - /// - Only these data sources are supported: SQL Server, Azure SQL Server, - /// Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and - /// SAP HANA. For other data sources, use the [Update - /// Parameters](/rest/api/power-bi/datasets/update-parameters) API call. - /// - Changing the data source type isn't supported. - /// - Data sources that contain parameters in the connection string aren't - /// supported. - /// - Updating data sources that are part of merged or joined tables is only - /// supported if you're using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - For an Advanced Query that references multiple data sources, only the - /// first data source will be updated. To overcome this limitation, define the - /// data source as a parameter and use the [Update - /// Parameters](/rest/api/power-bi/datasets/update-parameters) API call. - /// - Datasets with incremental refresh policy are not fully supported, calling - /// this API may not work as expected and result of partial datasources update, - /// to overcome this you can try run a dataset refresh before calling this API. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// - /// - /// 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 UpdateDatasourcesWithHttpMessagesAsync(string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (updateDatasourcesRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "updateDatasourcesRequest"); - } - if (updateDatasourcesRequest != null) - { - updateDatasourcesRequest.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("updateDatasourcesRequest", updateDatasourcesRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateDatasources", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/Default.UpdateDatasources").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(updateDatasourcesRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateDatasourcesRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Updates all connections for the specified dataset from **My workspace**. - /// This API call only supports SQL DirectQuery datasets. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated and no longer supported. This API call - /// isn't compatible with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// > - /// > Instead use: - /// > - /// > - [Update Parameters](/rest/api/power-bi/datasets/update-parameters) - /// to update connections for SQL, Azure Synapse, OData, and SharePoint data - /// sources. - /// > - [Update Datasources](/rest/api/power-bi/datasets/update-datasources) - /// to connections for other data sources. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The body - /// - /// - /// 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. - /// - [System.Obsolete()] - public async Task SetAllDatasetConnectionsWithHttpMessagesAsync(string datasetId, ConnectionDetails parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SetAllDatasetConnections", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/Default.SetAllConnections").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Binds the specified dataset from **My workspace** to the specified gateway, - /// optionally with a given set of data source IDs. If you don't supply a - /// specific data source ID, the dataset will be bound to the first matching - /// data source in the gateway. - /// - /// - /// - /// > [!IMPORTANT] - /// > Add the API caller principal as a data source user on the gateway. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Only supports the on-premises data gateway - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The bind to gateway request - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task BindToGatewayWithHttpMessagesAsync(string datasetId, BindToGatewayRequest bindToGatewayRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (bindToGatewayRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "bindToGatewayRequest"); - } - if (bindToGatewayRequest != null) - { - bindToGatewayRequest.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("bindToGatewayRequest", bindToGatewayRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BindToGateway", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/Default.BindToGateway").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(bindToGatewayRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(bindToGatewayRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of gateway data sources for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated, use [Get - /// Datasources](/rest/api/power-bi/datasets/get-datasources) instead. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetGatewayDatasourcesWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetGatewayDatasources", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/Default.GetBoundGatewayDatasources").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of gateways that the specified dataset from **My workspace** - /// can be bound to. - /// - /// - /// - /// This API call is only relevant to datasets that have at least one - /// on-premises connection. For datasets with cloud-only connections, this API - /// call returns an empty list. - /// - /// ## Required Scope - /// - /// Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> DiscoverGatewaysWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DiscoverGateways", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/Default.DiscoverGateways").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns the query scale-out sync status for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetQueryScaleOutSyncStatusWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetQueryScaleOutSyncStatus", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/queryScaleOut/syncStatus").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Triggers a query scale-out sync of read-only replicas for the specified - /// dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> TriggerQueryScaleOutSyncWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "TriggerQueryScaleOutSync", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/queryScaleOut/sync").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Grants the specified user's permissions to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Limitations - /// - /// - Adding permissions to service principals (app principalType) isn't - /// supported - /// - Caller must have ReadReshare permissions on the dataset. - /// - This API call can't be used to grant dataset Write permission on the - /// dataset - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - /// - /// 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 PostDatasetUserInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, PostDatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (userDetails == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userDetails"); - } - if (userDetails != null) - { - userDetails.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("userDetails", userDetails); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "PostDatasetUserInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/users").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(userDetails != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(userDetails, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Updates the existing dataset permissions of the specified user to the - /// specified permissions. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// This API call can be used to remove all the dataset permissions of the - /// specified user by using `datasetUserAccessRight: None` - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// ## Limitations - /// - /// - Updating permissions to service principals (app principalType) isn't - /// supported - /// - Caller must have ReadWriteReshare permissions on the dataset. That is, - /// folder admins, members and contributors with Reshare permissions, or - /// dataset owners. - /// - This API can't be used to add or remove *write* permission. - /// - This API can't be used to remove folder-level inherited permissions. For - /// folder admins and members, the ReadWriteReshareExplore permission on the - /// folder's datasets is inherited. For folder contributors, the - /// ReadWriteExplore permission on the folder's datasets is inherited. For - /// folder viewers, the Read permission on the folder's datasets is inherited. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - /// - /// 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 PutDatasetUserInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (userDetails == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userDetails"); - } - if (userDetails != null) - { - userDetails.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("userDetails", userDetails); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "PutDatasetUserInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/users").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(userDetails != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(userDetails, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of principals that have access to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// ## Limitations - /// - /// Caller must have ReadWriteReshare permissions on the dataset. That is, - /// folder admins, members and contributors with Reshare permissions, or - /// dataset owners. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDatasetUsersInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDatasetUsersInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/users").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Grants the specified user's permissions to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Limitations - /// - /// - Adding permissions to service principals (app principalType) isn't - /// supported - /// - Caller must have ReadReshare permissions on the dataset. - /// - This API call can't be used to grant dataset Write permission on the - /// dataset - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - /// - /// 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 PostDatasetUserWithHttpMessagesAsync(string datasetId, PostDatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (userDetails == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userDetails"); - } - if (userDetails != null) - { - userDetails.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("userDetails", userDetails); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "PostDatasetUser", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/users").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(userDetails != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(userDetails, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Updates the existing dataset permissions of the specified user to the - /// specified permissions. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// This API call can be used to remove all the dataset permissions of the - /// specified user by using `datasetUserAccessRight: None` - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// ## Limitations - /// - /// - Updating permissions to service principals (app principalType) isn't - /// supported - /// - Caller must have ReadWriteReshare permissions on the dataset. That is, - /// folder admins, members and contributors with Reshare permissions, or - /// dataset owners. - /// - This API can't be used to add or remove *write* permission. - /// - This API can't be used to remove folder-level inherited permissions. For - /// folder admins and members, the ReadWriteReshareExplore permission on the - /// folder's datasets is inherited. For folder contributors, the - /// ReadWriteExplore permission on the folder's datasets is inherited. For - /// folder viewers, the Read permission on the folder's datasets is inherited. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - /// - /// 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 PutDatasetUserWithHttpMessagesAsync(string datasetId, DatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (userDetails == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "userDetails"); - } - if (userDetails != null) - { - userDetails.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("userDetails", userDetails); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "PutDatasetUser", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/users").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(userDetails != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(userDetails, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of principals that have access to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// ## Limitations - /// - /// Caller must have ReadWriteReshare permissions on the dataset. That is, - /// folder admins, members and contributors with Reshare permissions, or - /// dataset owners. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDatasetUsersWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDatasetUsers", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/users").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of datasets from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetDatasetsInGroupWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDatasetsInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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 dataset in the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// Create dataset parameters - /// - /// - /// The default retention policy. Possible values include: 'None', 'basicFIFO' - /// - /// - /// 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> PostDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (dataset == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "dataset"); - } - if (dataset != null) - { - dataset.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("dataset", dataset); - tracingParameters.Add("defaultRetentionPolicy", defaultRetentionPolicy); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "PostDatasetInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - List _queryParameters = new List(); - if (defaultRetentionPolicy != null) - { - _queryParameters.Add(string.Format("defaultRetentionPolicy={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(defaultRetentionPolicy, Client.SerializationSettings).Trim('"')))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (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(dataset != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataset, Client.SerializationSettings); - _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); - _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); - } - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 201 && (int)_statusCode != 202) - { - var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 201) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - // Deserialize Response - if ((int)_statusCode == 202) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of upstream dataflows for datasets from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetDatasetToDataflowsLinksInGroupWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDatasetToDataflowsLinksInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/upstreamDataflows").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns the specified dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDatasetInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Updates the properties for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Update dataset request parameters - /// - /// - /// 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 UpdateDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, UpdateDatasetRequest updateDatasetRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (updateDatasetRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "updateDatasetRequest"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("updateDatasetRequest", updateDatasetRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateDatasetInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(updateDatasetRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateDatasetRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes the specified dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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 DeleteDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteDatasetInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of tables within the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Required Scope - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetTablesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetTablesInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/tables").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Updates the metadata and schema for the specified table within the - /// specified dataset from the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The request message - /// - /// - /// 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> PutTableInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, string tableName, Table requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (tableName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); - } - if (requestMessage == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "requestMessage"); - } - if (requestMessage != null) - { - requestMessage.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("tableName", tableName); - tracingParameters.Add("requestMessage", requestMessage); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "PutTableInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/tables/{tableName}").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); - // 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 (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(requestMessage != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestMessage, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse
(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Adds new data rows to the specified table within the specified dataset from - /// the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - This API call only supports **push datasets**. - /// - See [Power BI REST API - /// limitations](/power-bi/developer/automation/api-rest-api-limitations). - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The request message - /// - /// - /// 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 PostRowsInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, string tableName, PostRowsRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (tableName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); - } - if (requestMessage == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "requestMessage"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("tableName", tableName); - tracingParameters.Add("requestMessage", requestMessage); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "PostRowsInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/tables/{tableName}/rows").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); - // 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 (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(requestMessage != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestMessage, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Deletes all rows from the specified table within the specified dataset from - /// the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The table 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 DeleteRowsInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (tableName == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("tableName", tableName); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DeleteRowsInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/tables/{tableName}/rows").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns the refresh history for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// OneDrive refresh history isn't returned. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The requested number of entries in the refresh history. If not provided, - /// the default is the last available 60 entries. - /// - /// - /// 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> GetRefreshHistoryInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (top < 1) - { - throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("top", top); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetRefreshHistoryInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - List _queryParameters = new List(); - if (top != null) - { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Triggers a refresh for the specified dataset from the specified workspace. - /// An [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) is - /// triggered only if a request payload other than `notifyOption` is set. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - For Shared capacities, a maximum of eight requests per day, including - /// refreshes executed by using scheduled refresh, can be initiated. - /// - For Shared capacities, only `notifyOption` can be specified in the - /// request body. - /// - Enhanced refresh is not supported for shared capacities. - /// - For enhanced refresh, `notifyOption` is not required and must be excluded - /// from the request body. However, one or more parameters other than - /// `notifyOption` are required. - /// - For Premium capacities, the maximum requests per day is only limited by - /// the available resources in the capacity. If available resources are - /// overloaded, refreshes are throttled until the load is reduced. The refresh - /// will fail if throttling exceeds 1 hour. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// - /// - /// 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> RefreshDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (datasetRefreshRequest != null) - { - datasetRefreshRequest.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("datasetRefreshRequest", datasetRefreshRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "RefreshDatasetInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(datasetRefreshRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(datasetRefreshRequest, 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 != 202) - { - var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationHeaderResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - try - { - _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns execution details of an [enhanced refresh - /// operation](/power-bi/connect-data/asynchronous-refresh) for the specified - /// dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetRefreshExecutionDetailsInGroupWithHttpMessagesAsync(System.Guid groupId, System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("refreshId", refreshId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetRefreshExecutionDetailsInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes/{refreshId}").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(datasetId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{refreshId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(refreshId, Client.SerializationSettings).Trim('"'))); - // 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 (customHeaders != null) - { - foreach(var _header in customHeaders) - { - if (_httpRequest.Headers.Contains(_header.Key)) - { - _httpRequest.Headers.Remove(_header.Key); - } - _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); - } - } - - // Serialize Request - string _requestContent = null; - // Set Credentials - if (Client.Credentials != null) - { - cancellationToken.ThrowIfCancellationRequested(); - await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - } - // Send Request - if (_shouldTrace) - { - ServiceClientTracing.SendRequest(_invocationId, _httpRequest); - } - cancellationToken.ThrowIfCancellationRequested(); - _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); - if (_shouldTrace) - { - ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); - } - HttpStatusCode _statusCode = _httpResponse.StatusCode; - cancellationToken.ThrowIfCancellationRequested(); - string _responseContent = null; - if ((int)_statusCode != 200 && (int)_statusCode != 202) - { - var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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); - } - } - // Deserialize Response - if ((int)_statusCode == 202) - { - _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; - } - - /// - /// Cancels the specified refresh operation for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task CancelRefreshInGroupWithHttpMessagesAsync(System.Guid groupId, System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("refreshId", refreshId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "CancelRefreshInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes/{refreshId}").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(datasetId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{refreshId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(refreshId, Client.SerializationSettings).Trim('"'))); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns the refresh schedule for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetRefreshScheduleInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshSchedule").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Updates the refresh schedule for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// A request that disables the refresh schedule should contain no other - /// changes. - /// - /// At least one day must be specified. If no times are specified, then Power - /// BI will use a default single time per day. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// The limit on the number of time slots per day depends on whether a - /// [Premium](/power-bi/admin/service-premium-what-is) or Shared capacity is - /// used. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Update Refresh Schedule parameters, by specifying all or some of the - /// parameters - /// - /// - /// 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 UpdateRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (datasetModelRefreshScheduleRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetModelRefreshScheduleRequest"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("datasetModelRefreshScheduleRequest", datasetModelRefreshScheduleRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateRefreshScheduleInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshSchedule").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(datasetModelRefreshScheduleRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(datasetModelRefreshScheduleRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDirectQueryRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDirectQueryRefreshScheduleInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/directQueryRefreshSchedule").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Updates the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from the specified workspace. - /// - /// - /// - /// A request should contain either a set of days and times *or* a valid - /// frequency, but not both. If you choose a set of days without specifying any - /// times, then Power BI will use a default single time per day. Setting the - /// frequency will automatically overwrite the days and times setting. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by - /// specifying all or some of the parameters - /// - /// - /// 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 UpdateDirectQueryRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (datasetDQRefreshScheduleRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetDQRefreshScheduleRequest"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("datasetDQRefreshScheduleRequest", datasetDQRefreshScheduleRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateDirectQueryRefreshScheduleInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/directQueryRefreshSchedule").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(datasetDQRefreshScheduleRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(datasetDQRefreshScheduleRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of parameters for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections - /// aren't supported. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// 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> GetParametersInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetParametersInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/parameters").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Updates the parameters values for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with - /// this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - If you're using **enhanced dataset metadata**, refresh the dataset - /// to apply the new parameter values. - /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes - /// for the update data sources operation to complete, and then refresh the - /// dataset. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. - /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) - /// connections are only supported with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - Datasets with Azure Analysis Services live connections aren't supported. - /// - Maximum of 100 parameters per request. - /// - All specified parameters must exist in the dataset. - /// - Parameters values should be of the expected type. - /// - The parameter list can't be empty or include duplicate parameters. - /// - Parameters names are case-sensitive. - /// - Parameter `IsRequired` must have a non-empty value. - /// - The parameter types `Any` and `Binary` can't be updated. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// - /// - /// 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 UpdateParametersInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (updateMashupParametersRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "updateMashupParametersRequest"); - } - if (updateMashupParametersRequest != null) - { - updateMashupParametersRequest.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("updateMashupParametersRequest", updateMashupParametersRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateParametersInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.UpdateParameters").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(updateMashupParametersRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateMashupParametersRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of data sources for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// 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> GetDatasourcesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDatasourcesInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/datasources").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Updates the data sources of the specified dataset from the specified - /// workspace. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with - /// this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - The original data source and the new data source must have the exact - /// same schema. - /// > - If you're using **enhanced dataset metadata**, refresh the dataset - /// to get data from the new data sources. - /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes - /// for the update data sources operation to complete, and then refresh the - /// dataset. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. - /// - Only these data sources are supported: SQL Server, Azure SQL Server, - /// Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and - /// SAP HANA. For other data sources, use the [Update Parameters In - /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call. - /// - Changing the data source type isn't supported. - /// - Data sources that contain parameters in the connection string aren't - /// supported. - /// - Updating data sources that are part of merged or joined tables is only - /// supported if you're using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - For an Advanced Query that reference multiple data sources, only the - /// first data source will be updated. To overcome this limitation, define the - /// data source as a parameter and use the [Update Parameters In - /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call. - /// - Datasets with incremental refresh policy are not fully supported, calling - /// this API may not work as expected and result of partial datasources update, - /// to overcome this you can try run a dataset refresh before calling this API. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// - /// - /// 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 UpdateDatasourcesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (updateDatasourcesRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "updateDatasourcesRequest"); - } - if (updateDatasourcesRequest != null) - { - updateDatasourcesRequest.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("updateDatasourcesRequest", updateDatasourcesRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "UpdateDatasourcesInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.UpdateDatasources").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(updateDatasourcesRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateDatasourcesRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Updates all connections for the specified dataset from the specified - /// workspace. This API call only supports SQL DirectQuery datasets. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated and no longer supported. This API call - /// isn't compatible with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// > - /// > Instead use: - /// > - /// > - [Update Parameters In - /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) to update - /// connections for SQL, Azure Synapse, OData, and SharePoint data sources. - /// > - [Update Datasources In - /// Group](/rest/api/power-bi/datasets/update-datasources-in-group) to - /// connections for other data sources. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Supports SQL DirectQuery datasets. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The body - /// - /// - /// 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. - /// - [System.Obsolete()] - public async Task SetAllDatasetConnectionsInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, ConnectionDetails parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (parameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); - } - if (parameters != null) - { - parameters.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("parameters", parameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "SetAllDatasetConnectionsInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.SetAllConnections").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(parameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Binds the specified dataset from the specified workspace to the specified - /// gateway, optionally with a given set of data source IDs. If you don't - /// supply a specific data source ID, the dataset will be bound to the first - /// matching data source in the gateway. - /// - /// - /// - /// > [!IMPORTANT] - /// > Add the API caller principal as a data source user on the gateway. - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Only supports the on-premises data gateway - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The bind to gateway request - /// - /// - /// Headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// Thrown when a required parameter is null - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task BindToGatewayInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, BindToGatewayRequest bindToGatewayRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (bindToGatewayRequest == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "bindToGatewayRequest"); - } - if (bindToGatewayRequest != null) - { - bindToGatewayRequest.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("bindToGatewayRequest", bindToGatewayRequest); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "BindToGatewayInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.BindToGateway").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(bindToGatewayRequest != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(bindToGatewayRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of gateway data sources for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated, use [Get Datasources In - /// Group](/rest/api/power-bi/datasets/get-datasources-in-group) instead. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetGatewayDatasourcesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetGatewayDatasourcesInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.GetBoundGatewayDatasources").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of gateways that the specified dataset from the specified - /// workspace can be bound to. - /// - /// - /// - /// This API call is only relevant to datasets that have at least one - /// on-premises connection. For datasets with cloud-only connections, this API - /// call returns an empty list. - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> DiscoverGatewaysInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "DiscoverGatewaysInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.DiscoverGateways").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Transfers ownership over the specified dataset to the current authorized - /// user. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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 TakeOverInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "TakeOverInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.TakeOver").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Executes Data Analysis Expressions (DAX) queries against the provided - /// dataset. - /// - /// - /// - /// DAX query errors will result in: - /// - /// - A response error, such as `DAX query failure`. - /// - A failure HTTP status code (400). - /// - /// A query that requests more than one table, or more than the allowed number - /// of table rows, will result in: - /// - /// - Limited data being returned. - /// - A response error, such as `More than one result table in a query` or - /// `More than {allowed number} rows in a query result`. - /// - A successful HTTP status code (200). - /// - /// Columns that are fully qualified in the query will be returned with a fully - /// qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed - /// or created in the query will be returned within square bracket, for - /// example, `[MyNewColumn]`. - /// - /// ## Permissions - /// - /// The user must have dataset read permissions. For more information, see - /// [Manage dataset access - /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// - Datasets that are hosted in Azure Analysis Services or that have a live - /// connection to an on-premises Azure Analysis Services model aren't - /// supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found under - /// **Integration settings**, must be enabled. - /// - One query per API call. - /// - One table request per query. - /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit - /// first). For example if you query for 5 columns, you can get back max - /// 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows - /// (1 million divided by 20). - /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row - /// will be completed but no additional rows will be written. - /// - There's a limit of 120 query requests per minute per user, regardless of - /// the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin tenant - /// setting [_Allow service principals to use Power BI - /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. - /// - Only DAX queries are supported at this time. MDX and DMV queries are not - /// supported. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The request message - /// - /// - /// 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> ExecuteQueriesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DatasetExecuteQueriesRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (requestMessage == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "requestMessage"); - } - if (requestMessage != null) - { - requestMessage.Validate(); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("requestMessage", requestMessage); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "ExecuteQueriesInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/executeQueries").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(requestMessage != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestMessage, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns the query scale-out sync status for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetQueryScaleOutSyncStatusInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetQueryScaleOutSyncStatusInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/queryScaleOut/syncStatus").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Triggers a query scale-out sync of read-only replicas for the specified - /// dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> TriggerQueryScaleOutSyncInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "TriggerQueryScaleOutSyncInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/queryScaleOut/sync").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - /// - /// Generates an embed token based on the specified dataset from the specified - /// workspace. - /// - /// - /// - /// > [!TIP] - /// > To create embed tokens, it's recommended to use the latest API, - /// [Generate Token](/rest/api/power-bi/embed-token/generate-token). Generate - /// token supports additional functions, such as creating a token for multiple - /// items. - /// - /// > [!NOTE] - /// > An embed token can be used to [embed - /// Q&A](/power-bi/developer/qanda) within your application. - /// - /// > [!IMPORTANT] - /// > This API call is only relevant to the [embed for your - /// customers](/power-bi/developer/embed-sample-for-customers) scenario. To - /// learn more about using this API, see [Considerations when generating an - /// embed token](/power-bi/developer/embedded/generate-embed-token). - /// - /// ## Permissions - /// - /// - When using a service principal for authentication, refer to [Embed Power - /// BI content with service - /// principal](/power-bi/developer/embed-service-principal) and [Considerations - /// and - /// limitations](/power-bi/developer/embedded/embed-service-principal#considerations-and-limitations). - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Generate token parameters - /// - /// - /// 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> GenerateTokenInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, GenerateTokenRequest requestParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - if (requestParameters == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "requestParameters"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("requestParameters", requestParameters); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GenerateTokenInGroup", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/GenerateToken").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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(requestParameters != null) - { - _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestParameters, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of datasets for the organization. - /// - /// - /// - /// Each request takes two seconds to process, during which time other requests - /// are queued. - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// <br><br> - /// - /// - /// Filters the results, based on a boolean condition - /// - /// - /// Returns only the first n results - /// - /// - /// Skips the first n results - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetDatasetsAsAdminWithHttpMessagesAsync(string filter = default(string), int? top = default(int?), int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("filter", filter); - tracingParameters.Add("top", top); - tracingParameters.Add("skip", skip); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDatasetsAsAdmin", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/admin/datasets").ToString(); - List _queryParameters = new List(); - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - if (top != null) - { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - if (skip != null) - { - _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of data sources for the specified dataset. - /// - /// - /// - /// Each request takes 0.5 seconds to process, during which time other requests - /// are queued. - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// <br><br> - /// - /// - /// - /// - /// 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> GetDatasourcesAsAdminWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - if (datasetId == null) - { - throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); - } - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDatasourcesAsAdmin", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/admin/datasets/{datasetId}/datasources").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of users that have access to the specified dataset. - /// - /// - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// - /// ## Limitations - /// - /// Maximum 200 requests per hour. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetDatasetUsersAsAdminWithHttpMessagesAsync(System.Guid datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("datasetId", datasetId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDatasetUsersAsAdmin", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/admin/datasets/{datasetId}/users").ToString(); - _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(datasetId, Client.SerializationSettings).Trim('"'))); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of datasets from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// - /// ## Limitations - /// - /// Maximum 200 requests per hour. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// Filters the results, based on a boolean condition - /// - /// - /// Returns only the first n results - /// - /// - /// Skips the first n results - /// - /// - /// Expands related entities inline - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetDatasetsInGroupAsAdminWithHttpMessagesAsync(System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("filter", filter); - tracingParameters.Add("top", top); - tracingParameters.Add("skip", skip); - tracingParameters.Add("expand", expand); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDatasetsInGroupAsAdmin", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/admin/groups/{groupId}/datasets").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - List _queryParameters = new List(); - if (filter != null) - { - _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); - } - if (top != null) - { - _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); - } - if (skip != null) - { - _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); - } - if (expand != null) - { - _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); - } - if (_queryParameters.Count > 0) - { - _url += "?" + 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // Deserialize Response - if ((int)_statusCode == 200) - { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - try - { - _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); - } - catch (JsonException ex) - { - _httpRequest.Dispose(); - if (_httpResponse != null) - { - _httpResponse.Dispose(); - } - throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); - } - } - if (_shouldTrace) - { - ServiceClientTracing.Exit(_invocationId, _result); - } - return _result; - } - - /// - /// Returns a list of upstream dataflows for datasets from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// - /// ## Limitations - /// - /// Maximum 200 requests per hour. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// 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 - /// - /// - /// A response object containing the response body and response headers. - /// - public async Task> GetDatasetToDataflowsLinksInGroupAsAdminWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) - { - // Tracing - bool _shouldTrace = ServiceClientTracing.IsEnabled; - string _invocationId = null; - if (_shouldTrace) - { - _invocationId = ServiceClientTracing.NextInvocationId.ToString(); - Dictionary tracingParameters = new Dictionary(); - tracingParameters.Add("groupId", groupId); - tracingParameters.Add("cancellationToken", cancellationToken); - ServiceClientTracing.Enter(_invocationId, this, "GetDatasetToDataflowsLinksInGroupAsAdmin", tracingParameters); - } - // Construct URL - var _baseUrl = Client.BaseUri.AbsoluteUri; - var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/admin/groups/{groupId}/datasets/upstreamDataflows").ToString(); - _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); - // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); - if (_httpResponse.Content != null) { - _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); - } - else { - _responseContent = string.Empty; - } - 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 HttpOperationResponse(); - _result.Request = _httpRequest; - _result.Response = _httpResponse; - // 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; - } - - } -} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.PowerBI.Api +{ + using Microsoft.Rest; + using Models; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.IO; + using System.Linq; + using System.Net; + using System.Net.Http; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatasetsOperations operations. + /// + public partial class DatasetsOperations : IServiceOperations, IDatasetsOperations + { + /// + /// Initializes a new instance of the DatasetsOperations class. + /// + /// + /// Reference to the service client. + /// + /// + /// Thrown when a required parameter is null + /// + public DatasetsOperations(PowerBIClient client) + { + if (client == null) + { + throw new System.ArgumentNullException("client"); + } + Client = client; + } + + /// + /// Gets a reference to the PowerBIClient + /// + public PowerBIClient Client { get; private set; } + + /// + /// Returns a list of datasets from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetDatasetsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // 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, "GetDatasets", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets").ToString(); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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 dataset on **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// Dataset definition to create + /// + /// + /// The default retention policy. Possible values include: 'None', 'basicFIFO' + /// + /// + /// 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> PostDatasetWithHttpMessagesAsync(CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (dataset == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataset"); + } + if (dataset != null) + { + dataset.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("dataset", dataset); + tracingParameters.Add("defaultRetentionPolicy", defaultRetentionPolicy); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PostDataset", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets").ToString(); + List _queryParameters = new List(); + if (defaultRetentionPolicy != null) + { + _queryParameters.Add(string.Format("defaultRetentionPolicy={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(defaultRetentionPolicy, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (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(dataset != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataset, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDatasetWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDataset", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Updates the properties for the specified dataset from **My workspace**. + /// + /// + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// Update dataset request parameters + /// + /// + /// 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 UpdateDatasetWithHttpMessagesAsync(string datasetId, UpdateDatasetRequest updateDatasetRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (updateDatasetRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "updateDatasetRequest"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("updateDatasetRequest", updateDatasetRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateDataset", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(updateDatasetRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateDatasetRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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 DeleteDatasetWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteDataset", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Executes Data Analysis Expressions (DAX) queries against the provided + /// dataset. The dataset must reside in **My workspace** or another workspace. + /// + /// + /// + /// DAX query errors will result in: + /// + /// - A response error, such as `DAX query failure`. + /// - A failure HTTP status code (400). + /// + /// A query that requests more than one table, or more than the allowed number + /// of table rows, will result in: + /// + /// - Limited data being returned. + /// - A response error, such as `More than one result table in a query` or + /// `More than {allowed number} rows in a query result`. + /// - A successful HTTP status code (200). + /// + /// Columns that are fully qualified in the query will be returned with a fully + /// qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed + /// or created in the query will be returned within square bracket, for + /// example, `[MyNewColumn]`. + /// + /// ## Permissions + /// + /// The user must have dataset read permissions. For more information, see + /// [Manage dataset access + /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// - Datasets that are hosted in Azure Analysis Services or that have a live + /// connection to an on-premises Azure Analysis Services model aren't + /// supported. + /// - The tenant setting **Dataset Execute Queries REST API**, found under + /// **Integration settings**, must be enabled. + /// - One query per API call. + /// - One table request per query. + /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit + /// first). For example if you query for 5 columns, you can get back max + /// 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows + /// (1 million divided by 20). + /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row + /// will be completed but no additional rows will be written. + /// - There's a limit of 120 query requests per minute per user, regardless of + /// the dataset that's queried. + /// - Service Principals aren't supported for datasets with RLS per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or with SSO enabled. To use Service Principals, make sure the admin tenant + /// setting [_Allow service principals to use Power BI + /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) + /// under _Developer settings_ is enabled. + /// - Only DAX queries are supported at this time. MDX and DMV queries are not + /// supported. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The request message + /// + /// + /// 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> ExecuteQueriesWithHttpMessagesAsync(string datasetId, DatasetExecuteQueriesRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (requestMessage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "requestMessage"); + } + if (requestMessage != null) + { + requestMessage.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("requestMessage", requestMessage); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ExecuteQueries", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/executeQueries").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(requestMessage != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestMessage, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of tables within the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetTablesWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetTables", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/tables").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Updates the metadata and schema for the specified table within the + /// specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// Table name and columns to update existing table + /// + /// + /// 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> PutTableWithHttpMessagesAsync(string datasetId, string tableName, Table requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (requestMessage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "requestMessage"); + } + if (requestMessage != null) + { + requestMessage.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("requestMessage", requestMessage); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PutTable", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/tables/{tableName}").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + // 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 (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(requestMessage != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestMessage, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse
(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Adds new data rows to the specified table within the specified dataset from + /// **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - This API call only supports **push datasets**. + /// - See [Power BI REST API + /// limitations](/power-bi/developer/automation/api-rest-api-limitations). + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The request message + /// + /// + /// 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 PostRowsWithHttpMessagesAsync(string datasetId, string tableName, PostRowsRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (requestMessage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "requestMessage"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("requestMessage", requestMessage); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PostRows", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/tables/{tableName}/rows").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + // 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 (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(requestMessage != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestMessage, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes all rows from the specified table within the specified dataset from + /// **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The table 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 DeleteRowsWithHttpMessagesAsync(string datasetId, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteRows", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/tables/{tableName}/rows").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the refresh history for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// OneDrive refresh history isn't returned. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The requested number of entries in the refresh history. If not provided, + /// the default is the last available 60 entries. + /// + /// + /// 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> GetRefreshHistoryWithHttpMessagesAsync(string datasetId, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (top < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("top", top); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRefreshHistory", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/refreshes").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + List _queryParameters = new List(); + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Triggers a refresh for the specified dataset from **My workspace**. An + /// [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) is + /// triggered only if a request payload other than `notifyOption` is set. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - For Shared capacities, a maximum of eight requests per day, including + /// refreshes executed by using scheduled refresh, can be initiated. + /// - For Shared capacities, only `notifyOption` can be specified in the + /// request body. + /// - Enhanced refresh is not supported for shared capacities. + /// - For enhanced refresh, `notifyOption` is not required and must be excluded + /// from the request body. However, one or more parameters other than + /// `notifyOption` are required. + /// - For Premium capacities, the maximum requests per day is only limited by + /// the available resources in the capacity. If available resources are + /// overloaded, refreshes are throttled until the load is reduced. The refresh + /// will fail if throttling exceeds 1 hour. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// + /// + /// 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> RefreshDatasetWithHttpMessagesAsync(string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (datasetRefreshRequest != null) + { + datasetRefreshRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("datasetRefreshRequest", datasetRefreshRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "RefreshDataset", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/refreshes").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(datasetRefreshRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(datasetRefreshRequest, 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 != 202) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns execution details of an [enhanced refresh + /// operation](/power-bi/connect-data/asynchronous-refresh) for the specified + /// dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + /// + /// 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetRefreshExecutionDetailsWithHttpMessagesAsync(System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("refreshId", refreshId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRefreshExecutionDetails", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/refreshes/{refreshId}").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(datasetId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{refreshId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(refreshId, Client.SerializationSettings).Trim('"'))); + // 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 (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _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; + } + + /// + /// Cancels the specified refresh operation for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task CancelRefreshWithHttpMessagesAsync(System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("refreshId", refreshId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CancelRefresh", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/refreshes/{refreshId}").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(datasetId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{refreshId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(refreshId, Client.SerializationSettings).Trim('"'))); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the refresh schedule for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetRefreshScheduleWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRefreshSchedule", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/refreshSchedule").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Updates the refresh schedule for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// A request that disables the refresh schedule should contain no other + /// changes. + /// + /// At least one day must be specified. If no times are specified, then Power + /// BI will use a default single time per day. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// The limit on the number of time slots per day depends on whether a + /// [Premium](/power-bi/admin/service-premium-what-is) or Shared capacity is + /// used. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// Update Refresh Schedule parameters, by specifying all or some of the + /// parameters + /// + /// + /// 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 UpdateRefreshScheduleWithHttpMessagesAsync(string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (datasetModelRefreshScheduleRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetModelRefreshScheduleRequest"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("datasetModelRefreshScheduleRequest", datasetModelRefreshScheduleRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateRefreshSchedule", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/refreshSchedule").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(datasetModelRefreshScheduleRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(datasetModelRefreshScheduleRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDirectQueryRefreshScheduleWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDirectQueryRefreshSchedule", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/directQueryRefreshSchedule").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Updates the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from **My workspace**. + /// + /// + /// + /// A request should contain either a set of days and times *or* a valid + /// frequency, but not both. If you choose a set of days without specifying any + /// times, then Power BI will use a default single time per day. Setting the + /// frequency will automatically overwrite the days and times setting. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by + /// specifying all or some of the parameters + /// + /// + /// 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 UpdateDirectQueryRefreshScheduleWithHttpMessagesAsync(string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (datasetDQRefreshScheduleRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetDQRefreshScheduleRequest"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("datasetDQRefreshScheduleRequest", datasetDQRefreshScheduleRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateDirectQueryRefreshSchedule", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/directQueryRefreshSchedule").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(datasetDQRefreshScheduleRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(datasetDQRefreshScheduleRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of parameters for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections + /// aren't supported. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetParametersWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetParameters", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/parameters").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Updates the parameters values for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with + /// this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - If you're using **enhanced dataset metadata**, refresh the dataset + /// to apply the new parameter values. + /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes + /// for the update data sources operation to complete, and then refresh the + /// dataset. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. + /// To make changes to those data sources, the admin must use the Azure + /// Analysis Services client library for Tabular Object Model. + /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) + /// connections are only supported with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - Datasets with Azure Analysis Services live connections aren't supported. + /// - Maximum of 100 parameters per request. + /// - All specified parameters must exist in the dataset. + /// - Parameters values should be of the expected type. + /// - The parameter list can't be empty or include duplicate parameters. + /// - Parameters names are case-sensitive. + /// - Parameter `IsRequired` must have a non-empty value. + /// - The parameter types `Any` and `Binary` can't be updated. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// + /// + /// 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 UpdateParametersWithHttpMessagesAsync(string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (updateMashupParametersRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "updateMashupParametersRequest"); + } + if (updateMashupParametersRequest != null) + { + updateMashupParametersRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("updateMashupParametersRequest", updateMashupParametersRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateParameters", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/Default.UpdateParameters").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(updateMashupParametersRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateMashupParametersRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of data sources for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDatasourcesWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDatasources", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/datasources").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Updates the data sources of the specified dataset from **My workspace**. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with + /// this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - The original data source and the new data source must have the exact + /// same schema. + /// > - If you're using **enhanced dataset metadata**, refresh the dataset + /// to get data from the new data sources. + /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes + /// for the update data sources operation to complete, and then refresh the + /// dataset. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. + /// To make changes to those data sources, the admin must use the Azure + /// Analysis Services client library for Tabular Object Model. + /// - Only these data sources are supported: SQL Server, Azure SQL Server, + /// Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and + /// SAP HANA. For other data sources, use the [Update + /// Parameters](/rest/api/power-bi/datasets/update-parameters) API call. + /// - Changing the data source type isn't supported. + /// - Data sources that contain parameters in the connection string aren't + /// supported. + /// - Updating data sources that are part of merged or joined tables is only + /// supported if you're using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - For an Advanced Query that references multiple data sources, only the + /// first data source will be updated. To overcome this limitation, define the + /// data source as a parameter and use the [Update + /// Parameters](/rest/api/power-bi/datasets/update-parameters) API call. + /// - Datasets with incremental refresh policy are not fully supported, calling + /// this API may not work as expected and result of partial datasources update, + /// to overcome this you can try run a dataset refresh before calling this API. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// + /// + /// 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 UpdateDatasourcesWithHttpMessagesAsync(string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (updateDatasourcesRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "updateDatasourcesRequest"); + } + if (updateDatasourcesRequest != null) + { + updateDatasourcesRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("updateDatasourcesRequest", updateDatasourcesRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateDatasources", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/Default.UpdateDatasources").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(updateDatasourcesRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateDatasourcesRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates all connections for the specified dataset from **My workspace**. + /// This API call only supports SQL DirectQuery datasets. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated and no longer supported. This API call + /// isn't compatible with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// > + /// > Instead use: + /// > + /// > - [Update Parameters](/rest/api/power-bi/datasets/update-parameters) + /// to update connections for SQL, Azure Synapse, OData, and SharePoint data + /// sources. + /// > - [Update Datasources](/rest/api/power-bi/datasets/update-datasources) + /// to connections for other data sources. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The body + /// + /// + /// 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. + /// + [System.Obsolete()] + public async Task SetAllDatasetConnectionsWithHttpMessagesAsync(string datasetId, ConnectionDetails parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SetAllDatasetConnections", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/Default.SetAllConnections").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Binds the specified dataset from **My workspace** to the specified gateway, + /// optionally with a given set of data source IDs. If you don't supply a + /// specific data source ID, the dataset will be bound to the first matching + /// data source in the gateway. + /// + /// + /// + /// > [!IMPORTANT] + /// > Add the API caller principal as a data source user on the gateway. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The bind to gateway request + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BindToGatewayWithHttpMessagesAsync(string datasetId, BindToGatewayRequest bindToGatewayRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (bindToGatewayRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bindToGatewayRequest"); + } + if (bindToGatewayRequest != null) + { + bindToGatewayRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("bindToGatewayRequest", bindToGatewayRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BindToGateway", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/Default.BindToGateway").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(bindToGatewayRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(bindToGatewayRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of gateway data sources for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated, use [Get + /// Datasources](/rest/api/power-bi/datasets/get-datasources) instead. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetGatewayDatasourcesWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetGatewayDatasources", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/Default.GetBoundGatewayDatasources").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of gateways that the specified dataset from **My workspace** + /// can be bound to. + /// + /// + /// + /// This API call is only relevant to datasets that have at least one + /// on-premises connection. For datasets with cloud-only connections, this API + /// call returns an empty list. + /// + /// ## Required Scope + /// + /// Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> DiscoverGatewaysWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DiscoverGateways", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/Default.DiscoverGateways").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the query scale-out sync status for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetQueryScaleOutSyncStatusWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetQueryScaleOutSyncStatus", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/queryScaleOut/syncStatus").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Triggers a query scale-out sync of read-only replicas for the specified + /// dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> TriggerQueryScaleOutSyncWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "TriggerQueryScaleOutSync", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/queryScaleOut/sync").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Grants the specified user's permissions to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Limitations + /// + /// - Adding permissions to service principals (app principalType) isn't + /// supported + /// - Caller must have ReadReshare permissions on the dataset. + /// - This API call can't be used to grant dataset Write permission on the + /// dataset + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + /// + /// 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 PostDatasetUserInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, PostDatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (userDetails == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userDetails"); + } + if (userDetails != null) + { + userDetails.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("userDetails", userDetails); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PostDatasetUserInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/users").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(userDetails != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(userDetails, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the existing dataset permissions of the specified user to the + /// specified permissions. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// This API call can be used to remove all the dataset permissions of the + /// specified user by using `datasetUserAccessRight: None` + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// ## Limitations + /// + /// - Updating permissions to service principals (app principalType) isn't + /// supported + /// - Caller must have ReadWriteReshare permissions on the dataset. That is, + /// folder admins, members and contributors with Reshare permissions, or + /// dataset owners. + /// - This API can't be used to add or remove *write* permission. + /// - This API can't be used to remove folder-level inherited permissions. For + /// folder admins and members, the ReadWriteReshareExplore permission on the + /// folder's datasets is inherited. For folder contributors, the + /// ReadWriteExplore permission on the folder's datasets is inherited. For + /// folder viewers, the Read permission on the folder's datasets is inherited. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + /// + /// 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 PutDatasetUserInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (userDetails == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userDetails"); + } + if (userDetails != null) + { + userDetails.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("userDetails", userDetails); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PutDatasetUserInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/users").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(userDetails != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(userDetails, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of principals that have access to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// ## Limitations + /// + /// Caller must have ReadWriteReshare permissions on the dataset. That is, + /// folder admins, members and contributors with Reshare permissions, or + /// dataset owners. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDatasetUsersInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDatasetUsersInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/users").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Grants the specified user's permissions to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Limitations + /// + /// - Adding permissions to service principals (app principalType) isn't + /// supported + /// - Caller must have ReadReshare permissions on the dataset. + /// - This API call can't be used to grant dataset Write permission on the + /// dataset + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + /// + /// 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 PostDatasetUserWithHttpMessagesAsync(string datasetId, PostDatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (userDetails == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userDetails"); + } + if (userDetails != null) + { + userDetails.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("userDetails", userDetails); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PostDatasetUser", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/users").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(userDetails != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(userDetails, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates the existing dataset permissions of the specified user to the + /// specified permissions. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// This API call can be used to remove all the dataset permissions of the + /// specified user by using `datasetUserAccessRight: None` + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// ## Limitations + /// + /// - Updating permissions to service principals (app principalType) isn't + /// supported + /// - Caller must have ReadWriteReshare permissions on the dataset. That is, + /// folder admins, members and contributors with Reshare permissions, or + /// dataset owners. + /// - This API can't be used to add or remove *write* permission. + /// - This API can't be used to remove folder-level inherited permissions. For + /// folder admins and members, the ReadWriteReshareExplore permission on the + /// folder's datasets is inherited. For folder contributors, the + /// ReadWriteExplore permission on the folder's datasets is inherited. For + /// folder viewers, the Read permission on the folder's datasets is inherited. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + /// + /// 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 PutDatasetUserWithHttpMessagesAsync(string datasetId, DatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (userDetails == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "userDetails"); + } + if (userDetails != null) + { + userDetails.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("userDetails", userDetails); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PutDatasetUser", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/users").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(userDetails != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(userDetails, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of principals that have access to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// ## Limitations + /// + /// Caller must have ReadWriteReshare permissions on the dataset. That is, + /// folder admins, members and contributors with Reshare permissions, or + /// dataset owners. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDatasetUsersWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDatasetUsers", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/datasets/{datasetId}/users").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of datasets from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetDatasetsInGroupWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDatasetsInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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 dataset in the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// Create dataset parameters + /// + /// + /// The default retention policy. Possible values include: 'None', 'basicFIFO' + /// + /// + /// 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> PostDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (dataset == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "dataset"); + } + if (dataset != null) + { + dataset.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("dataset", dataset); + tracingParameters.Add("defaultRetentionPolicy", defaultRetentionPolicy); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PostDatasetInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + List _queryParameters = new List(); + if (defaultRetentionPolicy != null) + { + _queryParameters.Add(string.Format("defaultRetentionPolicy={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(defaultRetentionPolicy, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (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(dataset != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(dataset, Client.SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 201 && (int)_statusCode != 202) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 201) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of upstream dataflows for datasets from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetDatasetToDataflowsLinksInGroupWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDatasetToDataflowsLinksInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/upstreamDataflows").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the specified dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDatasetInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Updates the properties for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Update dataset request parameters + /// + /// + /// 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 UpdateDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, UpdateDatasetRequest updateDatasetRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (updateDatasetRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "updateDatasetRequest"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("updateDatasetRequest", updateDatasetRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateDatasetInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(updateDatasetRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateDatasetRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes the specified dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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 DeleteDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteDatasetInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of tables within the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Required Scope + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetTablesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetTablesInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/tables").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Updates the metadata and schema for the specified table within the + /// specified dataset from the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The request message + /// + /// + /// 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> PutTableInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, string tableName, Table requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (requestMessage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "requestMessage"); + } + if (requestMessage != null) + { + requestMessage.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("requestMessage", requestMessage); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PutTableInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/tables/{tableName}").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + // 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 (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(requestMessage != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestMessage, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse
(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Adds new data rows to the specified table within the specified dataset from + /// the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - This API call only supports **push datasets**. + /// - See [Power BI REST API + /// limitations](/power-bi/developer/automation/api-rest-api-limitations). + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The request message + /// + /// + /// 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 PostRowsInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, string tableName, PostRowsRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + if (requestMessage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "requestMessage"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("requestMessage", requestMessage); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "PostRowsInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/tables/{tableName}/rows").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + // 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 (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(requestMessage != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestMessage, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Deletes all rows from the specified table within the specified dataset from + /// the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The table 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 DeleteRowsInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (tableName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "tableName"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("tableName", tableName); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DeleteRowsInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/tables/{tableName}/rows").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + _url = _url.Replace("{tableName}", System.Uri.EscapeDataString(tableName)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the refresh history for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// OneDrive refresh history isn't returned. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The requested number of entries in the refresh history. If not provided, + /// the default is the last available 60 entries. + /// + /// + /// 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> GetRefreshHistoryInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (top < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("top", top); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRefreshHistoryInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + List _queryParameters = new List(); + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Triggers a refresh for the specified dataset from the specified workspace. + /// An [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) is + /// triggered only if a request payload other than `notifyOption` is set. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - For Shared capacities, a maximum of eight requests per day, including + /// refreshes executed by using scheduled refresh, can be initiated. + /// - For Shared capacities, only `notifyOption` can be specified in the + /// request body. + /// - Enhanced refresh is not supported for shared capacities. + /// - For enhanced refresh, `notifyOption` is not required and must be excluded + /// from the request body. However, one or more parameters other than + /// `notifyOption` are required. + /// - For Premium capacities, the maximum requests per day is only limited by + /// the available resources in the capacity. If available resources are + /// overloaded, refreshes are throttled until the load is reduced. The refresh + /// will fail if throttling exceeds 1 hour. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// + /// + /// 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> RefreshDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (datasetRefreshRequest != null) + { + datasetRefreshRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("datasetRefreshRequest", datasetRefreshRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "RefreshDatasetInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(datasetRefreshRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(datasetRefreshRequest, 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 != 202) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationHeaderResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(JsonSerializer.Create(Client.DeserializationSettings)); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns execution details of an [enhanced refresh + /// operation](/power-bi/connect-data/asynchronous-refresh) for the specified + /// dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + /// + /// 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetRefreshExecutionDetailsInGroupWithHttpMessagesAsync(System.Guid groupId, System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("refreshId", refreshId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRefreshExecutionDetailsInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes/{refreshId}").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(datasetId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{refreshId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(refreshId, Client.SerializationSettings).Trim('"'))); + // 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 (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + // Set Credentials + if (Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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); + } + } + // Deserialize Response + if ((int)_statusCode == 202) + { + _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; + } + + /// + /// Cancels the specified refresh operation for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task CancelRefreshInGroupWithHttpMessagesAsync(System.Guid groupId, System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("refreshId", refreshId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "CancelRefreshInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshes/{refreshId}").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(datasetId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{refreshId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(refreshId, Client.SerializationSettings).Trim('"'))); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the refresh schedule for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetRefreshScheduleInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshSchedule").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Updates the refresh schedule for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// A request that disables the refresh schedule should contain no other + /// changes. + /// + /// At least one day must be specified. If no times are specified, then Power + /// BI will use a default single time per day. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// The limit on the number of time slots per day depends on whether a + /// [Premium](/power-bi/admin/service-premium-what-is) or Shared capacity is + /// used. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Update Refresh Schedule parameters, by specifying all or some of the + /// parameters + /// + /// + /// 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 UpdateRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (datasetModelRefreshScheduleRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetModelRefreshScheduleRequest"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("datasetModelRefreshScheduleRequest", datasetModelRefreshScheduleRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateRefreshScheduleInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/refreshSchedule").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(datasetModelRefreshScheduleRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(datasetModelRefreshScheduleRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDirectQueryRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDirectQueryRefreshScheduleInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/directQueryRefreshSchedule").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Updates the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from the specified workspace. + /// + /// + /// + /// A request should contain either a set of days and times *or* a valid + /// frequency, but not both. If you choose a set of days without specifying any + /// times, then Power BI will use a default single time per day. Setting the + /// frequency will automatically overwrite the days and times setting. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by + /// specifying all or some of the parameters + /// + /// + /// 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 UpdateDirectQueryRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (datasetDQRefreshScheduleRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetDQRefreshScheduleRequest"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("datasetDQRefreshScheduleRequest", datasetDQRefreshScheduleRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateDirectQueryRefreshScheduleInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/directQueryRefreshSchedule").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(datasetDQRefreshScheduleRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(datasetDQRefreshScheduleRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of parameters for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections + /// aren't supported. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// 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> GetParametersInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetParametersInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/parameters").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Updates the parameters values for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with + /// this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - If you're using **enhanced dataset metadata**, refresh the dataset + /// to apply the new parameter values. + /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes + /// for the update data sources operation to complete, and then refresh the + /// dataset. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. + /// To make changes to those data sources, the admin must use the Azure + /// Analysis Services client library for Tabular Object Model. + /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) + /// connections are only supported with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - Datasets with Azure Analysis Services live connections aren't supported. + /// - Maximum of 100 parameters per request. + /// - All specified parameters must exist in the dataset. + /// - Parameters values should be of the expected type. + /// - The parameter list can't be empty or include duplicate parameters. + /// - Parameters names are case-sensitive. + /// - Parameter `IsRequired` must have a non-empty value. + /// - The parameter types `Any` and `Binary` can't be updated. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// + /// + /// 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 UpdateParametersInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (updateMashupParametersRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "updateMashupParametersRequest"); + } + if (updateMashupParametersRequest != null) + { + updateMashupParametersRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("updateMashupParametersRequest", updateMashupParametersRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateParametersInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.UpdateParameters").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(updateMashupParametersRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateMashupParametersRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of data sources for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// 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> GetDatasourcesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDatasourcesInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/datasources").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Updates the data sources of the specified dataset from the specified + /// workspace. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with + /// this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - The original data source and the new data source must have the exact + /// same schema. + /// > - If you're using **enhanced dataset metadata**, refresh the dataset + /// to get data from the new data sources. + /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes + /// for the update data sources operation to complete, and then refresh the + /// dataset. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. + /// To make changes to those data sources, the admin must use the Azure + /// Analysis Services client library for Tabular Object Model. + /// - Only these data sources are supported: SQL Server, Azure SQL Server, + /// Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and + /// SAP HANA. For other data sources, use the [Update Parameters In + /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call. + /// - Changing the data source type isn't supported. + /// - Data sources that contain parameters in the connection string aren't + /// supported. + /// - Updating data sources that are part of merged or joined tables is only + /// supported if you're using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - For an Advanced Query that reference multiple data sources, only the + /// first data source will be updated. To overcome this limitation, define the + /// data source as a parameter and use the [Update Parameters In + /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call. + /// - Datasets with incremental refresh policy are not fully supported, calling + /// this API may not work as expected and result of partial datasources update, + /// to overcome this you can try run a dataset refresh before calling this API. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// + /// + /// 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 UpdateDatasourcesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (updateDatasourcesRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "updateDatasourcesRequest"); + } + if (updateDatasourcesRequest != null) + { + updateDatasourcesRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("updateDatasourcesRequest", updateDatasourcesRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "UpdateDatasourcesInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.UpdateDatasources").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(updateDatasourcesRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(updateDatasourcesRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Updates all connections for the specified dataset from the specified + /// workspace. This API call only supports SQL DirectQuery datasets. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated and no longer supported. This API call + /// isn't compatible with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// > + /// > Instead use: + /// > + /// > - [Update Parameters In + /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) to update + /// connections for SQL, Azure Synapse, OData, and SharePoint data sources. + /// > - [Update Datasources In + /// Group](/rest/api/power-bi/datasets/update-datasources-in-group) to + /// connections for other data sources. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Supports SQL DirectQuery datasets. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The body + /// + /// + /// 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. + /// + [System.Obsolete()] + public async Task SetAllDatasetConnectionsInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, ConnectionDetails parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "SetAllDatasetConnectionsInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.SetAllConnections").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(parameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Binds the specified dataset from the specified workspace to the specified + /// gateway, optionally with a given set of data source IDs. If you don't + /// supply a specific data source ID, the dataset will be bound to the first + /// matching data source in the gateway. + /// + /// + /// + /// > [!IMPORTANT] + /// > Add the API caller principal as a data source user on the gateway. + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The bind to gateway request + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task BindToGatewayInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, BindToGatewayRequest bindToGatewayRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (bindToGatewayRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "bindToGatewayRequest"); + } + if (bindToGatewayRequest != null) + { + bindToGatewayRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("bindToGatewayRequest", bindToGatewayRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BindToGatewayInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.BindToGateway").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(bindToGatewayRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(bindToGatewayRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of gateway data sources for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated, use [Get Datasources In + /// Group](/rest/api/power-bi/datasets/get-datasources-in-group) instead. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetGatewayDatasourcesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetGatewayDatasourcesInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.GetBoundGatewayDatasources").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of gateways that the specified dataset from the specified + /// workspace can be bound to. + /// + /// + /// + /// This API call is only relevant to datasets that have at least one + /// on-premises connection. For datasets with cloud-only connections, this API + /// call returns an empty list. + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> DiscoverGatewaysInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "DiscoverGatewaysInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.DiscoverGateways").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Transfers ownership over the specified dataset to the current authorized + /// user. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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 TakeOverInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "TakeOverInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/Default.TakeOver").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Executes Data Analysis Expressions (DAX) queries against the provided + /// dataset. + /// + /// + /// + /// DAX query errors will result in: + /// + /// - A response error, such as `DAX query failure`. + /// - A failure HTTP status code (400). + /// + /// A query that requests more than one table, or more than the allowed number + /// of table rows, will result in: + /// + /// - Limited data being returned. + /// - A response error, such as `More than one result table in a query` or + /// `More than {allowed number} rows in a query result`. + /// - A successful HTTP status code (200). + /// + /// Columns that are fully qualified in the query will be returned with a fully + /// qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed + /// or created in the query will be returned within square bracket, for + /// example, `[MyNewColumn]`. + /// + /// ## Permissions + /// + /// The user must have access to the workspace and dataset read permissions. + /// For more information, see [Manage dataset access + /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// - Datasets that are hosted in Azure Analysis Services or that have a live + /// connection to an on-premises Azure Analysis Services model aren't + /// supported. + /// - The tenant setting **Dataset Execute Queries REST API**, found under + /// **Integration settings**, must be enabled. + /// - One query per API call. + /// - One table request per query. + /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit + /// first). For example if you query for 5 columns, you can get back max + /// 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows + /// (1 million divided by 20). + /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row + /// will be completed but no additional rows will be written. + /// - There's a limit of 120 query requests per minute per user, regardless of + /// the dataset that's queried. + /// - Service Principals aren't supported for datasets with RLS per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or with SSO enabled. To use Service Principals, make sure the admin tenant + /// setting [_Allow service principals to use Power BI + /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) + /// under _Developer settings_ is enabled. + /// - Only DAX queries are supported at this time. MDX and DMV queries are not + /// supported. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The request message + /// + /// + /// 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> ExecuteQueriesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DatasetExecuteQueriesRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (requestMessage == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "requestMessage"); + } + if (requestMessage != null) + { + requestMessage.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("requestMessage", requestMessage); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ExecuteQueriesInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/executeQueries").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(requestMessage != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestMessage, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns the query scale-out sync status for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetQueryScaleOutSyncStatusInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetQueryScaleOutSyncStatusInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/queryScaleOut/syncStatus").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Triggers a query scale-out sync of read-only replicas for the specified + /// dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> TriggerQueryScaleOutSyncInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "TriggerQueryScaleOutSyncInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/queryScaleOut/sync").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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; + } + + /// + /// Generates an embed token based on the specified dataset from the specified + /// workspace. + /// + /// + /// + /// > [!TIP] + /// > To create embed tokens, it's recommended to use the latest API, + /// [Generate Token](/rest/api/power-bi/embed-token/generate-token). Generate + /// token supports additional functions, such as creating a token for multiple + /// items. + /// + /// > [!NOTE] + /// > An embed token can be used to [embed + /// Q&A](/power-bi/developer/qanda) within your application. + /// + /// > [!IMPORTANT] + /// > This API call is only relevant to the [embed for your + /// customers](/power-bi/developer/embed-sample-for-customers) scenario. To + /// learn more about using this API, see [Considerations when generating an + /// embed token](/power-bi/developer/embedded/generate-embed-token). + /// + /// ## Permissions + /// + /// - When using a service principal for authentication, refer to [Embed Power + /// BI content with service + /// principal](/power-bi/developer/embed-service-principal) and [Considerations + /// and + /// limitations](/power-bi/developer/embedded/embed-service-principal#considerations-and-limitations). + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Generate token parameters + /// + /// + /// 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> GenerateTokenInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, GenerateTokenRequest requestParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + if (requestParameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "requestParameters"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("requestParameters", requestParameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GenerateTokenInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/datasets/{datasetId}/GenerateToken").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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(requestParameters != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(requestParameters, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of datasets for the organization. + /// + /// + /// + /// Each request takes two seconds to process, during which time other requests + /// are queued. + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// <br><br> + /// + /// + /// Filters the results, based on a boolean condition + /// + /// + /// Returns only the first n results + /// + /// + /// Skips the first n results + /// + /// + /// 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetDatasetsAsAdminWithHttpMessagesAsync(string filter = default(string), int? top = default(int?), int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("filter", filter); + tracingParameters.Add("top", top); + tracingParameters.Add("skip", skip); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDatasetsAsAdmin", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/admin/datasets").ToString(); + List _queryParameters = new List(); + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of data sources for the specified dataset. + /// + /// + /// + /// Each request takes 0.5 seconds to process, during which time other requests + /// are queued. + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// <br><br> + /// + /// + /// + /// + /// 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> GetDatasourcesAsAdminWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (datasetId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "datasetId"); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDatasourcesAsAdmin", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/admin/datasets/{datasetId}/datasources").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(datasetId)); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of users that have access to the specified dataset. + /// + /// + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// - The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// + /// ## Limitations + /// + /// Maximum 200 requests per hour. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetDatasetUsersAsAdminWithHttpMessagesAsync(System.Guid datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("datasetId", datasetId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDatasetUsersAsAdmin", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/admin/datasets/{datasetId}/users").ToString(); + _url = _url.Replace("{datasetId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(datasetId, Client.SerializationSettings).Trim('"'))); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of datasets from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// + /// ## Limitations + /// + /// Maximum 200 requests per hour. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// Filters the results, based on a boolean condition + /// + /// + /// Returns only the first n results + /// + /// + /// Skips the first n results + /// + /// + /// Expands related entities inline + /// + /// + /// 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetDatasetsInGroupAsAdminWithHttpMessagesAsync(System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("filter", filter); + tracingParameters.Add("top", top); + tracingParameters.Add("skip", skip); + tracingParameters.Add("expand", expand); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDatasetsInGroupAsAdmin", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/admin/groups/{groupId}/datasets").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + List _queryParameters = new List(); + if (filter != null) + { + _queryParameters.Add(string.Format("$filter={0}", System.Uri.EscapeDataString(filter))); + } + if (top != null) + { + _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + } + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); + } + if (expand != null) + { + _queryParameters.Add(string.Format("$expand={0}", System.Uri.EscapeDataString(expand))); + } + if (_queryParameters.Count > 0) + { + _url += "?" + 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, Client.DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Returns a list of upstream dataflows for datasets from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// + /// ## Limitations + /// + /// Maximum 200 requests per hour. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// 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 + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> GetDatasetToDataflowsLinksInGroupAsAdminWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "GetDatasetToDataflowsLinksInGroupAsAdmin", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/admin/groups/{groupId}/datasets/upstreamDataflows").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + // 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 (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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + // 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/PowerBI.Api/Source/DatasetsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs index f8f315f6..79ffec0d 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs @@ -1,5536 +1,5536 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.PowerBI.Api -{ - using Models; - using System.Threading; - using System.Threading.Tasks; - - /// - /// Extension methods for DatasetsOperations. - /// - public static partial class DatasetsOperationsExtensions - { - /// - /// Returns a list of datasets from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - public static Datasets GetDatasets(this IDatasetsOperations operations) - { - return operations.GetDatasetsAsync().GetAwaiter().GetResult(); - } - - /// - /// Returns a list of datasets from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasetsAsync(this IDatasetsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasetsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates a new dataset on **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// Dataset definition to create - /// - /// - /// The default retention policy. Possible values include: 'None', 'basicFIFO' - /// - public static Dataset PostDataset(this IDatasetsOperations operations, CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?)) - { - return operations.PostDatasetAsync(dataset, defaultRetentionPolicy).GetAwaiter().GetResult(); - } - - /// - /// Creates a new dataset on **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// Dataset definition to create - /// - /// - /// The default retention policy. Possible values include: 'None', 'basicFIFO' - /// - /// - /// The cancellation token. - /// - public static async Task PostDatasetAsync(this IDatasetsOperations operations, CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.PostDatasetWithHttpMessagesAsync(dataset, defaultRetentionPolicy, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns the specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - public static Dataset GetDataset(this IDatasetsOperations operations, string datasetId) - { - return operations.GetDatasetAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns the specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasetAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasetWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates the properties for the specified dataset from **My workspace**. - /// - /// - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// Update dataset request parameters - /// - public static void UpdateDataset(this IDatasetsOperations operations, string datasetId, UpdateDatasetRequest updateDatasetRequest) - { - operations.UpdateDatasetAsync(datasetId, updateDatasetRequest).GetAwaiter().GetResult(); - } - - /// - /// Updates the properties for the specified dataset from **My workspace**. - /// - /// - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// Update dataset request parameters - /// - /// - /// The cancellation token. - /// - public static async Task UpdateDatasetAsync(this IDatasetsOperations operations, string datasetId, UpdateDatasetRequest updateDatasetRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateDatasetWithHttpMessagesAsync(datasetId, updateDatasetRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Deletes the specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - public static void DeleteDataset(this IDatasetsOperations operations, string datasetId) - { - operations.DeleteDatasetAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Deletes the specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task DeleteDatasetAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteDatasetWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Executes Data Analysis Expressions (DAX) queries against the provided - /// dataset. The dataset must reside in **My workspace** or another workspace. - /// - /// - /// - /// DAX query errors will result in: - /// - /// - A response error, such as `DAX query failure`. - /// - A failure HTTP status code (400). - /// - /// A query that requests more than one table, or more than the allowed number - /// of table rows, will result in: - /// - /// - Limited data being returned. - /// - A response error, such as `More than one result table in a query` or - /// `More than {allowed number} rows in a query result`. - /// - A successful HTTP status code (200). - /// - /// Columns that are fully qualified in the query will be returned with a fully - /// qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed - /// or created in the query will be returned within square bracket, for - /// example, `[MyNewColumn]`. - /// - /// ## Permissions - /// - /// The user must have dataset read permissions. For more information, see - /// [Manage dataset access - /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// - Datasets that are hosted in Azure Analysis Services or that have a live - /// connection to an on-premises Azure Analysis Services model aren't - /// supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found under - /// **Integration settings**, must be enabled. - /// - One query per API call. - /// - One table request per query. - /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit - /// first). For example if you query for 5 columns, you can get back max - /// 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows - /// (1 million divided by 20). - /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row - /// will be completed but no additional rows will be written. - /// - There's a limit of 120 query requests per minute per user, regardless of - /// the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin tenant - /// setting [_Allow service principals to use Power BI - /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. - /// - Only DAX queries are supported at this time. MDX and DMV queries are not - /// supported. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The request message - /// - public static DatasetExecuteQueriesResponse ExecuteQueries(this IDatasetsOperations operations, string datasetId, DatasetExecuteQueriesRequest requestMessage) - { - return operations.ExecuteQueriesAsync(datasetId, requestMessage).GetAwaiter().GetResult(); - } - - /// - /// Executes Data Analysis Expressions (DAX) queries against the provided - /// dataset. The dataset must reside in **My workspace** or another workspace. - /// - /// - /// - /// DAX query errors will result in: - /// - /// - A response error, such as `DAX query failure`. - /// - A failure HTTP status code (400). - /// - /// A query that requests more than one table, or more than the allowed number - /// of table rows, will result in: - /// - /// - Limited data being returned. - /// - A response error, such as `More than one result table in a query` or - /// `More than {allowed number} rows in a query result`. - /// - A successful HTTP status code (200). - /// - /// Columns that are fully qualified in the query will be returned with a fully - /// qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed - /// or created in the query will be returned within square bracket, for - /// example, `[MyNewColumn]`. - /// - /// ## Permissions - /// - /// The user must have dataset read permissions. For more information, see - /// [Manage dataset access - /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// - Datasets that are hosted in Azure Analysis Services or that have a live - /// connection to an on-premises Azure Analysis Services model aren't - /// supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found under - /// **Integration settings**, must be enabled. - /// - One query per API call. - /// - One table request per query. - /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit - /// first). For example if you query for 5 columns, you can get back max - /// 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows - /// (1 million divided by 20). - /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row - /// will be completed but no additional rows will be written. - /// - There's a limit of 120 query requests per minute per user, regardless of - /// the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin tenant - /// setting [_Allow service principals to use Power BI - /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. - /// - Only DAX queries are supported at this time. MDX and DMV queries are not - /// supported. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The request message - /// - /// - /// The cancellation token. - /// - public static async Task ExecuteQueriesAsync(this IDatasetsOperations operations, string datasetId, DatasetExecuteQueriesRequest requestMessage, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ExecuteQueriesWithHttpMessagesAsync(datasetId, requestMessage, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns a list of tables within the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - public static Tables GetTables(this IDatasetsOperations operations, string datasetId) - { - return operations.GetTablesAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of tables within the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetTablesAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetTablesWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates the metadata and schema for the specified table within the - /// specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// Table name and columns to update existing table - /// - public static Table PutTable(this IDatasetsOperations operations, string datasetId, string tableName, Table requestMessage) - { - return operations.PutTableAsync(datasetId, tableName, requestMessage).GetAwaiter().GetResult(); - } - - /// - /// Updates the metadata and schema for the specified table within the - /// specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// Table name and columns to update existing table - /// - /// - /// The cancellation token. - /// - public static async Task
PutTableAsync(this IDatasetsOperations operations, string datasetId, string tableName, Table requestMessage, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.PutTableWithHttpMessagesAsync(datasetId, tableName, requestMessage, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Adds new data rows to the specified table within the specified dataset from - /// **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - This API call only supports **push datasets**. - /// - See [Power BI REST API - /// limitations](/power-bi/developer/automation/api-rest-api-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The request message - /// - public static void PostRows(this IDatasetsOperations operations, string datasetId, string tableName, PostRowsRequest requestMessage) - { - operations.PostRowsAsync(datasetId, tableName, requestMessage).GetAwaiter().GetResult(); - } - - /// - /// Adds new data rows to the specified table within the specified dataset from - /// **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - This API call only supports **push datasets**. - /// - See [Power BI REST API - /// limitations](/power-bi/developer/automation/api-rest-api-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The request message - /// - /// - /// The cancellation token. - /// - public static async Task PostRowsAsync(this IDatasetsOperations operations, string datasetId, string tableName, PostRowsRequest requestMessage, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.PostRowsWithHttpMessagesAsync(datasetId, tableName, requestMessage, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Deletes all rows from the specified table within the specified dataset from - /// **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - public static void DeleteRows(this IDatasetsOperations operations, string datasetId, string tableName) - { - operations.DeleteRowsAsync(datasetId, tableName).GetAwaiter().GetResult(); - } - - /// - /// Deletes all rows from the specified table within the specified dataset from - /// **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The cancellation token. - /// - public static async Task DeleteRowsAsync(this IDatasetsOperations operations, string datasetId, string tableName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteRowsWithHttpMessagesAsync(datasetId, tableName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns the refresh history for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// OneDrive refresh history isn't returned. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The requested number of entries in the refresh history. If not provided, - /// the default is the last available 60 entries. - /// - public static Refreshes GetRefreshHistory(this IDatasetsOperations operations, string datasetId, int? top = default(int?)) - { - return operations.GetRefreshHistoryAsync(datasetId, top).GetAwaiter().GetResult(); - } - - /// - /// Returns the refresh history for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// OneDrive refresh history isn't returned. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The requested number of entries in the refresh history. If not provided, - /// the default is the last available 60 entries. - /// - /// - /// The cancellation token. - /// - public static async Task GetRefreshHistoryAsync(this IDatasetsOperations operations, string datasetId, int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetRefreshHistoryWithHttpMessagesAsync(datasetId, top, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Triggers a refresh for the specified dataset from **My workspace**. An - /// [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) is - /// triggered only if a request payload other than `notifyOption` is set. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - For Shared capacities, a maximum of eight requests per day, including - /// refreshes executed by using scheduled refresh, can be initiated. - /// - For Shared capacities, only `notifyOption` can be specified in the - /// request body. - /// - Enhanced refresh is not supported for shared capacities. - /// - For enhanced refresh, `notifyOption` is not required and must be excluded - /// from the request body. However, one or more parameters other than - /// `notifyOption` are required. - /// - For Premium capacities, the maximum requests per day is only limited by - /// the available resources in the capacity. If available resources are - /// overloaded, refreshes are throttled until the load is reduced. The refresh - /// will fail if throttling exceeds 1 hour. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// - public static DatasetsRefreshDatasetHeaders RefreshDataset(this IDatasetsOperations operations, string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest)) - { - return operations.RefreshDatasetAsync(datasetId, datasetRefreshRequest).GetAwaiter().GetResult(); - } - - /// - /// Triggers a refresh for the specified dataset from **My workspace**. An - /// [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) is - /// triggered only if a request payload other than `notifyOption` is set. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - For Shared capacities, a maximum of eight requests per day, including - /// refreshes executed by using scheduled refresh, can be initiated. - /// - For Shared capacities, only `notifyOption` can be specified in the - /// request body. - /// - Enhanced refresh is not supported for shared capacities. - /// - For enhanced refresh, `notifyOption` is not required and must be excluded - /// from the request body. However, one or more parameters other than - /// `notifyOption` are required. - /// - For Premium capacities, the maximum requests per day is only limited by - /// the available resources in the capacity. If available resources are - /// overloaded, refreshes are throttled until the load is reduced. The refresh - /// will fail if throttling exceeds 1 hour. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task RefreshDatasetAsync(this IDatasetsOperations operations, string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.RefreshDatasetWithHttpMessagesAsync(datasetId, datasetRefreshRequest, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Headers; - } - } - - /// - /// Returns execution details of an [enhanced refresh - /// operation](/power-bi/connect-data/asynchronous-refresh) for the specified - /// dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - public static DatasetRefreshDetail GetRefreshExecutionDetails(this IDatasetsOperations operations, System.Guid datasetId, System.Guid refreshId) - { - return operations.GetRefreshExecutionDetailsAsync(datasetId, refreshId).GetAwaiter().GetResult(); - } - - /// - /// Returns execution details of an [enhanced refresh - /// operation](/power-bi/connect-data/asynchronous-refresh) for the specified - /// dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - /// - /// The cancellation token. - /// - public static async Task GetRefreshExecutionDetailsAsync(this IDatasetsOperations operations, System.Guid datasetId, System.Guid refreshId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetRefreshExecutionDetailsWithHttpMessagesAsync(datasetId, refreshId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Cancels the specified refresh operation for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - public static void CancelRefresh(this IDatasetsOperations operations, System.Guid datasetId, System.Guid refreshId) - { - operations.CancelRefreshAsync(datasetId, refreshId).GetAwaiter().GetResult(); - } - - /// - /// Cancels the specified refresh operation for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - /// - /// The cancellation token. - /// - public static async Task CancelRefreshAsync(this IDatasetsOperations operations, System.Guid datasetId, System.Guid refreshId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.CancelRefreshWithHttpMessagesAsync(datasetId, refreshId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns the refresh schedule for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - public static RefreshSchedule GetRefreshSchedule(this IDatasetsOperations operations, string datasetId) - { - return operations.GetRefreshScheduleAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns the refresh schedule for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetRefreshScheduleAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetRefreshScheduleWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates the refresh schedule for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// A request that disables the refresh schedule should contain no other - /// changes. - /// - /// At least one day must be specified. If no times are specified, then Power - /// BI will use a default single time per day. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// The limit on the number of time slots per day depends on whether a - /// [Premium](/power-bi/admin/service-premium-what-is) or Shared capacity is - /// used. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// Update Refresh Schedule parameters, by specifying all or some of the - /// parameters - /// - public static void UpdateRefreshSchedule(this IDatasetsOperations operations, string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest) - { - operations.UpdateRefreshScheduleAsync(datasetId, datasetModelRefreshScheduleRequest).GetAwaiter().GetResult(); - } - - /// - /// Updates the refresh schedule for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// A request that disables the refresh schedule should contain no other - /// changes. - /// - /// At least one day must be specified. If no times are specified, then Power - /// BI will use a default single time per day. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// The limit on the number of time slots per day depends on whether a - /// [Premium](/power-bi/admin/service-premium-what-is) or Shared capacity is - /// used. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// Update Refresh Schedule parameters, by specifying all or some of the - /// parameters - /// - /// - /// The cancellation token. - /// - public static async Task UpdateRefreshScheduleAsync(this IDatasetsOperations operations, string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateRefreshScheduleWithHttpMessagesAsync(datasetId, datasetModelRefreshScheduleRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - public static DirectQueryRefreshSchedule GetDirectQueryRefreshSchedule(this IDatasetsOperations operations, string datasetId) - { - return operations.GetDirectQueryRefreshScheduleAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetDirectQueryRefreshScheduleAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDirectQueryRefreshScheduleWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from **My workspace**. - /// - /// - /// - /// A request should contain either a set of days and times *or* a valid - /// frequency, but not both. If you choose a set of days without specifying any - /// times, then Power BI will use a default single time per day. Setting the - /// frequency will automatically overwrite the days and times setting. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by - /// specifying all or some of the parameters - /// - public static void UpdateDirectQueryRefreshSchedule(this IDatasetsOperations operations, string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest) - { - operations.UpdateDirectQueryRefreshScheduleAsync(datasetId, datasetDQRefreshScheduleRequest).GetAwaiter().GetResult(); - } - - /// - /// Updates the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from **My workspace**. - /// - /// - /// - /// A request should contain either a set of days and times *or* a valid - /// frequency, but not both. If you choose a set of days without specifying any - /// times, then Power BI will use a default single time per day. Setting the - /// frequency will automatically overwrite the days and times setting. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by - /// specifying all or some of the parameters - /// - /// - /// The cancellation token. - /// - public static async Task UpdateDirectQueryRefreshScheduleAsync(this IDatasetsOperations operations, string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateDirectQueryRefreshScheduleWithHttpMessagesAsync(datasetId, datasetDQRefreshScheduleRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns a list of parameters for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections - /// aren't supported. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - public static MashupParameters GetParameters(this IDatasetsOperations operations, string datasetId) - { - return operations.GetParametersAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of parameters for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections - /// aren't supported. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetParametersAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetParametersWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates the parameters values for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with - /// this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - If you're using **enhanced dataset metadata**, refresh the dataset - /// to apply the new parameter values. - /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes - /// for the update data sources operation to complete, and then refresh the - /// dataset. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. - /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) - /// connections are only supported with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - Datasets with Azure Analysis Services live connections aren't supported. - /// - Maximum of 100 parameters per request. - /// - All specified parameters must exist in the dataset. - /// - Parameters values should be of the expected type. - /// - The parameter list can't be empty or include duplicate parameters. - /// - Parameters names are case-sensitive. - /// - Parameter `IsRequired` must have a non-empty value. - /// - The parameter types `Any` and `Binary` can't be updated. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// - public static void UpdateParameters(this IDatasetsOperations operations, string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest) - { - operations.UpdateParametersAsync(datasetId, updateMashupParametersRequest).GetAwaiter().GetResult(); - } - - /// - /// Updates the parameters values for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with - /// this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - If you're using **enhanced dataset metadata**, refresh the dataset - /// to apply the new parameter values. - /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes - /// for the update data sources operation to complete, and then refresh the - /// dataset. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. - /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) - /// connections are only supported with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - Datasets with Azure Analysis Services live connections aren't supported. - /// - Maximum of 100 parameters per request. - /// - All specified parameters must exist in the dataset. - /// - Parameters values should be of the expected type. - /// - The parameter list can't be empty or include duplicate parameters. - /// - Parameters names are case-sensitive. - /// - Parameter `IsRequired` must have a non-empty value. - /// - The parameter types `Any` and `Binary` can't be updated. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task UpdateParametersAsync(this IDatasetsOperations operations, string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateParametersWithHttpMessagesAsync(datasetId, updateMashupParametersRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns a list of data sources for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - public static Datasources GetDatasources(this IDatasetsOperations operations, string datasetId) - { - return operations.GetDatasourcesAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of data sources for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasourcesAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasourcesWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates the data sources of the specified dataset from **My workspace**. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with - /// this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - The original data source and the new data source must have the exact - /// same schema. - /// > - If you're using **enhanced dataset metadata**, refresh the dataset - /// to get data from the new data sources. - /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes - /// for the update data sources operation to complete, and then refresh the - /// dataset. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. - /// - Only these data sources are supported: SQL Server, Azure SQL Server, - /// Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and - /// SAP HANA. For other data sources, use the [Update - /// Parameters](/rest/api/power-bi/datasets/update-parameters) API call. - /// - Changing the data source type isn't supported. - /// - Data sources that contain parameters in the connection string aren't - /// supported. - /// - Updating data sources that are part of merged or joined tables is only - /// supported if you're using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - For an Advanced Query that references multiple data sources, only the - /// first data source will be updated. To overcome this limitation, define the - /// data source as a parameter and use the [Update - /// Parameters](/rest/api/power-bi/datasets/update-parameters) API call. - /// - Datasets with incremental refresh policy are not fully supported, calling - /// this API may not work as expected and result of partial datasources update, - /// to overcome this you can try run a dataset refresh before calling this API. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// - public static void UpdateDatasources(this IDatasetsOperations operations, string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest) - { - operations.UpdateDatasourcesAsync(datasetId, updateDatasourcesRequest).GetAwaiter().GetResult(); - } - - /// - /// Updates the data sources of the specified dataset from **My workspace**. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with - /// this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - The original data source and the new data source must have the exact - /// same schema. - /// > - If you're using **enhanced dataset metadata**, refresh the dataset - /// to get data from the new data sources. - /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes - /// for the update data sources operation to complete, and then refresh the - /// dataset. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. - /// - Only these data sources are supported: SQL Server, Azure SQL Server, - /// Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and - /// SAP HANA. For other data sources, use the [Update - /// Parameters](/rest/api/power-bi/datasets/update-parameters) API call. - /// - Changing the data source type isn't supported. - /// - Data sources that contain parameters in the connection string aren't - /// supported. - /// - Updating data sources that are part of merged or joined tables is only - /// supported if you're using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - For an Advanced Query that references multiple data sources, only the - /// first data source will be updated. To overcome this limitation, define the - /// data source as a parameter and use the [Update - /// Parameters](/rest/api/power-bi/datasets/update-parameters) API call. - /// - Datasets with incremental refresh policy are not fully supported, calling - /// this API may not work as expected and result of partial datasources update, - /// to overcome this you can try run a dataset refresh before calling this API. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task UpdateDatasourcesAsync(this IDatasetsOperations operations, string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateDatasourcesWithHttpMessagesAsync(datasetId, updateDatasourcesRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Updates all connections for the specified dataset from **My workspace**. - /// This API call only supports SQL DirectQuery datasets. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated and no longer supported. This API call - /// isn't compatible with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// > - /// > Instead use: - /// > - /// > - [Update Parameters](/rest/api/power-bi/datasets/update-parameters) - /// to update connections for SQL, Azure Synapse, OData, and SharePoint data - /// sources. - /// > - [Update Datasources](/rest/api/power-bi/datasets/update-datasources) - /// to connections for other data sources. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The body - /// - [System.Obsolete()] - public static void SetAllDatasetConnections(this IDatasetsOperations operations, string datasetId, ConnectionDetails parameters) - { - operations.SetAllDatasetConnectionsAsync(datasetId, parameters).GetAwaiter().GetResult(); - } - - /// - /// Updates all connections for the specified dataset from **My workspace**. - /// This API call only supports SQL DirectQuery datasets. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated and no longer supported. This API call - /// isn't compatible with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// > - /// > Instead use: - /// > - /// > - [Update Parameters](/rest/api/power-bi/datasets/update-parameters) - /// to update connections for SQL, Azure Synapse, OData, and SharePoint data - /// sources. - /// > - [Update Datasources](/rest/api/power-bi/datasets/update-datasources) - /// to connections for other data sources. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The body - /// - /// - /// The cancellation token. - /// - [System.Obsolete()] - public static async Task SetAllDatasetConnectionsAsync(this IDatasetsOperations operations, string datasetId, ConnectionDetails parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.SetAllDatasetConnectionsWithHttpMessagesAsync(datasetId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Binds the specified dataset from **My workspace** to the specified gateway, - /// optionally with a given set of data source IDs. If you don't supply a - /// specific data source ID, the dataset will be bound to the first matching - /// data source in the gateway. - /// - /// - /// - /// > [!IMPORTANT] - /// > Add the API caller principal as a data source user on the gateway. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Only supports the on-premises data gateway - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The bind to gateway request - /// - public static void BindToGateway(this IDatasetsOperations operations, string datasetId, BindToGatewayRequest bindToGatewayRequest) - { - operations.BindToGatewayAsync(datasetId, bindToGatewayRequest).GetAwaiter().GetResult(); - } - - /// - /// Binds the specified dataset from **My workspace** to the specified gateway, - /// optionally with a given set of data source IDs. If you don't supply a - /// specific data source ID, the dataset will be bound to the first matching - /// data source in the gateway. - /// - /// - /// - /// > [!IMPORTANT] - /// > Add the API caller principal as a data source user on the gateway. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Only supports the on-premises data gateway - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The bind to gateway request - /// - /// - /// The cancellation token. - /// - public static async Task BindToGatewayAsync(this IDatasetsOperations operations, string datasetId, BindToGatewayRequest bindToGatewayRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BindToGatewayWithHttpMessagesAsync(datasetId, bindToGatewayRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns a list of gateway data sources for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated, use [Get - /// Datasources](/rest/api/power-bi/datasets/get-datasources) instead. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - public static GatewayDatasources GetGatewayDatasources(this IDatasetsOperations operations, string datasetId) - { - return operations.GetGatewayDatasourcesAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of gateway data sources for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated, use [Get - /// Datasources](/rest/api/power-bi/datasets/get-datasources) instead. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetGatewayDatasourcesAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetGatewayDatasourcesWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns a list of gateways that the specified dataset from **My workspace** - /// can be bound to. - /// - /// - /// - /// This API call is only relevant to datasets that have at least one - /// on-premises connection. For datasets with cloud-only connections, this API - /// call returns an empty list. - /// - /// ## Required Scope - /// - /// Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - public static Gateways DiscoverGateways(this IDatasetsOperations operations, string datasetId) - { - return operations.DiscoverGatewaysAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of gateways that the specified dataset from **My workspace** - /// can be bound to. - /// - /// - /// - /// This API call is only relevant to datasets that have at least one - /// on-premises connection. For datasets with cloud-only connections, this API - /// call returns an empty list. - /// - /// ## Required Scope - /// - /// Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task DiscoverGatewaysAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.DiscoverGatewaysWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns the query scale-out sync status for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - public static DatasetQueryScaleOutSyncStatus GetQueryScaleOutSyncStatus(this IDatasetsOperations operations, string datasetId) - { - return operations.GetQueryScaleOutSyncStatusAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns the query scale-out sync status for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetQueryScaleOutSyncStatusAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetQueryScaleOutSyncStatusWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Triggers a query scale-out sync of read-only replicas for the specified - /// dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - public static DatasetQueryScaleOutSyncStatus TriggerQueryScaleOutSync(this IDatasetsOperations operations, string datasetId) - { - return operations.TriggerQueryScaleOutSyncAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Triggers a query scale-out sync of read-only replicas for the specified - /// dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task TriggerQueryScaleOutSyncAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.TriggerQueryScaleOutSyncWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Grants the specified user's permissions to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Limitations - /// - /// - Adding permissions to service principals (app principalType) isn't - /// supported - /// - Caller must have ReadReshare permissions on the dataset. - /// - This API call can't be used to grant dataset Write permission on the - /// dataset - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - public static void PostDatasetUserInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, PostDatasetUserAccess userDetails) - { - operations.PostDatasetUserInGroupAsync(groupId, datasetId, userDetails).GetAwaiter().GetResult(); - } - - /// - /// Grants the specified user's permissions to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Limitations - /// - /// - Adding permissions to service principals (app principalType) isn't - /// supported - /// - Caller must have ReadReshare permissions on the dataset. - /// - This API call can't be used to grant dataset Write permission on the - /// dataset - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - /// - /// The cancellation token. - /// - public static async Task PostDatasetUserInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, PostDatasetUserAccess userDetails, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.PostDatasetUserInGroupWithHttpMessagesAsync(groupId, datasetId, userDetails, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Updates the existing dataset permissions of the specified user to the - /// specified permissions. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// This API call can be used to remove all the dataset permissions of the - /// specified user by using `datasetUserAccessRight: None` - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// ## Limitations - /// - /// - Updating permissions to service principals (app principalType) isn't - /// supported - /// - Caller must have ReadWriteReshare permissions on the dataset. That is, - /// folder admins, members and contributors with Reshare permissions, or - /// dataset owners. - /// - This API can't be used to add or remove *write* permission. - /// - This API can't be used to remove folder-level inherited permissions. For - /// folder admins and members, the ReadWriteReshareExplore permission on the - /// folder's datasets is inherited. For folder contributors, the - /// ReadWriteExplore permission on the folder's datasets is inherited. For - /// folder viewers, the Read permission on the folder's datasets is inherited. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - public static void PutDatasetUserInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DatasetUserAccess userDetails) - { - operations.PutDatasetUserInGroupAsync(groupId, datasetId, userDetails).GetAwaiter().GetResult(); - } - - /// - /// Updates the existing dataset permissions of the specified user to the - /// specified permissions. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// This API call can be used to remove all the dataset permissions of the - /// specified user by using `datasetUserAccessRight: None` - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// ## Limitations - /// - /// - Updating permissions to service principals (app principalType) isn't - /// supported - /// - Caller must have ReadWriteReshare permissions on the dataset. That is, - /// folder admins, members and contributors with Reshare permissions, or - /// dataset owners. - /// - This API can't be used to add or remove *write* permission. - /// - This API can't be used to remove folder-level inherited permissions. For - /// folder admins and members, the ReadWriteReshareExplore permission on the - /// folder's datasets is inherited. For folder contributors, the - /// ReadWriteExplore permission on the folder's datasets is inherited. For - /// folder viewers, the Read permission on the folder's datasets is inherited. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - /// - /// The cancellation token. - /// - public static async Task PutDatasetUserInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DatasetUserAccess userDetails, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.PutDatasetUserInGroupWithHttpMessagesAsync(groupId, datasetId, userDetails, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns a list of principals that have access to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// ## Limitations - /// - /// Caller must have ReadWriteReshare permissions on the dataset. That is, - /// folder admins, members and contributors with Reshare permissions, or - /// dataset owners. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - public static DatasetUsersAccess GetDatasetUsersInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) - { - return operations.GetDatasetUsersInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of principals that have access to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// ## Limitations - /// - /// Caller must have ReadWriteReshare permissions on the dataset. That is, - /// folder admins, members and contributors with Reshare permissions, or - /// dataset owners. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasetUsersInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasetUsersInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Grants the specified user's permissions to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Limitations - /// - /// - Adding permissions to service principals (app principalType) isn't - /// supported - /// - Caller must have ReadReshare permissions on the dataset. - /// - This API call can't be used to grant dataset Write permission on the - /// dataset - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - public static void PostDatasetUser(this IDatasetsOperations operations, string datasetId, PostDatasetUserAccess userDetails) - { - operations.PostDatasetUserAsync(datasetId, userDetails).GetAwaiter().GetResult(); - } - - /// - /// Grants the specified user's permissions to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Limitations - /// - /// - Adding permissions to service principals (app principalType) isn't - /// supported - /// - Caller must have ReadReshare permissions on the dataset. - /// - This API call can't be used to grant dataset Write permission on the - /// dataset - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - /// - /// The cancellation token. - /// - public static async Task PostDatasetUserAsync(this IDatasetsOperations operations, string datasetId, PostDatasetUserAccess userDetails, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.PostDatasetUserWithHttpMessagesAsync(datasetId, userDetails, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Updates the existing dataset permissions of the specified user to the - /// specified permissions. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// This API call can be used to remove all the dataset permissions of the - /// specified user by using `datasetUserAccessRight: None` - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// ## Limitations - /// - /// - Updating permissions to service principals (app principalType) isn't - /// supported - /// - Caller must have ReadWriteReshare permissions on the dataset. That is, - /// folder admins, members and contributors with Reshare permissions, or - /// dataset owners. - /// - This API can't be used to add or remove *write* permission. - /// - This API can't be used to remove folder-level inherited permissions. For - /// folder admins and members, the ReadWriteReshareExplore permission on the - /// folder's datasets is inherited. For folder contributors, the - /// ReadWriteExplore permission on the folder's datasets is inherited. For - /// folder viewers, the Read permission on the folder's datasets is inherited. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - public static void PutDatasetUser(this IDatasetsOperations operations, string datasetId, DatasetUserAccess userDetails) - { - operations.PutDatasetUserAsync(datasetId, userDetails).GetAwaiter().GetResult(); - } - - /// - /// Updates the existing dataset permissions of the specified user to the - /// specified permissions. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// This API call can be used to remove all the dataset permissions of the - /// specified user by using `datasetUserAccessRight: None` - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// ## Limitations - /// - /// - Updating permissions to service principals (app principalType) isn't - /// supported - /// - Caller must have ReadWriteReshare permissions on the dataset. That is, - /// folder admins, members and contributors with Reshare permissions, or - /// dataset owners. - /// - This API can't be used to add or remove *write* permission. - /// - This API can't be used to remove folder-level inherited permissions. For - /// folder admins and members, the ReadWriteReshareExplore permission on the - /// folder's datasets is inherited. For folder contributors, the - /// ReadWriteExplore permission on the folder's datasets is inherited. For - /// folder viewers, the Read permission on the folder's datasets is inherited. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - /// - /// The cancellation token. - /// - public static async Task PutDatasetUserAsync(this IDatasetsOperations operations, string datasetId, DatasetUserAccess userDetails, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.PutDatasetUserWithHttpMessagesAsync(datasetId, userDetails, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns a list of principals that have access to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// ## Limitations - /// - /// Caller must have ReadWriteReshare permissions on the dataset. That is, - /// folder admins, members and contributors with Reshare permissions, or - /// dataset owners. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - public static DatasetUsersAccess GetDatasetUsers(this IDatasetsOperations operations, string datasetId) - { - return operations.GetDatasetUsersAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of principals that have access to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the new - /// permissions might not be immediately available through API calls. To - /// refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. - /// - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// ## Limitations - /// - /// Caller must have ReadWriteReshare permissions on the dataset. That is, - /// folder admins, members and contributors with Reshare permissions, or - /// dataset owners. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasetUsersAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasetUsersWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns a list of datasets from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - public static Datasets GetDatasetsInGroup(this IDatasetsOperations operations, System.Guid groupId) - { - return operations.GetDatasetsInGroupAsync(groupId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of datasets from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasetsInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasetsInGroupWithHttpMessagesAsync(groupId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Creates a new dataset in the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// Create dataset parameters - /// - /// - /// The default retention policy. Possible values include: 'None', 'basicFIFO' - /// - public static Dataset PostDatasetInGroup(this IDatasetsOperations operations, System.Guid groupId, CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?)) - { - return operations.PostDatasetInGroupAsync(groupId, dataset, defaultRetentionPolicy).GetAwaiter().GetResult(); - } - - /// - /// Creates a new dataset in the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// Create dataset parameters - /// - /// - /// The default retention policy. Possible values include: 'None', 'basicFIFO' - /// - /// - /// The cancellation token. - /// - public static async Task PostDatasetInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.PostDatasetInGroupWithHttpMessagesAsync(groupId, dataset, defaultRetentionPolicy, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns a list of upstream dataflows for datasets from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - public static DatasetToDataflowLinksResponse GetDatasetToDataflowsLinksInGroup(this IDatasetsOperations operations, System.Guid groupId) - { - return operations.GetDatasetToDataflowsLinksInGroupAsync(groupId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of upstream dataflows for datasets from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasetToDataflowsLinksInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasetToDataflowsLinksInGroupWithHttpMessagesAsync(groupId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns the specified dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - public static Dataset GetDatasetInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) - { - return operations.GetDatasetInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns the specified dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasetInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasetInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates the properties for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Update dataset request parameters - /// - public static void UpdateDatasetInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, UpdateDatasetRequest updateDatasetRequest) - { - operations.UpdateDatasetInGroupAsync(groupId, datasetId, updateDatasetRequest).GetAwaiter().GetResult(); - } - - /// - /// Updates the properties for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Update dataset request parameters - /// - /// - /// The cancellation token. - /// - public static async Task UpdateDatasetInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, UpdateDatasetRequest updateDatasetRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateDatasetInGroupWithHttpMessagesAsync(groupId, datasetId, updateDatasetRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Deletes the specified dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - public static void DeleteDatasetInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) - { - operations.DeleteDatasetInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); - } - - /// - /// Deletes the specified dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task DeleteDatasetInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteDatasetInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns a list of tables within the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Required Scope - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - public static Tables GetTablesInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) - { - return operations.GetTablesInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of tables within the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Required Scope - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetTablesInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetTablesInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates the metadata and schema for the specified table within the - /// specified dataset from the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The request message - /// - public static Table PutTableInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, string tableName, Table requestMessage) - { - return operations.PutTableInGroupAsync(groupId, datasetId, tableName, requestMessage).GetAwaiter().GetResult(); - } - - /// - /// Updates the metadata and schema for the specified table within the - /// specified dataset from the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The request message - /// - /// - /// The cancellation token. - /// - public static async Task
PutTableInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, string tableName, Table requestMessage, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.PutTableInGroupWithHttpMessagesAsync(groupId, datasetId, tableName, requestMessage, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Adds new data rows to the specified table within the specified dataset from - /// the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - This API call only supports **push datasets**. - /// - See [Power BI REST API - /// limitations](/power-bi/developer/automation/api-rest-api-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The request message - /// - public static void PostRowsInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, string tableName, PostRowsRequest requestMessage) - { - operations.PostRowsInGroupAsync(groupId, datasetId, tableName, requestMessage).GetAwaiter().GetResult(); - } - - /// - /// Adds new data rows to the specified table within the specified dataset from - /// the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - This API call only supports **push datasets**. - /// - See [Power BI REST API - /// limitations](/power-bi/developer/automation/api-rest-api-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The request message - /// - /// - /// The cancellation token. - /// - public static async Task PostRowsInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, string tableName, PostRowsRequest requestMessage, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.PostRowsInGroupWithHttpMessagesAsync(groupId, datasetId, tableName, requestMessage, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Deletes all rows from the specified table within the specified dataset from - /// the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - public static void DeleteRowsInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, string tableName) - { - operations.DeleteRowsInGroupAsync(groupId, datasetId, tableName).GetAwaiter().GetResult(); - } - - /// - /// Deletes all rows from the specified table within the specified dataset from - /// the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list of - /// limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The cancellation token. - /// - public static async Task DeleteRowsInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, string tableName, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.DeleteRowsInGroupWithHttpMessagesAsync(groupId, datasetId, tableName, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns the refresh history for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// OneDrive refresh history isn't returned. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The requested number of entries in the refresh history. If not provided, - /// the default is the last available 60 entries. - /// - public static Refreshes GetRefreshHistoryInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, int? top = default(int?)) - { - return operations.GetRefreshHistoryInGroupAsync(groupId, datasetId, top).GetAwaiter().GetResult(); - } - - /// - /// Returns the refresh history for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// OneDrive refresh history isn't returned. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The requested number of entries in the refresh history. If not provided, - /// the default is the last available 60 entries. - /// - /// - /// The cancellation token. - /// - public static async Task GetRefreshHistoryInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetRefreshHistoryInGroupWithHttpMessagesAsync(groupId, datasetId, top, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Triggers a refresh for the specified dataset from the specified workspace. - /// An [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) is - /// triggered only if a request payload other than `notifyOption` is set. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - For Shared capacities, a maximum of eight requests per day, including - /// refreshes executed by using scheduled refresh, can be initiated. - /// - For Shared capacities, only `notifyOption` can be specified in the - /// request body. - /// - Enhanced refresh is not supported for shared capacities. - /// - For enhanced refresh, `notifyOption` is not required and must be excluded - /// from the request body. However, one or more parameters other than - /// `notifyOption` are required. - /// - For Premium capacities, the maximum requests per day is only limited by - /// the available resources in the capacity. If available resources are - /// overloaded, refreshes are throttled until the load is reduced. The refresh - /// will fail if throttling exceeds 1 hour. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// - public static DatasetsRefreshDatasetInGroupHeaders RefreshDatasetInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest)) - { - return operations.RefreshDatasetInGroupAsync(groupId, datasetId, datasetRefreshRequest).GetAwaiter().GetResult(); - } - - /// - /// Triggers a refresh for the specified dataset from the specified workspace. - /// An [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) is - /// triggered only if a request payload other than `notifyOption` is set. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - For Shared capacities, a maximum of eight requests per day, including - /// refreshes executed by using scheduled refresh, can be initiated. - /// - For Shared capacities, only `notifyOption` can be specified in the - /// request body. - /// - Enhanced refresh is not supported for shared capacities. - /// - For enhanced refresh, `notifyOption` is not required and must be excluded - /// from the request body. However, one or more parameters other than - /// `notifyOption` are required. - /// - For Premium capacities, the maximum requests per day is only limited by - /// the available resources in the capacity. If available resources are - /// overloaded, refreshes are throttled until the load is reduced. The refresh - /// will fail if throttling exceeds 1 hour. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task RefreshDatasetInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.RefreshDatasetInGroupWithHttpMessagesAsync(groupId, datasetId, datasetRefreshRequest, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Headers; - } - } - - /// - /// Returns execution details of an [enhanced refresh - /// operation](/power-bi/connect-data/asynchronous-refresh) for the specified - /// dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - public static DatasetRefreshDetail GetRefreshExecutionDetailsInGroup(this IDatasetsOperations operations, System.Guid groupId, System.Guid datasetId, System.Guid refreshId) - { - return operations.GetRefreshExecutionDetailsInGroupAsync(groupId, datasetId, refreshId).GetAwaiter().GetResult(); - } - - /// - /// Returns execution details of an [enhanced refresh - /// operation](/power-bi/connect-data/asynchronous-refresh) for the specified - /// dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - /// - /// The cancellation token. - /// - public static async Task GetRefreshExecutionDetailsInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, System.Guid datasetId, System.Guid refreshId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetRefreshExecutionDetailsInGroupWithHttpMessagesAsync(groupId, datasetId, refreshId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Cancels the specified refresh operation for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - public static void CancelRefreshInGroup(this IDatasetsOperations operations, System.Guid groupId, System.Guid datasetId, System.Guid refreshId) - { - operations.CancelRefreshInGroupAsync(groupId, datasetId, refreshId).GetAwaiter().GetResult(); - } - - /// - /// Cancels the specified refresh operation for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - /// - /// The cancellation token. - /// - public static async Task CancelRefreshInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, System.Guid datasetId, System.Guid refreshId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.CancelRefreshInGroupWithHttpMessagesAsync(groupId, datasetId, refreshId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns the refresh schedule for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - public static RefreshSchedule GetRefreshScheduleInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) - { - return operations.GetRefreshScheduleInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns the refresh schedule for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetRefreshScheduleInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetRefreshScheduleInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates the refresh schedule for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// A request that disables the refresh schedule should contain no other - /// changes. - /// - /// At least one day must be specified. If no times are specified, then Power - /// BI will use a default single time per day. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// The limit on the number of time slots per day depends on whether a - /// [Premium](/power-bi/admin/service-premium-what-is) or Shared capacity is - /// used. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Update Refresh Schedule parameters, by specifying all or some of the - /// parameters - /// - public static void UpdateRefreshScheduleInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest) - { - operations.UpdateRefreshScheduleInGroupAsync(groupId, datasetId, datasetModelRefreshScheduleRequest).GetAwaiter().GetResult(); - } - - /// - /// Updates the refresh schedule for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// A request that disables the refresh schedule should contain no other - /// changes. - /// - /// At least one day must be specified. If no times are specified, then Power - /// BI will use a default single time per day. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// The limit on the number of time slots per day depends on whether a - /// [Premium](/power-bi/admin/service-premium-what-is) or Shared capacity is - /// used. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Update Refresh Schedule parameters, by specifying all or some of the - /// parameters - /// - /// - /// The cancellation token. - /// - public static async Task UpdateRefreshScheduleInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateRefreshScheduleInGroupWithHttpMessagesAsync(groupId, datasetId, datasetModelRefreshScheduleRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - public static DirectQueryRefreshSchedule GetDirectQueryRefreshScheduleInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) - { - return operations.GetDirectQueryRefreshScheduleInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetDirectQueryRefreshScheduleInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDirectQueryRefreshScheduleInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from the specified workspace. - /// - /// - /// - /// A request should contain either a set of days and times *or* a valid - /// frequency, but not both. If you choose a set of days without specifying any - /// times, then Power BI will use a default single time per day. Setting the - /// frequency will automatically overwrite the days and times setting. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by - /// specifying all or some of the parameters - /// - public static void UpdateDirectQueryRefreshScheduleInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest) - { - operations.UpdateDirectQueryRefreshScheduleInGroupAsync(groupId, datasetId, datasetDQRefreshScheduleRequest).GetAwaiter().GetResult(); - } - - /// - /// Updates the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from the specified workspace. - /// - /// - /// - /// A request should contain either a set of days and times *or* a valid - /// frequency, but not both. If you choose a set of days without specifying any - /// times, then Power BI will use a default single time per day. Setting the - /// frequency will automatically overwrite the days and times setting. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by - /// specifying all or some of the parameters - /// - /// - /// The cancellation token. - /// - public static async Task UpdateDirectQueryRefreshScheduleInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateDirectQueryRefreshScheduleInGroupWithHttpMessagesAsync(groupId, datasetId, datasetDQRefreshScheduleRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns a list of parameters for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections - /// aren't supported. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// - public static MashupParameters GetParametersInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) - { - return operations.GetParametersInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of parameters for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections - /// aren't supported. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task GetParametersInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetParametersInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates the parameters values for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with - /// this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - If you're using **enhanced dataset metadata**, refresh the dataset - /// to apply the new parameter values. - /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes - /// for the update data sources operation to complete, and then refresh the - /// dataset. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. - /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) - /// connections are only supported with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - Datasets with Azure Analysis Services live connections aren't supported. - /// - Maximum of 100 parameters per request. - /// - All specified parameters must exist in the dataset. - /// - Parameters values should be of the expected type. - /// - The parameter list can't be empty or include duplicate parameters. - /// - Parameters names are case-sensitive. - /// - Parameter `IsRequired` must have a non-empty value. - /// - The parameter types `Any` and `Binary` can't be updated. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// - public static void UpdateParametersInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest) - { - operations.UpdateParametersInGroupAsync(groupId, datasetId, updateMashupParametersRequest).GetAwaiter().GetResult(); - } - - /// - /// Updates the parameters values for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with - /// this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - If you're using **enhanced dataset metadata**, refresh the dataset - /// to apply the new parameter values. - /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes - /// for the update data sources operation to complete, and then refresh the - /// dataset. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. - /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) - /// connections are only supported with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - Datasets with Azure Analysis Services live connections aren't supported. - /// - Maximum of 100 parameters per request. - /// - All specified parameters must exist in the dataset. - /// - Parameters values should be of the expected type. - /// - The parameter list can't be empty or include duplicate parameters. - /// - Parameters names are case-sensitive. - /// - Parameter `IsRequired` must have a non-empty value. - /// - The parameter types `Any` and `Binary` can't be updated. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task UpdateParametersInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateParametersInGroupWithHttpMessagesAsync(groupId, datasetId, updateMashupParametersRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns a list of data sources for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// - public static Datasources GetDatasourcesInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) - { - return operations.GetDatasourcesInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of data sources for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasourcesInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasourcesInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Updates the data sources of the specified dataset from the specified - /// workspace. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with - /// this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - The original data source and the new data source must have the exact - /// same schema. - /// > - If you're using **enhanced dataset metadata**, refresh the dataset - /// to get data from the new data sources. - /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes - /// for the update data sources operation to complete, and then refresh the - /// dataset. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. - /// - Only these data sources are supported: SQL Server, Azure SQL Server, - /// Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and - /// SAP HANA. For other data sources, use the [Update Parameters In - /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call. - /// - Changing the data source type isn't supported. - /// - Data sources that contain parameters in the connection string aren't - /// supported. - /// - Updating data sources that are part of merged or joined tables is only - /// supported if you're using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - For an Advanced Query that reference multiple data sources, only the - /// first data source will be updated. To overcome this limitation, define the - /// data source as a parameter and use the [Update Parameters In - /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call. - /// - Datasets with incremental refresh policy are not fully supported, calling - /// this API may not work as expected and result of partial datasources update, - /// to overcome this you can try run a dataset refresh before calling this API. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// - public static void UpdateDatasourcesInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest) - { - operations.UpdateDatasourcesInGroupAsync(groupId, datasetId, updateDatasourcesRequest).GetAwaiter().GetResult(); - } - - /// - /// Updates the data sources of the specified dataset from the specified - /// workspace. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with - /// this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - The original data source and the new data source must have the exact - /// same schema. - /// > - If you're using **enhanced dataset metadata**, refresh the dataset - /// to get data from the new data sources. - /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes - /// for the update data sources operation to complete, and then refresh the - /// dataset. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. - /// - Only these data sources are supported: SQL Server, Azure SQL Server, - /// Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and - /// SAP HANA. For other data sources, use the [Update Parameters In - /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call. - /// - Changing the data source type isn't supported. - /// - Data sources that contain parameters in the connection string aren't - /// supported. - /// - Updating data sources that are part of merged or joined tables is only - /// supported if you're using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - For an Advanced Query that reference multiple data sources, only the - /// first data source will be updated. To overcome this limitation, define the - /// data source as a parameter and use the [Update Parameters In - /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call. - /// - Datasets with incremental refresh policy are not fully supported, calling - /// this API may not work as expected and result of partial datasources update, - /// to overcome this you can try run a dataset refresh before calling this API. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task UpdateDatasourcesInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.UpdateDatasourcesInGroupWithHttpMessagesAsync(groupId, datasetId, updateDatasourcesRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Updates all connections for the specified dataset from the specified - /// workspace. This API call only supports SQL DirectQuery datasets. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated and no longer supported. This API call - /// isn't compatible with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// > - /// > Instead use: - /// > - /// > - [Update Parameters In - /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) to update - /// connections for SQL, Azure Synapse, OData, and SharePoint data sources. - /// > - [Update Datasources In - /// Group](/rest/api/power-bi/datasets/update-datasources-in-group) to - /// connections for other data sources. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Supports SQL DirectQuery datasets. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The body - /// - [System.Obsolete()] - public static void SetAllDatasetConnectionsInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, ConnectionDetails parameters) - { - operations.SetAllDatasetConnectionsInGroupAsync(groupId, datasetId, parameters).GetAwaiter().GetResult(); - } - - /// - /// Updates all connections for the specified dataset from the specified - /// workspace. This API call only supports SQL DirectQuery datasets. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated and no longer supported. This API call - /// isn't compatible with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// > - /// > Instead use: - /// > - /// > - [Update Parameters In - /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) to update - /// connections for SQL, Azure Synapse, OData, and SharePoint data sources. - /// > - [Update Datasources In - /// Group](/rest/api/power-bi/datasets/update-datasources-in-group) to - /// connections for other data sources. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Supports SQL DirectQuery datasets. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The body - /// - /// - /// The cancellation token. - /// - [System.Obsolete()] - public static async Task SetAllDatasetConnectionsInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, ConnectionDetails parameters, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.SetAllDatasetConnectionsInGroupWithHttpMessagesAsync(groupId, datasetId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Binds the specified dataset from the specified workspace to the specified - /// gateway, optionally with a given set of data source IDs. If you don't - /// supply a specific data source ID, the dataset will be bound to the first - /// matching data source in the gateway. - /// - /// - /// - /// > [!IMPORTANT] - /// > Add the API caller principal as a data source user on the gateway. - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Only supports the on-premises data gateway - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The bind to gateway request - /// - public static void BindToGatewayInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, BindToGatewayRequest bindToGatewayRequest) - { - operations.BindToGatewayInGroupAsync(groupId, datasetId, bindToGatewayRequest).GetAwaiter().GetResult(); - } - - /// - /// Binds the specified dataset from the specified workspace to the specified - /// gateway, optionally with a given set of data source IDs. If you don't - /// supply a specific data source ID, the dataset will be bound to the first - /// matching data source in the gateway. - /// - /// - /// - /// > [!IMPORTANT] - /// > Add the API caller principal as a data source user on the gateway. - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Only supports the on-premises data gateway - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The bind to gateway request - /// - /// - /// The cancellation token. - /// - public static async Task BindToGatewayInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, BindToGatewayRequest bindToGatewayRequest, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.BindToGatewayInGroupWithHttpMessagesAsync(groupId, datasetId, bindToGatewayRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Returns a list of gateway data sources for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated, use [Get Datasources In - /// Group](/rest/api/power-bi/datasets/get-datasources-in-group) instead. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - public static GatewayDatasources GetGatewayDatasourcesInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) - { - return operations.GetGatewayDatasourcesInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of gateway data sources for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated, use [Get Datasources In - /// Group](/rest/api/power-bi/datasets/get-datasources-in-group) instead. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetGatewayDatasourcesInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetGatewayDatasourcesInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns a list of gateways that the specified dataset from the specified - /// workspace can be bound to. - /// - /// - /// - /// This API call is only relevant to datasets that have at least one - /// on-premises connection. For datasets with cloud-only connections, this API - /// call returns an empty list. - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - public static Gateways DiscoverGatewaysInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) - { - return operations.DiscoverGatewaysInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of gateways that the specified dataset from the specified - /// workspace can be bound to. - /// - /// - /// - /// This API call is only relevant to datasets that have at least one - /// on-premises connection. For datasets with cloud-only connections, this API - /// call returns an empty list. - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task DiscoverGatewaysInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.DiscoverGatewaysInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Transfers ownership over the specified dataset to the current authorized - /// user. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - public static void TakeOverInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) - { - operations.TakeOverInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); - } - - /// - /// Transfers ownership over the specified dataset to the current authorized - /// user. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task TakeOverInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - (await operations.TakeOverInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)).Dispose(); - } - - /// - /// Executes Data Analysis Expressions (DAX) queries against the provided - /// dataset. - /// - /// - /// - /// DAX query errors will result in: - /// - /// - A response error, such as `DAX query failure`. - /// - A failure HTTP status code (400). - /// - /// A query that requests more than one table, or more than the allowed number - /// of table rows, will result in: - /// - /// - Limited data being returned. - /// - A response error, such as `More than one result table in a query` or - /// `More than {allowed number} rows in a query result`. - /// - A successful HTTP status code (200). - /// - /// Columns that are fully qualified in the query will be returned with a fully - /// qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed - /// or created in the query will be returned within square bracket, for - /// example, `[MyNewColumn]`. - /// - /// ## Permissions - /// - /// The user must have dataset read permissions. For more information, see - /// [Manage dataset access - /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// - Datasets that are hosted in Azure Analysis Services or that have a live - /// connection to an on-premises Azure Analysis Services model aren't - /// supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found under - /// **Integration settings**, must be enabled. - /// - One query per API call. - /// - One table request per query. - /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit - /// first). For example if you query for 5 columns, you can get back max - /// 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows - /// (1 million divided by 20). - /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row - /// will be completed but no additional rows will be written. - /// - There's a limit of 120 query requests per minute per user, regardless of - /// the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin tenant - /// setting [_Allow service principals to use Power BI - /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. - /// - Only DAX queries are supported at this time. MDX and DMV queries are not - /// supported. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The request message - /// - public static DatasetExecuteQueriesResponse ExecuteQueriesInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DatasetExecuteQueriesRequest requestMessage) - { - return operations.ExecuteQueriesInGroupAsync(groupId, datasetId, requestMessage).GetAwaiter().GetResult(); - } - - /// - /// Executes Data Analysis Expressions (DAX) queries against the provided - /// dataset. - /// - /// - /// - /// DAX query errors will result in: - /// - /// - A response error, such as `DAX query failure`. - /// - A failure HTTP status code (400). - /// - /// A query that requests more than one table, or more than the allowed number - /// of table rows, will result in: - /// - /// - Limited data being returned. - /// - A response error, such as `More than one result table in a query` or - /// `More than {allowed number} rows in a query result`. - /// - A successful HTTP status code (200). - /// - /// Columns that are fully qualified in the query will be returned with a fully - /// qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed - /// or created in the query will be returned within square bracket, for - /// example, `[MyNewColumn]`. - /// - /// ## Permissions - /// - /// The user must have dataset read permissions. For more information, see - /// [Manage dataset access - /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// - Datasets that are hosted in Azure Analysis Services or that have a live - /// connection to an on-premises Azure Analysis Services model aren't - /// supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found under - /// **Integration settings**, must be enabled. - /// - One query per API call. - /// - One table request per query. - /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit - /// first). For example if you query for 5 columns, you can get back max - /// 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows - /// (1 million divided by 20). - /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row - /// will be completed but no additional rows will be written. - /// - There's a limit of 120 query requests per minute per user, regardless of - /// the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin tenant - /// setting [_Allow service principals to use Power BI - /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. - /// - Only DAX queries are supported at this time. MDX and DMV queries are not - /// supported. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The request message - /// - /// - /// The cancellation token. - /// - public static async Task ExecuteQueriesInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DatasetExecuteQueriesRequest requestMessage, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.ExecuteQueriesInGroupWithHttpMessagesAsync(groupId, datasetId, requestMessage, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns the query scale-out sync status for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - public static DatasetQueryScaleOutSyncStatus GetQueryScaleOutSyncStatusInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) - { - return operations.GetQueryScaleOutSyncStatusInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns the query scale-out sync status for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetQueryScaleOutSyncStatusInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetQueryScaleOutSyncStatusInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Triggers a query scale-out sync of read-only replicas for the specified - /// dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - public static DatasetQueryScaleOutSyncStatus TriggerQueryScaleOutSyncInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) - { - return operations.TriggerQueryScaleOutSyncInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); - } - - /// - /// Triggers a query scale-out sync of read-only replicas for the specified - /// dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task TriggerQueryScaleOutSyncInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.TriggerQueryScaleOutSyncInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Generates an embed token based on the specified dataset from the specified - /// workspace. - /// - /// - /// - /// > [!TIP] - /// > To create embed tokens, it's recommended to use the latest API, - /// [Generate Token](/rest/api/power-bi/embed-token/generate-token). Generate - /// token supports additional functions, such as creating a token for multiple - /// items. - /// - /// > [!NOTE] - /// > An embed token can be used to [embed - /// Q&A](/power-bi/developer/qanda) within your application. - /// - /// > [!IMPORTANT] - /// > This API call is only relevant to the [embed for your - /// customers](/power-bi/developer/embed-sample-for-customers) scenario. To - /// learn more about using this API, see [Considerations when generating an - /// embed token](/power-bi/developer/embedded/generate-embed-token). - /// - /// ## Permissions - /// - /// - When using a service principal for authentication, refer to [Embed Power - /// BI content with service - /// principal](/power-bi/developer/embed-service-principal) and [Considerations - /// and - /// limitations](/power-bi/developer/embedded/embed-service-principal#considerations-and-limitations). - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Generate token parameters - /// - public static EmbedToken GenerateTokenInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, GenerateTokenRequest requestParameters) - { - return operations.GenerateTokenInGroupAsync(groupId, datasetId, requestParameters).GetAwaiter().GetResult(); - } - - /// - /// Generates an embed token based on the specified dataset from the specified - /// workspace. - /// - /// - /// - /// > [!TIP] - /// > To create embed tokens, it's recommended to use the latest API, - /// [Generate Token](/rest/api/power-bi/embed-token/generate-token). Generate - /// token supports additional functions, such as creating a token for multiple - /// items. - /// - /// > [!NOTE] - /// > An embed token can be used to [embed - /// Q&A](/power-bi/developer/qanda) within your application. - /// - /// > [!IMPORTANT] - /// > This API call is only relevant to the [embed for your - /// customers](/power-bi/developer/embed-sample-for-customers) scenario. To - /// learn more about using this API, see [Considerations when generating an - /// embed token](/power-bi/developer/embedded/generate-embed-token). - /// - /// ## Permissions - /// - /// - When using a service principal for authentication, refer to [Embed Power - /// BI content with service - /// principal](/power-bi/developer/embed-service-principal) and [Considerations - /// and - /// limitations](/power-bi/developer/embedded/embed-service-principal#considerations-and-limitations). - /// - This API call can be called by a service principal profile. For more - /// information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Generate token parameters - /// - /// - /// The cancellation token. - /// - public static async Task GenerateTokenInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, GenerateTokenRequest requestParameters, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GenerateTokenInGroupWithHttpMessagesAsync(groupId, datasetId, requestParameters, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns a list of datasets for the organization. - /// - /// - /// - /// Each request takes two seconds to process, during which time other requests - /// are queued. - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// Filters the results, based on a boolean condition - /// - /// - /// Returns only the first n results - /// - /// - /// Skips the first n results - /// - public static AdminDatasets GetDatasetsAsAdmin(this IDatasetsOperations operations, string filter = default(string), int? top = default(int?), int? skip = default(int?)) - { - return operations.GetDatasetsAsAdminAsync(filter, top, skip).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of datasets for the organization. - /// - /// - /// - /// Each request takes two seconds to process, during which time other requests - /// are queued. - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// Filters the results, based on a boolean condition - /// - /// - /// Returns only the first n results - /// - /// - /// Skips the first n results - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasetsAsAdminAsync(this IDatasetsOperations operations, string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasetsAsAdminWithHttpMessagesAsync(filter, top, skip, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns a list of data sources for the specified dataset. - /// - /// - /// - /// Each request takes 0.5 seconds to process, during which time other requests - /// are queued. - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// - public static Datasources GetDatasourcesAsAdmin(this IDatasetsOperations operations, string datasetId) - { - return operations.GetDatasourcesAsAdminAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of data sources for the specified dataset. - /// - /// - /// - /// Each request takes 0.5 seconds to process, during which time other requests - /// are queued. - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasourcesAsAdminAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasourcesAsAdminWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns a list of users that have access to the specified dataset. - /// - /// - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// - /// ## Limitations - /// - /// Maximum 200 requests per hour. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - public static DatasetUsers GetDatasetUsersAsAdmin(this IDatasetsOperations operations, System.Guid datasetId) - { - return operations.GetDatasetUsersAsAdminAsync(datasetId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of users that have access to the specified dataset. - /// - /// - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// - /// ## Limitations - /// - /// Maximum 200 requests per hour. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The dataset ID - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasetUsersAsAdminAsync(this IDatasetsOperations operations, System.Guid datasetId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasetUsersAsAdminWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns a list of datasets from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// - /// ## Limitations - /// - /// Maximum 200 requests per hour. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// Filters the results, based on a boolean condition - /// - /// - /// Returns only the first n results - /// - /// - /// Skips the first n results - /// - /// - /// Expands related entities inline - /// - public static AdminDatasets GetDatasetsInGroupAsAdmin(this IDatasetsOperations operations, System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string)) - { - return operations.GetDatasetsInGroupAsAdminAsync(groupId, filter, top, skip, expand).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of datasets from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// - /// ## Limitations - /// - /// Maximum 200 requests per hour. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// Filters the results, based on a boolean condition - /// - /// - /// Returns only the first n results - /// - /// - /// Skips the first n results - /// - /// - /// Expands related entities inline - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasetsInGroupAsAdminAsync(this IDatasetsOperations operations, System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasetsInGroupAsAdminWithHttpMessagesAsync(groupId, filter, top, skip, expand, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - /// - /// Returns a list of upstream dataflows for datasets from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// - /// ## Limitations - /// - /// Maximum 200 requests per hour. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - public static DatasetToDataflowLinksResponse GetDatasetToDataflowsLinksInGroupAsAdmin(this IDatasetsOperations operations, System.Guid groupId) - { - return operations.GetDatasetToDataflowsLinksInGroupAsAdminAsync(groupId).GetAwaiter().GetResult(); - } - - /// - /// Returns a list of upstream dataflows for datasets from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 Global - /// Administrator or Power BI Service Administrator) or authenticate using a - /// service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must not** - /// have any admin-consent required premissions for Power BI set on it in the - /// Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin access - /// token. Must not be present when authentication via a service principal is - /// used. - /// - /// ## Limitations - /// - /// Maximum 200 requests per hour. - /// <br><br> - /// - /// - /// The operations group for this extension method. - /// - /// - /// The workspace ID - /// - /// - /// The cancellation token. - /// - public static async Task GetDatasetToDataflowsLinksInGroupAsAdminAsync(this IDatasetsOperations operations, System.Guid groupId, CancellationToken cancellationToken = default(CancellationToken)) - { - using (var _result = await operations.GetDatasetToDataflowsLinksInGroupAsAdminWithHttpMessagesAsync(groupId, null, cancellationToken).ConfigureAwait(false)) - { - return _result.Body; - } - } - - } -} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.PowerBI.Api +{ + using Models; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for DatasetsOperations. + /// + public static partial class DatasetsOperationsExtensions + { + /// + /// Returns a list of datasets from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + public static Datasets GetDatasets(this IDatasetsOperations operations) + { + return operations.GetDatasetsAsync().GetAwaiter().GetResult(); + } + + /// + /// Returns a list of datasets from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasetsAsync(this IDatasetsOperations operations, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasetsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a new dataset on **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// Dataset definition to create + /// + /// + /// The default retention policy. Possible values include: 'None', 'basicFIFO' + /// + public static Dataset PostDataset(this IDatasetsOperations operations, CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?)) + { + return operations.PostDatasetAsync(dataset, defaultRetentionPolicy).GetAwaiter().GetResult(); + } + + /// + /// Creates a new dataset on **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// Dataset definition to create + /// + /// + /// The default retention policy. Possible values include: 'None', 'basicFIFO' + /// + /// + /// The cancellation token. + /// + public static async Task PostDatasetAsync(this IDatasetsOperations operations, CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostDatasetWithHttpMessagesAsync(dataset, defaultRetentionPolicy, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + public static Dataset GetDataset(this IDatasetsOperations operations, string datasetId) + { + return operations.GetDatasetAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns the specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasetAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasetWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the properties for the specified dataset from **My workspace**. + /// + /// + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// Update dataset request parameters + /// + public static void UpdateDataset(this IDatasetsOperations operations, string datasetId, UpdateDatasetRequest updateDatasetRequest) + { + operations.UpdateDatasetAsync(datasetId, updateDatasetRequest).GetAwaiter().GetResult(); + } + + /// + /// Updates the properties for the specified dataset from **My workspace**. + /// + /// + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// Update dataset request parameters + /// + /// + /// The cancellation token. + /// + public static async Task UpdateDatasetAsync(this IDatasetsOperations operations, string datasetId, UpdateDatasetRequest updateDatasetRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateDatasetWithHttpMessagesAsync(datasetId, updateDatasetRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes the specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + public static void DeleteDataset(this IDatasetsOperations operations, string datasetId) + { + operations.DeleteDatasetAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteDatasetAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteDatasetWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Executes Data Analysis Expressions (DAX) queries against the provided + /// dataset. The dataset must reside in **My workspace** or another workspace. + /// + /// + /// + /// DAX query errors will result in: + /// + /// - A response error, such as `DAX query failure`. + /// - A failure HTTP status code (400). + /// + /// A query that requests more than one table, or more than the allowed number + /// of table rows, will result in: + /// + /// - Limited data being returned. + /// - A response error, such as `More than one result table in a query` or + /// `More than {allowed number} rows in a query result`. + /// - A successful HTTP status code (200). + /// + /// Columns that are fully qualified in the query will be returned with a fully + /// qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed + /// or created in the query will be returned within square bracket, for + /// example, `[MyNewColumn]`. + /// + /// ## Permissions + /// + /// The user must have dataset read permissions. For more information, see + /// [Manage dataset access + /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// - Datasets that are hosted in Azure Analysis Services or that have a live + /// connection to an on-premises Azure Analysis Services model aren't + /// supported. + /// - The tenant setting **Dataset Execute Queries REST API**, found under + /// **Integration settings**, must be enabled. + /// - One query per API call. + /// - One table request per query. + /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit + /// first). For example if you query for 5 columns, you can get back max + /// 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows + /// (1 million divided by 20). + /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row + /// will be completed but no additional rows will be written. + /// - There's a limit of 120 query requests per minute per user, regardless of + /// the dataset that's queried. + /// - Service Principals aren't supported for datasets with RLS per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or with SSO enabled. To use Service Principals, make sure the admin tenant + /// setting [_Allow service principals to use Power BI + /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) + /// under _Developer settings_ is enabled. + /// - Only DAX queries are supported at this time. MDX and DMV queries are not + /// supported. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The request message + /// + public static DatasetExecuteQueriesResponse ExecuteQueries(this IDatasetsOperations operations, string datasetId, DatasetExecuteQueriesRequest requestMessage) + { + return operations.ExecuteQueriesAsync(datasetId, requestMessage).GetAwaiter().GetResult(); + } + + /// + /// Executes Data Analysis Expressions (DAX) queries against the provided + /// dataset. The dataset must reside in **My workspace** or another workspace. + /// + /// + /// + /// DAX query errors will result in: + /// + /// - A response error, such as `DAX query failure`. + /// - A failure HTTP status code (400). + /// + /// A query that requests more than one table, or more than the allowed number + /// of table rows, will result in: + /// + /// - Limited data being returned. + /// - A response error, such as `More than one result table in a query` or + /// `More than {allowed number} rows in a query result`. + /// - A successful HTTP status code (200). + /// + /// Columns that are fully qualified in the query will be returned with a fully + /// qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed + /// or created in the query will be returned within square bracket, for + /// example, `[MyNewColumn]`. + /// + /// ## Permissions + /// + /// The user must have dataset read permissions. For more information, see + /// [Manage dataset access + /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// - Datasets that are hosted in Azure Analysis Services or that have a live + /// connection to an on-premises Azure Analysis Services model aren't + /// supported. + /// - The tenant setting **Dataset Execute Queries REST API**, found under + /// **Integration settings**, must be enabled. + /// - One query per API call. + /// - One table request per query. + /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit + /// first). For example if you query for 5 columns, you can get back max + /// 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows + /// (1 million divided by 20). + /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row + /// will be completed but no additional rows will be written. + /// - There's a limit of 120 query requests per minute per user, regardless of + /// the dataset that's queried. + /// - Service Principals aren't supported for datasets with RLS per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or with SSO enabled. To use Service Principals, make sure the admin tenant + /// setting [_Allow service principals to use Power BI + /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) + /// under _Developer settings_ is enabled. + /// - Only DAX queries are supported at this time. MDX and DMV queries are not + /// supported. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The request message + /// + /// + /// The cancellation token. + /// + public static async Task ExecuteQueriesAsync(this IDatasetsOperations operations, string datasetId, DatasetExecuteQueriesRequest requestMessage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExecuteQueriesWithHttpMessagesAsync(datasetId, requestMessage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a list of tables within the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + public static Tables GetTables(this IDatasetsOperations operations, string datasetId) + { + return operations.GetTablesAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of tables within the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetTablesAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetTablesWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the metadata and schema for the specified table within the + /// specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// Table name and columns to update existing table + /// + public static Table PutTable(this IDatasetsOperations operations, string datasetId, string tableName, Table requestMessage) + { + return operations.PutTableAsync(datasetId, tableName, requestMessage).GetAwaiter().GetResult(); + } + + /// + /// Updates the metadata and schema for the specified table within the + /// specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// Table name and columns to update existing table + /// + /// + /// The cancellation token. + /// + public static async Task
PutTableAsync(this IDatasetsOperations operations, string datasetId, string tableName, Table requestMessage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutTableWithHttpMessagesAsync(datasetId, tableName, requestMessage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Adds new data rows to the specified table within the specified dataset from + /// **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - This API call only supports **push datasets**. + /// - See [Power BI REST API + /// limitations](/power-bi/developer/automation/api-rest-api-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The request message + /// + public static void PostRows(this IDatasetsOperations operations, string datasetId, string tableName, PostRowsRequest requestMessage) + { + operations.PostRowsAsync(datasetId, tableName, requestMessage).GetAwaiter().GetResult(); + } + + /// + /// Adds new data rows to the specified table within the specified dataset from + /// **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - This API call only supports **push datasets**. + /// - See [Power BI REST API + /// limitations](/power-bi/developer/automation/api-rest-api-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The request message + /// + /// + /// The cancellation token. + /// + public static async Task PostRowsAsync(this IDatasetsOperations operations, string datasetId, string tableName, PostRowsRequest requestMessage, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PostRowsWithHttpMessagesAsync(datasetId, tableName, requestMessage, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes all rows from the specified table within the specified dataset from + /// **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + public static void DeleteRows(this IDatasetsOperations operations, string datasetId, string tableName) + { + operations.DeleteRowsAsync(datasetId, tableName).GetAwaiter().GetResult(); + } + + /// + /// Deletes all rows from the specified table within the specified dataset from + /// **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteRowsAsync(this IDatasetsOperations operations, string datasetId, string tableName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteRowsWithHttpMessagesAsync(datasetId, tableName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns the refresh history for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// OneDrive refresh history isn't returned. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The requested number of entries in the refresh history. If not provided, + /// the default is the last available 60 entries. + /// + public static Refreshes GetRefreshHistory(this IDatasetsOperations operations, string datasetId, int? top = default(int?)) + { + return operations.GetRefreshHistoryAsync(datasetId, top).GetAwaiter().GetResult(); + } + + /// + /// Returns the refresh history for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// OneDrive refresh history isn't returned. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The requested number of entries in the refresh history. If not provided, + /// the default is the last available 60 entries. + /// + /// + /// The cancellation token. + /// + public static async Task GetRefreshHistoryAsync(this IDatasetsOperations operations, string datasetId, int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetRefreshHistoryWithHttpMessagesAsync(datasetId, top, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Triggers a refresh for the specified dataset from **My workspace**. An + /// [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) is + /// triggered only if a request payload other than `notifyOption` is set. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - For Shared capacities, a maximum of eight requests per day, including + /// refreshes executed by using scheduled refresh, can be initiated. + /// - For Shared capacities, only `notifyOption` can be specified in the + /// request body. + /// - Enhanced refresh is not supported for shared capacities. + /// - For enhanced refresh, `notifyOption` is not required and must be excluded + /// from the request body. However, one or more parameters other than + /// `notifyOption` are required. + /// - For Premium capacities, the maximum requests per day is only limited by + /// the available resources in the capacity. If available resources are + /// overloaded, refreshes are throttled until the load is reduced. The refresh + /// will fail if throttling exceeds 1 hour. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// + public static DatasetsRefreshDatasetHeaders RefreshDataset(this IDatasetsOperations operations, string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest)) + { + return operations.RefreshDatasetAsync(datasetId, datasetRefreshRequest).GetAwaiter().GetResult(); + } + + /// + /// Triggers a refresh for the specified dataset from **My workspace**. An + /// [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) is + /// triggered only if a request payload other than `notifyOption` is set. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - For Shared capacities, a maximum of eight requests per day, including + /// refreshes executed by using scheduled refresh, can be initiated. + /// - For Shared capacities, only `notifyOption` can be specified in the + /// request body. + /// - Enhanced refresh is not supported for shared capacities. + /// - For enhanced refresh, `notifyOption` is not required and must be excluded + /// from the request body. However, one or more parameters other than + /// `notifyOption` are required. + /// - For Premium capacities, the maximum requests per day is only limited by + /// the available resources in the capacity. If available resources are + /// overloaded, refreshes are throttled until the load is reduced. The refresh + /// will fail if throttling exceeds 1 hour. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task RefreshDatasetAsync(this IDatasetsOperations operations, string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RefreshDatasetWithHttpMessagesAsync(datasetId, datasetRefreshRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Returns execution details of an [enhanced refresh + /// operation](/power-bi/connect-data/asynchronous-refresh) for the specified + /// dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + public static DatasetRefreshDetail GetRefreshExecutionDetails(this IDatasetsOperations operations, System.Guid datasetId, System.Guid refreshId) + { + return operations.GetRefreshExecutionDetailsAsync(datasetId, refreshId).GetAwaiter().GetResult(); + } + + /// + /// Returns execution details of an [enhanced refresh + /// operation](/power-bi/connect-data/asynchronous-refresh) for the specified + /// dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + /// + /// The cancellation token. + /// + public static async Task GetRefreshExecutionDetailsAsync(this IDatasetsOperations operations, System.Guid datasetId, System.Guid refreshId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetRefreshExecutionDetailsWithHttpMessagesAsync(datasetId, refreshId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Cancels the specified refresh operation for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + public static void CancelRefresh(this IDatasetsOperations operations, System.Guid datasetId, System.Guid refreshId) + { + operations.CancelRefreshAsync(datasetId, refreshId).GetAwaiter().GetResult(); + } + + /// + /// Cancels the specified refresh operation for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + /// + /// The cancellation token. + /// + public static async Task CancelRefreshAsync(this IDatasetsOperations operations, System.Guid datasetId, System.Guid refreshId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CancelRefreshWithHttpMessagesAsync(datasetId, refreshId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns the refresh schedule for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + public static RefreshSchedule GetRefreshSchedule(this IDatasetsOperations operations, string datasetId) + { + return operations.GetRefreshScheduleAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns the refresh schedule for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetRefreshScheduleAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetRefreshScheduleWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the refresh schedule for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// A request that disables the refresh schedule should contain no other + /// changes. + /// + /// At least one day must be specified. If no times are specified, then Power + /// BI will use a default single time per day. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// The limit on the number of time slots per day depends on whether a + /// [Premium](/power-bi/admin/service-premium-what-is) or Shared capacity is + /// used. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// Update Refresh Schedule parameters, by specifying all or some of the + /// parameters + /// + public static void UpdateRefreshSchedule(this IDatasetsOperations operations, string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest) + { + operations.UpdateRefreshScheduleAsync(datasetId, datasetModelRefreshScheduleRequest).GetAwaiter().GetResult(); + } + + /// + /// Updates the refresh schedule for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// A request that disables the refresh schedule should contain no other + /// changes. + /// + /// At least one day must be specified. If no times are specified, then Power + /// BI will use a default single time per day. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// The limit on the number of time slots per day depends on whether a + /// [Premium](/power-bi/admin/service-premium-what-is) or Shared capacity is + /// used. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// Update Refresh Schedule parameters, by specifying all or some of the + /// parameters + /// + /// + /// The cancellation token. + /// + public static async Task UpdateRefreshScheduleAsync(this IDatasetsOperations operations, string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateRefreshScheduleWithHttpMessagesAsync(datasetId, datasetModelRefreshScheduleRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + public static DirectQueryRefreshSchedule GetDirectQueryRefreshSchedule(this IDatasetsOperations operations, string datasetId) + { + return operations.GetDirectQueryRefreshScheduleAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetDirectQueryRefreshScheduleAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDirectQueryRefreshScheduleWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from **My workspace**. + /// + /// + /// + /// A request should contain either a set of days and times *or* a valid + /// frequency, but not both. If you choose a set of days without specifying any + /// times, then Power BI will use a default single time per day. Setting the + /// frequency will automatically overwrite the days and times setting. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by + /// specifying all or some of the parameters + /// + public static void UpdateDirectQueryRefreshSchedule(this IDatasetsOperations operations, string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest) + { + operations.UpdateDirectQueryRefreshScheduleAsync(datasetId, datasetDQRefreshScheduleRequest).GetAwaiter().GetResult(); + } + + /// + /// Updates the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from **My workspace**. + /// + /// + /// + /// A request should contain either a set of days and times *or* a valid + /// frequency, but not both. If you choose a set of days without specifying any + /// times, then Power BI will use a default single time per day. Setting the + /// frequency will automatically overwrite the days and times setting. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by + /// specifying all or some of the parameters + /// + /// + /// The cancellation token. + /// + public static async Task UpdateDirectQueryRefreshScheduleAsync(this IDatasetsOperations operations, string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateDirectQueryRefreshScheduleWithHttpMessagesAsync(datasetId, datasetDQRefreshScheduleRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns a list of parameters for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections + /// aren't supported. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + public static MashupParameters GetParameters(this IDatasetsOperations operations, string datasetId) + { + return operations.GetParametersAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of parameters for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections + /// aren't supported. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetParametersAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetParametersWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the parameters values for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with + /// this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - If you're using **enhanced dataset metadata**, refresh the dataset + /// to apply the new parameter values. + /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes + /// for the update data sources operation to complete, and then refresh the + /// dataset. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. + /// To make changes to those data sources, the admin must use the Azure + /// Analysis Services client library for Tabular Object Model. + /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) + /// connections are only supported with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - Datasets with Azure Analysis Services live connections aren't supported. + /// - Maximum of 100 parameters per request. + /// - All specified parameters must exist in the dataset. + /// - Parameters values should be of the expected type. + /// - The parameter list can't be empty or include duplicate parameters. + /// - Parameters names are case-sensitive. + /// - Parameter `IsRequired` must have a non-empty value. + /// - The parameter types `Any` and `Binary` can't be updated. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// + public static void UpdateParameters(this IDatasetsOperations operations, string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest) + { + operations.UpdateParametersAsync(datasetId, updateMashupParametersRequest).GetAwaiter().GetResult(); + } + + /// + /// Updates the parameters values for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with + /// this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - If you're using **enhanced dataset metadata**, refresh the dataset + /// to apply the new parameter values. + /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes + /// for the update data sources operation to complete, and then refresh the + /// dataset. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. + /// To make changes to those data sources, the admin must use the Azure + /// Analysis Services client library for Tabular Object Model. + /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) + /// connections are only supported with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - Datasets with Azure Analysis Services live connections aren't supported. + /// - Maximum of 100 parameters per request. + /// - All specified parameters must exist in the dataset. + /// - Parameters values should be of the expected type. + /// - The parameter list can't be empty or include duplicate parameters. + /// - Parameters names are case-sensitive. + /// - Parameter `IsRequired` must have a non-empty value. + /// - The parameter types `Any` and `Binary` can't be updated. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdateParametersAsync(this IDatasetsOperations operations, string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateParametersWithHttpMessagesAsync(datasetId, updateMashupParametersRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns a list of data sources for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + public static Datasources GetDatasources(this IDatasetsOperations operations, string datasetId) + { + return operations.GetDatasourcesAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of data sources for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasourcesAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasourcesWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the data sources of the specified dataset from **My workspace**. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with + /// this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - The original data source and the new data source must have the exact + /// same schema. + /// > - If you're using **enhanced dataset metadata**, refresh the dataset + /// to get data from the new data sources. + /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes + /// for the update data sources operation to complete, and then refresh the + /// dataset. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. + /// To make changes to those data sources, the admin must use the Azure + /// Analysis Services client library for Tabular Object Model. + /// - Only these data sources are supported: SQL Server, Azure SQL Server, + /// Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and + /// SAP HANA. For other data sources, use the [Update + /// Parameters](/rest/api/power-bi/datasets/update-parameters) API call. + /// - Changing the data source type isn't supported. + /// - Data sources that contain parameters in the connection string aren't + /// supported. + /// - Updating data sources that are part of merged or joined tables is only + /// supported if you're using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - For an Advanced Query that references multiple data sources, only the + /// first data source will be updated. To overcome this limitation, define the + /// data source as a parameter and use the [Update + /// Parameters](/rest/api/power-bi/datasets/update-parameters) API call. + /// - Datasets with incremental refresh policy are not fully supported, calling + /// this API may not work as expected and result of partial datasources update, + /// to overcome this you can try run a dataset refresh before calling this API. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// + public static void UpdateDatasources(this IDatasetsOperations operations, string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest) + { + operations.UpdateDatasourcesAsync(datasetId, updateDatasourcesRequest).GetAwaiter().GetResult(); + } + + /// + /// Updates the data sources of the specified dataset from **My workspace**. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with + /// this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - The original data source and the new data source must have the exact + /// same schema. + /// > - If you're using **enhanced dataset metadata**, refresh the dataset + /// to get data from the new data sources. + /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes + /// for the update data sources operation to complete, and then refresh the + /// dataset. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. + /// To make changes to those data sources, the admin must use the Azure + /// Analysis Services client library for Tabular Object Model. + /// - Only these data sources are supported: SQL Server, Azure SQL Server, + /// Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and + /// SAP HANA. For other data sources, use the [Update + /// Parameters](/rest/api/power-bi/datasets/update-parameters) API call. + /// - Changing the data source type isn't supported. + /// - Data sources that contain parameters in the connection string aren't + /// supported. + /// - Updating data sources that are part of merged or joined tables is only + /// supported if you're using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - For an Advanced Query that references multiple data sources, only the + /// first data source will be updated. To overcome this limitation, define the + /// data source as a parameter and use the [Update + /// Parameters](/rest/api/power-bi/datasets/update-parameters) API call. + /// - Datasets with incremental refresh policy are not fully supported, calling + /// this API may not work as expected and result of partial datasources update, + /// to overcome this you can try run a dataset refresh before calling this API. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdateDatasourcesAsync(this IDatasetsOperations operations, string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateDatasourcesWithHttpMessagesAsync(datasetId, updateDatasourcesRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates all connections for the specified dataset from **My workspace**. + /// This API call only supports SQL DirectQuery datasets. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated and no longer supported. This API call + /// isn't compatible with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// > + /// > Instead use: + /// > + /// > - [Update Parameters](/rest/api/power-bi/datasets/update-parameters) + /// to update connections for SQL, Azure Synapse, OData, and SharePoint data + /// sources. + /// > - [Update Datasources](/rest/api/power-bi/datasets/update-datasources) + /// to connections for other data sources. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The body + /// + [System.Obsolete()] + public static void SetAllDatasetConnections(this IDatasetsOperations operations, string datasetId, ConnectionDetails parameters) + { + operations.SetAllDatasetConnectionsAsync(datasetId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates all connections for the specified dataset from **My workspace**. + /// This API call only supports SQL DirectQuery datasets. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated and no longer supported. This API call + /// isn't compatible with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// > + /// > Instead use: + /// > + /// > - [Update Parameters](/rest/api/power-bi/datasets/update-parameters) + /// to update connections for SQL, Azure Synapse, OData, and SharePoint data + /// sources. + /// > - [Update Datasources](/rest/api/power-bi/datasets/update-datasources) + /// to connections for other data sources. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The body + /// + /// + /// The cancellation token. + /// + [System.Obsolete()] + public static async Task SetAllDatasetConnectionsAsync(this IDatasetsOperations operations, string datasetId, ConnectionDetails parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.SetAllDatasetConnectionsWithHttpMessagesAsync(datasetId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Binds the specified dataset from **My workspace** to the specified gateway, + /// optionally with a given set of data source IDs. If you don't supply a + /// specific data source ID, the dataset will be bound to the first matching + /// data source in the gateway. + /// + /// + /// + /// > [!IMPORTANT] + /// > Add the API caller principal as a data source user on the gateway. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The bind to gateway request + /// + public static void BindToGateway(this IDatasetsOperations operations, string datasetId, BindToGatewayRequest bindToGatewayRequest) + { + operations.BindToGatewayAsync(datasetId, bindToGatewayRequest).GetAwaiter().GetResult(); + } + + /// + /// Binds the specified dataset from **My workspace** to the specified gateway, + /// optionally with a given set of data source IDs. If you don't supply a + /// specific data source ID, the dataset will be bound to the first matching + /// data source in the gateway. + /// + /// + /// + /// > [!IMPORTANT] + /// > Add the API caller principal as a data source user on the gateway. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The bind to gateway request + /// + /// + /// The cancellation token. + /// + public static async Task BindToGatewayAsync(this IDatasetsOperations operations, string datasetId, BindToGatewayRequest bindToGatewayRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BindToGatewayWithHttpMessagesAsync(datasetId, bindToGatewayRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns a list of gateway data sources for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated, use [Get + /// Datasources](/rest/api/power-bi/datasets/get-datasources) instead. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + public static GatewayDatasources GetGatewayDatasources(this IDatasetsOperations operations, string datasetId) + { + return operations.GetGatewayDatasourcesAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of gateway data sources for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated, use [Get + /// Datasources](/rest/api/power-bi/datasets/get-datasources) instead. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetGatewayDatasourcesAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetGatewayDatasourcesWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a list of gateways that the specified dataset from **My workspace** + /// can be bound to. + /// + /// + /// + /// This API call is only relevant to datasets that have at least one + /// on-premises connection. For datasets with cloud-only connections, this API + /// call returns an empty list. + /// + /// ## Required Scope + /// + /// Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + public static Gateways DiscoverGateways(this IDatasetsOperations operations, string datasetId) + { + return operations.DiscoverGatewaysAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of gateways that the specified dataset from **My workspace** + /// can be bound to. + /// + /// + /// + /// This API call is only relevant to datasets that have at least one + /// on-premises connection. For datasets with cloud-only connections, this API + /// call returns an empty list. + /// + /// ## Required Scope + /// + /// Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task DiscoverGatewaysAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DiscoverGatewaysWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the query scale-out sync status for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + public static DatasetQueryScaleOutSyncStatus GetQueryScaleOutSyncStatus(this IDatasetsOperations operations, string datasetId) + { + return operations.GetQueryScaleOutSyncStatusAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns the query scale-out sync status for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetQueryScaleOutSyncStatusAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetQueryScaleOutSyncStatusWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Triggers a query scale-out sync of read-only replicas for the specified + /// dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + public static DatasetQueryScaleOutSyncStatus TriggerQueryScaleOutSync(this IDatasetsOperations operations, string datasetId) + { + return operations.TriggerQueryScaleOutSyncAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Triggers a query scale-out sync of read-only replicas for the specified + /// dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task TriggerQueryScaleOutSyncAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.TriggerQueryScaleOutSyncWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Grants the specified user's permissions to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Limitations + /// + /// - Adding permissions to service principals (app principalType) isn't + /// supported + /// - Caller must have ReadReshare permissions on the dataset. + /// - This API call can't be used to grant dataset Write permission on the + /// dataset + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + public static void PostDatasetUserInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, PostDatasetUserAccess userDetails) + { + operations.PostDatasetUserInGroupAsync(groupId, datasetId, userDetails).GetAwaiter().GetResult(); + } + + /// + /// Grants the specified user's permissions to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Limitations + /// + /// - Adding permissions to service principals (app principalType) isn't + /// supported + /// - Caller must have ReadReshare permissions on the dataset. + /// - This API call can't be used to grant dataset Write permission on the + /// dataset + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + /// + /// The cancellation token. + /// + public static async Task PostDatasetUserInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, PostDatasetUserAccess userDetails, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PostDatasetUserInGroupWithHttpMessagesAsync(groupId, datasetId, userDetails, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates the existing dataset permissions of the specified user to the + /// specified permissions. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// This API call can be used to remove all the dataset permissions of the + /// specified user by using `datasetUserAccessRight: None` + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// ## Limitations + /// + /// - Updating permissions to service principals (app principalType) isn't + /// supported + /// - Caller must have ReadWriteReshare permissions on the dataset. That is, + /// folder admins, members and contributors with Reshare permissions, or + /// dataset owners. + /// - This API can't be used to add or remove *write* permission. + /// - This API can't be used to remove folder-level inherited permissions. For + /// folder admins and members, the ReadWriteReshareExplore permission on the + /// folder's datasets is inherited. For folder contributors, the + /// ReadWriteExplore permission on the folder's datasets is inherited. For + /// folder viewers, the Read permission on the folder's datasets is inherited. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + public static void PutDatasetUserInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DatasetUserAccess userDetails) + { + operations.PutDatasetUserInGroupAsync(groupId, datasetId, userDetails).GetAwaiter().GetResult(); + } + + /// + /// Updates the existing dataset permissions of the specified user to the + /// specified permissions. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// This API call can be used to remove all the dataset permissions of the + /// specified user by using `datasetUserAccessRight: None` + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// ## Limitations + /// + /// - Updating permissions to service principals (app principalType) isn't + /// supported + /// - Caller must have ReadWriteReshare permissions on the dataset. That is, + /// folder admins, members and contributors with Reshare permissions, or + /// dataset owners. + /// - This API can't be used to add or remove *write* permission. + /// - This API can't be used to remove folder-level inherited permissions. For + /// folder admins and members, the ReadWriteReshareExplore permission on the + /// folder's datasets is inherited. For folder contributors, the + /// ReadWriteExplore permission on the folder's datasets is inherited. For + /// folder viewers, the Read permission on the folder's datasets is inherited. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + /// + /// The cancellation token. + /// + public static async Task PutDatasetUserInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DatasetUserAccess userDetails, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PutDatasetUserInGroupWithHttpMessagesAsync(groupId, datasetId, userDetails, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns a list of principals that have access to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// ## Limitations + /// + /// Caller must have ReadWriteReshare permissions on the dataset. That is, + /// folder admins, members and contributors with Reshare permissions, or + /// dataset owners. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + public static DatasetUsersAccess GetDatasetUsersInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) + { + return operations.GetDatasetUsersInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of principals that have access to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// ## Limitations + /// + /// Caller must have ReadWriteReshare permissions on the dataset. That is, + /// folder admins, members and contributors with Reshare permissions, or + /// dataset owners. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasetUsersInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasetUsersInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Grants the specified user's permissions to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Limitations + /// + /// - Adding permissions to service principals (app principalType) isn't + /// supported + /// - Caller must have ReadReshare permissions on the dataset. + /// - This API call can't be used to grant dataset Write permission on the + /// dataset + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + public static void PostDatasetUser(this IDatasetsOperations operations, string datasetId, PostDatasetUserAccess userDetails) + { + operations.PostDatasetUserAsync(datasetId, userDetails).GetAwaiter().GetResult(); + } + + /// + /// Grants the specified user's permissions to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Limitations + /// + /// - Adding permissions to service principals (app principalType) isn't + /// supported + /// - Caller must have ReadReshare permissions on the dataset. + /// - This API call can't be used to grant dataset Write permission on the + /// dataset + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + /// + /// The cancellation token. + /// + public static async Task PostDatasetUserAsync(this IDatasetsOperations operations, string datasetId, PostDatasetUserAccess userDetails, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PostDatasetUserWithHttpMessagesAsync(datasetId, userDetails, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates the existing dataset permissions of the specified user to the + /// specified permissions. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// This API call can be used to remove all the dataset permissions of the + /// specified user by using `datasetUserAccessRight: None` + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// ## Limitations + /// + /// - Updating permissions to service principals (app principalType) isn't + /// supported + /// - Caller must have ReadWriteReshare permissions on the dataset. That is, + /// folder admins, members and contributors with Reshare permissions, or + /// dataset owners. + /// - This API can't be used to add or remove *write* permission. + /// - This API can't be used to remove folder-level inherited permissions. For + /// folder admins and members, the ReadWriteReshareExplore permission on the + /// folder's datasets is inherited. For folder contributors, the + /// ReadWriteExplore permission on the folder's datasets is inherited. For + /// folder viewers, the Read permission on the folder's datasets is inherited. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + public static void PutDatasetUser(this IDatasetsOperations operations, string datasetId, DatasetUserAccess userDetails) + { + operations.PutDatasetUserAsync(datasetId, userDetails).GetAwaiter().GetResult(); + } + + /// + /// Updates the existing dataset permissions of the specified user to the + /// specified permissions. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// This API call can be used to remove all the dataset permissions of the + /// specified user by using `datasetUserAccessRight: None` + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// ## Limitations + /// + /// - Updating permissions to service principals (app principalType) isn't + /// supported + /// - Caller must have ReadWriteReshare permissions on the dataset. That is, + /// folder admins, members and contributors with Reshare permissions, or + /// dataset owners. + /// - This API can't be used to add or remove *write* permission. + /// - This API can't be used to remove folder-level inherited permissions. For + /// folder admins and members, the ReadWriteReshareExplore permission on the + /// folder's datasets is inherited. For folder contributors, the + /// ReadWriteExplore permission on the folder's datasets is inherited. For + /// folder viewers, the Read permission on the folder's datasets is inherited. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + /// + /// The cancellation token. + /// + public static async Task PutDatasetUserAsync(this IDatasetsOperations operations, string datasetId, DatasetUserAccess userDetails, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PutDatasetUserWithHttpMessagesAsync(datasetId, userDetails, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns a list of principals that have access to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// ## Limitations + /// + /// Caller must have ReadWriteReshare permissions on the dataset. That is, + /// folder admins, members and contributors with Reshare permissions, or + /// dataset owners. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + public static DatasetUsersAccess GetDatasetUsers(this IDatasetsOperations operations, string datasetId) + { + return operations.GetDatasetUsersAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of principals that have access to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the new + /// permissions might not be immediately available through API calls. To + /// refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API call. + /// + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// ## Limitations + /// + /// Caller must have ReadWriteReshare permissions on the dataset. That is, + /// folder admins, members and contributors with Reshare permissions, or + /// dataset owners. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasetUsersAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasetUsersWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a list of datasets from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + public static Datasets GetDatasetsInGroup(this IDatasetsOperations operations, System.Guid groupId) + { + return operations.GetDatasetsInGroupAsync(groupId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of datasets from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasetsInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasetsInGroupWithHttpMessagesAsync(groupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Creates a new dataset in the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// Create dataset parameters + /// + /// + /// The default retention policy. Possible values include: 'None', 'basicFIFO' + /// + public static Dataset PostDatasetInGroup(this IDatasetsOperations operations, System.Guid groupId, CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?)) + { + return operations.PostDatasetInGroupAsync(groupId, dataset, defaultRetentionPolicy).GetAwaiter().GetResult(); + } + + /// + /// Creates a new dataset in the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// Create dataset parameters + /// + /// + /// The default retention policy. Possible values include: 'None', 'basicFIFO' + /// + /// + /// The cancellation token. + /// + public static async Task PostDatasetInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PostDatasetInGroupWithHttpMessagesAsync(groupId, dataset, defaultRetentionPolicy, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a list of upstream dataflows for datasets from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + public static DatasetToDataflowLinksResponse GetDatasetToDataflowsLinksInGroup(this IDatasetsOperations operations, System.Guid groupId) + { + return operations.GetDatasetToDataflowsLinksInGroupAsync(groupId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of upstream dataflows for datasets from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasetToDataflowsLinksInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasetToDataflowsLinksInGroupWithHttpMessagesAsync(groupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the specified dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + public static Dataset GetDatasetInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) + { + return operations.GetDatasetInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns the specified dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasetInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasetInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the properties for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Update dataset request parameters + /// + public static void UpdateDatasetInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, UpdateDatasetRequest updateDatasetRequest) + { + operations.UpdateDatasetInGroupAsync(groupId, datasetId, updateDatasetRequest).GetAwaiter().GetResult(); + } + + /// + /// Updates the properties for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Update dataset request parameters + /// + /// + /// The cancellation token. + /// + public static async Task UpdateDatasetInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, UpdateDatasetRequest updateDatasetRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateDatasetInGroupWithHttpMessagesAsync(groupId, datasetId, updateDatasetRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes the specified dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + public static void DeleteDatasetInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) + { + operations.DeleteDatasetInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); + } + + /// + /// Deletes the specified dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task DeleteDatasetInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteDatasetInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns a list of tables within the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Required Scope + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + public static Tables GetTablesInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) + { + return operations.GetTablesInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of tables within the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Required Scope + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetTablesInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetTablesInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the metadata and schema for the specified table within the + /// specified dataset from the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The request message + /// + public static Table PutTableInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, string tableName, Table requestMessage) + { + return operations.PutTableInGroupAsync(groupId, datasetId, tableName, requestMessage).GetAwaiter().GetResult(); + } + + /// + /// Updates the metadata and schema for the specified table within the + /// specified dataset from the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The request message + /// + /// + /// The cancellation token. + /// + public static async Task
PutTableInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, string tableName, Table requestMessage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.PutTableInGroupWithHttpMessagesAsync(groupId, datasetId, tableName, requestMessage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Adds new data rows to the specified table within the specified dataset from + /// the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - This API call only supports **push datasets**. + /// - See [Power BI REST API + /// limitations](/power-bi/developer/automation/api-rest-api-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The request message + /// + public static void PostRowsInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, string tableName, PostRowsRequest requestMessage) + { + operations.PostRowsInGroupAsync(groupId, datasetId, tableName, requestMessage).GetAwaiter().GetResult(); + } + + /// + /// Adds new data rows to the specified table within the specified dataset from + /// the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - This API call only supports **push datasets**. + /// - See [Power BI REST API + /// limitations](/power-bi/developer/automation/api-rest-api-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The request message + /// + /// + /// The cancellation token. + /// + public static async Task PostRowsInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, string tableName, PostRowsRequest requestMessage, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.PostRowsInGroupWithHttpMessagesAsync(groupId, datasetId, tableName, requestMessage, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Deletes all rows from the specified table within the specified dataset from + /// the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + public static void DeleteRowsInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, string tableName) + { + operations.DeleteRowsInGroupAsync(groupId, datasetId, tableName).GetAwaiter().GetResult(); + } + + /// + /// Deletes all rows from the specified table within the specified dataset from + /// the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list of + /// limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The cancellation token. + /// + public static async Task DeleteRowsInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, string tableName, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.DeleteRowsInGroupWithHttpMessagesAsync(groupId, datasetId, tableName, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns the refresh history for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// OneDrive refresh history isn't returned. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The requested number of entries in the refresh history. If not provided, + /// the default is the last available 60 entries. + /// + public static Refreshes GetRefreshHistoryInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, int? top = default(int?)) + { + return operations.GetRefreshHistoryInGroupAsync(groupId, datasetId, top).GetAwaiter().GetResult(); + } + + /// + /// Returns the refresh history for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// OneDrive refresh history isn't returned. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The requested number of entries in the refresh history. If not provided, + /// the default is the last available 60 entries. + /// + /// + /// The cancellation token. + /// + public static async Task GetRefreshHistoryInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, int? top = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetRefreshHistoryInGroupWithHttpMessagesAsync(groupId, datasetId, top, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Triggers a refresh for the specified dataset from the specified workspace. + /// An [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) is + /// triggered only if a request payload other than `notifyOption` is set. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - For Shared capacities, a maximum of eight requests per day, including + /// refreshes executed by using scheduled refresh, can be initiated. + /// - For Shared capacities, only `notifyOption` can be specified in the + /// request body. + /// - Enhanced refresh is not supported for shared capacities. + /// - For enhanced refresh, `notifyOption` is not required and must be excluded + /// from the request body. However, one or more parameters other than + /// `notifyOption` are required. + /// - For Premium capacities, the maximum requests per day is only limited by + /// the available resources in the capacity. If available resources are + /// overloaded, refreshes are throttled until the load is reduced. The refresh + /// will fail if throttling exceeds 1 hour. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// + public static DatasetsRefreshDatasetInGroupHeaders RefreshDatasetInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest)) + { + return operations.RefreshDatasetInGroupAsync(groupId, datasetId, datasetRefreshRequest).GetAwaiter().GetResult(); + } + + /// + /// Triggers a refresh for the specified dataset from the specified workspace. + /// An [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) is + /// triggered only if a request payload other than `notifyOption` is set. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - For Shared capacities, a maximum of eight requests per day, including + /// refreshes executed by using scheduled refresh, can be initiated. + /// - For Shared capacities, only `notifyOption` can be specified in the + /// request body. + /// - Enhanced refresh is not supported for shared capacities. + /// - For enhanced refresh, `notifyOption` is not required and must be excluded + /// from the request body. However, one or more parameters other than + /// `notifyOption` are required. + /// - For Premium capacities, the maximum requests per day is only limited by + /// the available resources in the capacity. If available resources are + /// overloaded, refreshes are throttled until the load is reduced. The refresh + /// will fail if throttling exceeds 1 hour. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task RefreshDatasetInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.RefreshDatasetInGroupWithHttpMessagesAsync(groupId, datasetId, datasetRefreshRequest, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Headers; + } + } + + /// + /// Returns execution details of an [enhanced refresh + /// operation](/power-bi/connect-data/asynchronous-refresh) for the specified + /// dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + public static DatasetRefreshDetail GetRefreshExecutionDetailsInGroup(this IDatasetsOperations operations, System.Guid groupId, System.Guid datasetId, System.Guid refreshId) + { + return operations.GetRefreshExecutionDetailsInGroupAsync(groupId, datasetId, refreshId).GetAwaiter().GetResult(); + } + + /// + /// Returns execution details of an [enhanced refresh + /// operation](/power-bi/connect-data/asynchronous-refresh) for the specified + /// dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + /// + /// The cancellation token. + /// + public static async Task GetRefreshExecutionDetailsInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, System.Guid datasetId, System.Guid refreshId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetRefreshExecutionDetailsInGroupWithHttpMessagesAsync(groupId, datasetId, refreshId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Cancels the specified refresh operation for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + public static void CancelRefreshInGroup(this IDatasetsOperations operations, System.Guid groupId, System.Guid datasetId, System.Guid refreshId) + { + operations.CancelRefreshInGroupAsync(groupId, datasetId, refreshId).GetAwaiter().GetResult(); + } + + /// + /// Cancels the specified refresh operation for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + /// + /// The cancellation token. + /// + public static async Task CancelRefreshInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, System.Guid datasetId, System.Guid refreshId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.CancelRefreshInGroupWithHttpMessagesAsync(groupId, datasetId, refreshId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns the refresh schedule for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + public static RefreshSchedule GetRefreshScheduleInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) + { + return operations.GetRefreshScheduleInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns the refresh schedule for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetRefreshScheduleInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetRefreshScheduleInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the refresh schedule for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// A request that disables the refresh schedule should contain no other + /// changes. + /// + /// At least one day must be specified. If no times are specified, then Power + /// BI will use a default single time per day. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// The limit on the number of time slots per day depends on whether a + /// [Premium](/power-bi/admin/service-premium-what-is) or Shared capacity is + /// used. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Update Refresh Schedule parameters, by specifying all or some of the + /// parameters + /// + public static void UpdateRefreshScheduleInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest) + { + operations.UpdateRefreshScheduleInGroupAsync(groupId, datasetId, datasetModelRefreshScheduleRequest).GetAwaiter().GetResult(); + } + + /// + /// Updates the refresh schedule for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// A request that disables the refresh schedule should contain no other + /// changes. + /// + /// At least one day must be specified. If no times are specified, then Power + /// BI will use a default single time per day. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// The limit on the number of time slots per day depends on whether a + /// [Premium](/power-bi/admin/service-premium-what-is) or Shared capacity is + /// used. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Update Refresh Schedule parameters, by specifying all or some of the + /// parameters + /// + /// + /// The cancellation token. + /// + public static async Task UpdateRefreshScheduleInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateRefreshScheduleInGroupWithHttpMessagesAsync(groupId, datasetId, datasetModelRefreshScheduleRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + public static DirectQueryRefreshSchedule GetDirectQueryRefreshScheduleInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) + { + return operations.GetDirectQueryRefreshScheduleInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetDirectQueryRefreshScheduleInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDirectQueryRefreshScheduleInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from the specified workspace. + /// + /// + /// + /// A request should contain either a set of days and times *or* a valid + /// frequency, but not both. If you choose a set of days without specifying any + /// times, then Power BI will use a default single time per day. Setting the + /// frequency will automatically overwrite the days and times setting. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by + /// specifying all or some of the parameters + /// + public static void UpdateDirectQueryRefreshScheduleInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest) + { + operations.UpdateDirectQueryRefreshScheduleInGroupAsync(groupId, datasetId, datasetDQRefreshScheduleRequest).GetAwaiter().GetResult(); + } + + /// + /// Updates the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from the specified workspace. + /// + /// + /// + /// A request should contain either a set of days and times *or* a valid + /// frequency, but not both. If you choose a set of days without specifying any + /// times, then Power BI will use a default single time per day. Setting the + /// frequency will automatically overwrite the days and times setting. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by + /// specifying all or some of the parameters + /// + /// + /// The cancellation token. + /// + public static async Task UpdateDirectQueryRefreshScheduleInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateDirectQueryRefreshScheduleInGroupWithHttpMessagesAsync(groupId, datasetId, datasetDQRefreshScheduleRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns a list of parameters for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections + /// aren't supported. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// + public static MashupParameters GetParametersInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) + { + return operations.GetParametersInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of parameters for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections + /// aren't supported. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetParametersInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetParametersInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the parameters values for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with + /// this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - If you're using **enhanced dataset metadata**, refresh the dataset + /// to apply the new parameter values. + /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes + /// for the update data sources operation to complete, and then refresh the + /// dataset. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. + /// To make changes to those data sources, the admin must use the Azure + /// Analysis Services client library for Tabular Object Model. + /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) + /// connections are only supported with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - Datasets with Azure Analysis Services live connections aren't supported. + /// - Maximum of 100 parameters per request. + /// - All specified parameters must exist in the dataset. + /// - Parameters values should be of the expected type. + /// - The parameter list can't be empty or include duplicate parameters. + /// - Parameters names are case-sensitive. + /// - Parameter `IsRequired` must have a non-empty value. + /// - The parameter types `Any` and `Binary` can't be updated. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// + public static void UpdateParametersInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest) + { + operations.UpdateParametersInGroupAsync(groupId, datasetId, updateMashupParametersRequest).GetAwaiter().GetResult(); + } + + /// + /// Updates the parameters values for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with + /// this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - If you're using **enhanced dataset metadata**, refresh the dataset + /// to apply the new parameter values. + /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes + /// for the update data sources operation to complete, and then refresh the + /// dataset. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. + /// To make changes to those data sources, the admin must use the Azure + /// Analysis Services client library for Tabular Object Model. + /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) + /// connections are only supported with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - Datasets with Azure Analysis Services live connections aren't supported. + /// - Maximum of 100 parameters per request. + /// - All specified parameters must exist in the dataset. + /// - Parameters values should be of the expected type. + /// - The parameter list can't be empty or include duplicate parameters. + /// - Parameters names are case-sensitive. + /// - Parameter `IsRequired` must have a non-empty value. + /// - The parameter types `Any` and `Binary` can't be updated. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdateParametersInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateParametersInGroupWithHttpMessagesAsync(groupId, datasetId, updateMashupParametersRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns a list of data sources for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// + public static Datasources GetDatasourcesInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) + { + return operations.GetDatasourcesInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of data sources for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasourcesInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasourcesInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Updates the data sources of the specified dataset from the specified + /// workspace. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with + /// this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - The original data source and the new data source must have the exact + /// same schema. + /// > - If you're using **enhanced dataset metadata**, refresh the dataset + /// to get data from the new data sources. + /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes + /// for the update data sources operation to complete, and then refresh the + /// dataset. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. + /// To make changes to those data sources, the admin must use the Azure + /// Analysis Services client library for Tabular Object Model. + /// - Only these data sources are supported: SQL Server, Azure SQL Server, + /// Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and + /// SAP HANA. For other data sources, use the [Update Parameters In + /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call. + /// - Changing the data source type isn't supported. + /// - Data sources that contain parameters in the connection string aren't + /// supported. + /// - Updating data sources that are part of merged or joined tables is only + /// supported if you're using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - For an Advanced Query that reference multiple data sources, only the + /// first data source will be updated. To overcome this limitation, define the + /// data source as a parameter and use the [Update Parameters In + /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call. + /// - Datasets with incremental refresh policy are not fully supported, calling + /// this API may not work as expected and result of partial datasources update, + /// to overcome this you can try run a dataset refresh before calling this API. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// + public static void UpdateDatasourcesInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest) + { + operations.UpdateDatasourcesInGroupAsync(groupId, datasetId, updateDatasourcesRequest).GetAwaiter().GetResult(); + } + + /// + /// Updates the data sources of the specified dataset from the specified + /// workspace. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with + /// this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - The original data source and the new data source must have the exact + /// same schema. + /// > - If you're using **enhanced dataset metadata**, refresh the dataset + /// to get data from the new data sources. + /// > - If you're not using **enhanced dataset metadata**, wait 30 minutes + /// for the update data sources operation to complete, and then refresh the + /// dataset. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. + /// To make changes to those data sources, the admin must use the Azure + /// Analysis Services client library for Tabular Object Model. + /// - Only these data sources are supported: SQL Server, Azure SQL Server, + /// Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and + /// SAP HANA. For other data sources, use the [Update Parameters In + /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call. + /// - Changing the data source type isn't supported. + /// - Data sources that contain parameters in the connection string aren't + /// supported. + /// - Updating data sources that are part of merged or joined tables is only + /// supported if you're using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - For an Advanced Query that reference multiple data sources, only the + /// first data source will be updated. To overcome this limitation, define the + /// data source as a parameter and use the [Update Parameters In + /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call. + /// - Datasets with incremental refresh policy are not fully supported, calling + /// this API may not work as expected and result of partial datasources update, + /// to overcome this you can try run a dataset refresh before calling this API. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task UpdateDatasourcesInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.UpdateDatasourcesInGroupWithHttpMessagesAsync(groupId, datasetId, updateDatasourcesRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Updates all connections for the specified dataset from the specified + /// workspace. This API call only supports SQL DirectQuery datasets. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated and no longer supported. This API call + /// isn't compatible with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// > + /// > Instead use: + /// > + /// > - [Update Parameters In + /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) to update + /// connections for SQL, Azure Synapse, OData, and SharePoint data sources. + /// > - [Update Datasources In + /// Group](/rest/api/power-bi/datasets/update-datasources-in-group) to + /// connections for other data sources. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Supports SQL DirectQuery datasets. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The body + /// + [System.Obsolete()] + public static void SetAllDatasetConnectionsInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, ConnectionDetails parameters) + { + operations.SetAllDatasetConnectionsInGroupAsync(groupId, datasetId, parameters).GetAwaiter().GetResult(); + } + + /// + /// Updates all connections for the specified dataset from the specified + /// workspace. This API call only supports SQL DirectQuery datasets. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated and no longer supported. This API call + /// isn't compatible with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// > + /// > Instead use: + /// > + /// > - [Update Parameters In + /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) to update + /// connections for SQL, Azure Synapse, OData, and SharePoint data sources. + /// > - [Update Datasources In + /// Group](/rest/api/power-bi/datasets/update-datasources-in-group) to + /// connections for other data sources. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Supports SQL DirectQuery datasets. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The body + /// + /// + /// The cancellation token. + /// + [System.Obsolete()] + public static async Task SetAllDatasetConnectionsInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, ConnectionDetails parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.SetAllDatasetConnectionsInGroupWithHttpMessagesAsync(groupId, datasetId, parameters, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Binds the specified dataset from the specified workspace to the specified + /// gateway, optionally with a given set of data source IDs. If you don't + /// supply a specific data source ID, the dataset will be bound to the first + /// matching data source in the gateway. + /// + /// + /// + /// > [!IMPORTANT] + /// > Add the API caller principal as a data source user on the gateway. + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The bind to gateway request + /// + public static void BindToGatewayInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, BindToGatewayRequest bindToGatewayRequest) + { + operations.BindToGatewayInGroupAsync(groupId, datasetId, bindToGatewayRequest).GetAwaiter().GetResult(); + } + + /// + /// Binds the specified dataset from the specified workspace to the specified + /// gateway, optionally with a given set of data source IDs. If you don't + /// supply a specific data source ID, the dataset will be bound to the first + /// matching data source in the gateway. + /// + /// + /// + /// > [!IMPORTANT] + /// > Add the API caller principal as a data source user on the gateway. + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The bind to gateway request + /// + /// + /// The cancellation token. + /// + public static async Task BindToGatewayInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, BindToGatewayRequest bindToGatewayRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BindToGatewayInGroupWithHttpMessagesAsync(groupId, datasetId, bindToGatewayRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Returns a list of gateway data sources for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated, use [Get Datasources In + /// Group](/rest/api/power-bi/datasets/get-datasources-in-group) instead. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + public static GatewayDatasources GetGatewayDatasourcesInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) + { + return operations.GetGatewayDatasourcesInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of gateway data sources for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated, use [Get Datasources In + /// Group](/rest/api/power-bi/datasets/get-datasources-in-group) instead. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetGatewayDatasourcesInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetGatewayDatasourcesInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a list of gateways that the specified dataset from the specified + /// workspace can be bound to. + /// + /// + /// + /// This API call is only relevant to datasets that have at least one + /// on-premises connection. For datasets with cloud-only connections, this API + /// call returns an empty list. + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + public static Gateways DiscoverGatewaysInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) + { + return operations.DiscoverGatewaysInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of gateways that the specified dataset from the specified + /// workspace can be bound to. + /// + /// + /// + /// This API call is only relevant to datasets that have at least one + /// on-premises connection. For datasets with cloud-only connections, this API + /// call returns an empty list. + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task DiscoverGatewaysInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.DiscoverGatewaysInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Transfers ownership over the specified dataset to the current authorized + /// user. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + public static void TakeOverInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) + { + operations.TakeOverInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); + } + + /// + /// Transfers ownership over the specified dataset to the current authorized + /// user. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task TakeOverInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.TakeOverInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + + /// + /// Executes Data Analysis Expressions (DAX) queries against the provided + /// dataset. + /// + /// + /// + /// DAX query errors will result in: + /// + /// - A response error, such as `DAX query failure`. + /// - A failure HTTP status code (400). + /// + /// A query that requests more than one table, or more than the allowed number + /// of table rows, will result in: + /// + /// - Limited data being returned. + /// - A response error, such as `More than one result table in a query` or + /// `More than {allowed number} rows in a query result`. + /// - A successful HTTP status code (200). + /// + /// Columns that are fully qualified in the query will be returned with a fully + /// qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed + /// or created in the query will be returned within square bracket, for + /// example, `[MyNewColumn]`. + /// + /// ## Permissions + /// + /// The user must have access to the workspace and dataset read permissions. + /// For more information, see [Manage dataset access + /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// - Datasets that are hosted in Azure Analysis Services or that have a live + /// connection to an on-premises Azure Analysis Services model aren't + /// supported. + /// - The tenant setting **Dataset Execute Queries REST API**, found under + /// **Integration settings**, must be enabled. + /// - One query per API call. + /// - One table request per query. + /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit + /// first). For example if you query for 5 columns, you can get back max + /// 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows + /// (1 million divided by 20). + /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row + /// will be completed but no additional rows will be written. + /// - There's a limit of 120 query requests per minute per user, regardless of + /// the dataset that's queried. + /// - Service Principals aren't supported for datasets with RLS per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or with SSO enabled. To use Service Principals, make sure the admin tenant + /// setting [_Allow service principals to use Power BI + /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) + /// under _Developer settings_ is enabled. + /// - Only DAX queries are supported at this time. MDX and DMV queries are not + /// supported. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The request message + /// + public static DatasetExecuteQueriesResponse ExecuteQueriesInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DatasetExecuteQueriesRequest requestMessage) + { + return operations.ExecuteQueriesInGroupAsync(groupId, datasetId, requestMessage).GetAwaiter().GetResult(); + } + + /// + /// Executes Data Analysis Expressions (DAX) queries against the provided + /// dataset. + /// + /// + /// + /// DAX query errors will result in: + /// + /// - A response error, such as `DAX query failure`. + /// - A failure HTTP status code (400). + /// + /// A query that requests more than one table, or more than the allowed number + /// of table rows, will result in: + /// + /// - Limited data being returned. + /// - A response error, such as `More than one result table in a query` or + /// `More than {allowed number} rows in a query result`. + /// - A successful HTTP status code (200). + /// + /// Columns that are fully qualified in the query will be returned with a fully + /// qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed + /// or created in the query will be returned within square bracket, for + /// example, `[MyNewColumn]`. + /// + /// ## Permissions + /// + /// The user must have access to the workspace and dataset read permissions. + /// For more information, see [Manage dataset access + /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// - Datasets that are hosted in Azure Analysis Services or that have a live + /// connection to an on-premises Azure Analysis Services model aren't + /// supported. + /// - The tenant setting **Dataset Execute Queries REST API**, found under + /// **Integration settings**, must be enabled. + /// - One query per API call. + /// - One table request per query. + /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit + /// first). For example if you query for 5 columns, you can get back max + /// 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows + /// (1 million divided by 20). + /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the current row + /// will be completed but no additional rows will be written. + /// - There's a limit of 120 query requests per minute per user, regardless of + /// the dataset that's queried. + /// - Service Principals aren't supported for datasets with RLS per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or with SSO enabled. To use Service Principals, make sure the admin tenant + /// setting [_Allow service principals to use Power BI + /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) + /// under _Developer settings_ is enabled. + /// - Only DAX queries are supported at this time. MDX and DMV queries are not + /// supported. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The request message + /// + /// + /// The cancellation token. + /// + public static async Task ExecuteQueriesInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, DatasetExecuteQueriesRequest requestMessage, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ExecuteQueriesInGroupWithHttpMessagesAsync(groupId, datasetId, requestMessage, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns the query scale-out sync status for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + public static DatasetQueryScaleOutSyncStatus GetQueryScaleOutSyncStatusInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) + { + return operations.GetQueryScaleOutSyncStatusInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns the query scale-out sync status for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetQueryScaleOutSyncStatusInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetQueryScaleOutSyncStatusInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Triggers a query scale-out sync of read-only replicas for the specified + /// dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + public static DatasetQueryScaleOutSyncStatus TriggerQueryScaleOutSyncInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId) + { + return operations.TriggerQueryScaleOutSyncInGroupAsync(groupId, datasetId).GetAwaiter().GetResult(); + } + + /// + /// Triggers a query scale-out sync of read-only replicas for the specified + /// dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task TriggerQueryScaleOutSyncInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.TriggerQueryScaleOutSyncInGroupWithHttpMessagesAsync(groupId, datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Generates an embed token based on the specified dataset from the specified + /// workspace. + /// + /// + /// + /// > [!TIP] + /// > To create embed tokens, it's recommended to use the latest API, + /// [Generate Token](/rest/api/power-bi/embed-token/generate-token). Generate + /// token supports additional functions, such as creating a token for multiple + /// items. + /// + /// > [!NOTE] + /// > An embed token can be used to [embed + /// Q&A](/power-bi/developer/qanda) within your application. + /// + /// > [!IMPORTANT] + /// > This API call is only relevant to the [embed for your + /// customers](/power-bi/developer/embed-sample-for-customers) scenario. To + /// learn more about using this API, see [Considerations when generating an + /// embed token](/power-bi/developer/embedded/generate-embed-token). + /// + /// ## Permissions + /// + /// - When using a service principal for authentication, refer to [Embed Power + /// BI content with service + /// principal](/power-bi/developer/embed-service-principal) and [Considerations + /// and + /// limitations](/power-bi/developer/embedded/embed-service-principal#considerations-and-limitations). + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Generate token parameters + /// + public static EmbedToken GenerateTokenInGroup(this IDatasetsOperations operations, System.Guid groupId, string datasetId, GenerateTokenRequest requestParameters) + { + return operations.GenerateTokenInGroupAsync(groupId, datasetId, requestParameters).GetAwaiter().GetResult(); + } + + /// + /// Generates an embed token based on the specified dataset from the specified + /// workspace. + /// + /// + /// + /// > [!TIP] + /// > To create embed tokens, it's recommended to use the latest API, + /// [Generate Token](/rest/api/power-bi/embed-token/generate-token). Generate + /// token supports additional functions, such as creating a token for multiple + /// items. + /// + /// > [!NOTE] + /// > An embed token can be used to [embed + /// Q&A](/power-bi/developer/qanda) within your application. + /// + /// > [!IMPORTANT] + /// > This API call is only relevant to the [embed for your + /// customers](/power-bi/developer/embed-sample-for-customers) scenario. To + /// learn more about using this API, see [Considerations when generating an + /// embed token](/power-bi/developer/embedded/generate-embed-token). + /// + /// ## Permissions + /// + /// - When using a service principal for authentication, refer to [Embed Power + /// BI content with service + /// principal](/power-bi/developer/embed-service-principal) and [Considerations + /// and + /// limitations](/power-bi/developer/embedded/embed-service-principal#considerations-and-limitations). + /// - This API call can be called by a service principal profile. For more + /// information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Generate token parameters + /// + /// + /// The cancellation token. + /// + public static async Task GenerateTokenInGroupAsync(this IDatasetsOperations operations, System.Guid groupId, string datasetId, GenerateTokenRequest requestParameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GenerateTokenInGroupWithHttpMessagesAsync(groupId, datasetId, requestParameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a list of datasets for the organization. + /// + /// + /// + /// Each request takes two seconds to process, during which time other requests + /// are queued. + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// Filters the results, based on a boolean condition + /// + /// + /// Returns only the first n results + /// + /// + /// Skips the first n results + /// + public static AdminDatasets GetDatasetsAsAdmin(this IDatasetsOperations operations, string filter = default(string), int? top = default(int?), int? skip = default(int?)) + { + return operations.GetDatasetsAsAdminAsync(filter, top, skip).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of datasets for the organization. + /// + /// + /// + /// Each request takes two seconds to process, during which time other requests + /// are queued. + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// Filters the results, based on a boolean condition + /// + /// + /// Returns only the first n results + /// + /// + /// Skips the first n results + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasetsAsAdminAsync(this IDatasetsOperations operations, string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasetsAsAdminWithHttpMessagesAsync(filter, top, skip, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a list of data sources for the specified dataset. + /// + /// + /// + /// Each request takes 0.5 seconds to process, during which time other requests + /// are queued. + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// + public static Datasources GetDatasourcesAsAdmin(this IDatasetsOperations operations, string datasetId) + { + return operations.GetDatasourcesAsAdminAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of data sources for the specified dataset. + /// + /// + /// + /// Each request takes 0.5 seconds to process, during which time other requests + /// are queued. + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasourcesAsAdminAsync(this IDatasetsOperations operations, string datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasourcesAsAdminWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a list of users that have access to the specified dataset. + /// + /// + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// - The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// + /// ## Limitations + /// + /// Maximum 200 requests per hour. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + public static DatasetUsers GetDatasetUsersAsAdmin(this IDatasetsOperations operations, System.Guid datasetId) + { + return operations.GetDatasetUsersAsAdminAsync(datasetId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of users that have access to the specified dataset. + /// + /// + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// - The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// + /// ## Limitations + /// + /// Maximum 200 requests per hour. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The dataset ID + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasetUsersAsAdminAsync(this IDatasetsOperations operations, System.Guid datasetId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasetUsersAsAdminWithHttpMessagesAsync(datasetId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a list of datasets from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// + /// ## Limitations + /// + /// Maximum 200 requests per hour. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// Filters the results, based on a boolean condition + /// + /// + /// Returns only the first n results + /// + /// + /// Skips the first n results + /// + /// + /// Expands related entities inline + /// + public static AdminDatasets GetDatasetsInGroupAsAdmin(this IDatasetsOperations operations, System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string)) + { + return operations.GetDatasetsInGroupAsAdminAsync(groupId, filter, top, skip, expand).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of datasets from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// + /// ## Limitations + /// + /// Maximum 200 requests per hour. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// Filters the results, based on a boolean condition + /// + /// + /// Returns only the first n results + /// + /// + /// Skips the first n results + /// + /// + /// Expands related entities inline + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasetsInGroupAsAdminAsync(this IDatasetsOperations operations, System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasetsInGroupAsAdminWithHttpMessagesAsync(groupId, filter, top, skip, expand, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Returns a list of upstream dataflows for datasets from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// + /// ## Limitations + /// + /// Maximum 200 requests per hour. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + public static DatasetToDataflowLinksResponse GetDatasetToDataflowsLinksInGroupAsAdmin(this IDatasetsOperations operations, System.Guid groupId) + { + return operations.GetDatasetToDataflowsLinksInGroupAsAdminAsync(groupId).GetAwaiter().GetResult(); + } + + /// + /// Returns a list of upstream dataflows for datasets from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 Global + /// Administrator or Power BI Service Administrator) or authenticate using a + /// service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must not** + /// have any admin-consent required premissions for Power BI set on it in the + /// Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin access + /// token. Must not be present when authentication via a service principal is + /// used. + /// + /// ## Limitations + /// + /// Maximum 200 requests per hour. + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The cancellation token. + /// + public static async Task GetDatasetToDataflowsLinksInGroupAsAdminAsync(this IDatasetsOperations operations, System.Guid groupId, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.GetDatasetToDataflowsLinksInGroupAsAdminWithHttpMessagesAsync(groupId, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + } +} diff --git a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs index c4619694..40b901cd 100644 --- a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs @@ -1,3101 +1,3101 @@ -// -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is -// regenerated. -// - -namespace Microsoft.PowerBI.Api -{ - using Microsoft.Rest; - using Models; - using System.Collections; - using System.Collections.Generic; - using System.Threading; - using System.Threading.Tasks; - - /// - /// DatasetsOperations operations. - /// - public partial interface IDatasetsOperations - { - /// - /// Returns a list of datasets from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// 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 - /// - Task> GetDatasetsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates a new dataset on **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list - /// of limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// Dataset definition to create - /// - /// - /// The default retention policy. Possible values include: 'None', - /// 'basicFIFO' - /// - /// - /// 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> PostDatasetWithHttpMessagesAsync(CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDatasetWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the properties for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// Update dataset request parameters - /// - /// - /// 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 UpdateDatasetWithHttpMessagesAsync(string datasetId, UpdateDatasetRequest updateDatasetRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes the specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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 DeleteDatasetWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Executes Data Analysis Expressions (DAX) queries against the - /// provided dataset. The dataset must reside in **My workspace** or - /// another workspace. - /// - /// - /// - /// DAX query errors will result in: - /// - /// - A response error, such as `DAX query failure`. - /// - A failure HTTP status code (400). - /// - /// A query that requests more than one table, or more than the allowed - /// number of table rows, will result in: - /// - /// - Limited data being returned. - /// - A response error, such as `More than one result table in a query` - /// or `More than {allowed number} rows in a query result`. - /// - A successful HTTP status code (200). - /// - /// Columns that are fully qualified in the query will be returned with - /// a fully qualified name, for example, `MyTable[MyColumn]`. Columns - /// that are renamed or created in the query will be returned within - /// square bracket, for example, `[MyNewColumn]`. - /// - /// ## Permissions - /// - /// The user must have dataset read permissions. For more information, - /// see [Manage dataset access - /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// - Datasets that are hosted in Azure Analysis Services or that have - /// a live connection to an on-premises Azure Analysis Services model - /// aren't supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found - /// under **Integration settings**, must be enabled. - /// - One query per API call. - /// - One table request per query. - /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever - /// is hit first). For example if you query for 5 columns, you can get - /// back max 100,000 rows. If you query for 20 columns, you can get - /// back max 50,000 rows (1 million divided by 20). - /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the - /// current row will be completed but no additional rows will be - /// written. - /// - There's a limit of 120 query requests per minute per user, - /// regardless of the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per - /// [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin - /// tenant setting [_Allow service principals to use Power BI - /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. - /// - Only DAX queries are supported at this time. MDX and DMV queries - /// are not supported. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The request message - /// - /// - /// 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> ExecuteQueriesWithHttpMessagesAsync(string datasetId, DatasetExecuteQueriesRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of tables within the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list - /// of limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetTablesWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the metadata and schema for the specified table within the - /// specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// Table name and columns to update existing table - /// - /// - /// 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> PutTableWithHttpMessagesAsync(string datasetId, string tableName, Table requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Adds new data rows to the specified table within the specified - /// dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - This API call only supports **push datasets**. - /// - See [Power BI REST API - /// limitations](/power-bi/developer/automation/api-rest-api-limitations). - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The request message - /// - /// - /// 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 PostRowsWithHttpMessagesAsync(string datasetId, string tableName, PostRowsRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes all rows from the specified table within the specified - /// dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list - /// of limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The table 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 DeleteRowsWithHttpMessagesAsync(string datasetId, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the refresh history for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// OneDrive refresh history isn't returned. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The requested number of entries in the refresh history. If not - /// provided, the default is the last available 60 entries. - /// - /// - /// 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> GetRefreshHistoryWithHttpMessagesAsync(string datasetId, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Triggers a refresh for the specified dataset from **My workspace**. - /// An [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) - /// is triggered only if a request payload other than `notifyOption` is - /// set. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - For Shared capacities, a maximum of eight requests per day, - /// including refreshes executed by using scheduled refresh, can be - /// initiated. - /// - For Shared capacities, only `notifyOption` can be specified in - /// the request body. - /// - Enhanced refresh is not supported for shared capacities. - /// - For enhanced refresh, `notifyOption` is not required and must be - /// excluded from the request body. However, one or more parameters - /// other than `notifyOption` are required. - /// - For Premium capacities, the maximum requests per day is only - /// limited by the available resources in the capacity. If available - /// resources are overloaded, refreshes are throttled until the load is - /// reduced. The refresh will fail if throttling exceeds 1 hour. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// - /// - /// 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> RefreshDatasetWithHttpMessagesAsync(string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns execution details of an [enhanced refresh - /// operation](/power-bi/connect-data/asynchronous-refresh) for the - /// specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - /// - /// 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 - /// - Task> GetRefreshExecutionDetailsWithHttpMessagesAsync(System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Cancels the specified refresh operation for the specified dataset - /// from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - Task CancelRefreshWithHttpMessagesAsync(System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the refresh schedule for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetRefreshScheduleWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the refresh schedule for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// A request that disables the refresh schedule should contain no - /// other changes. - /// - /// At least one day must be specified. If no times are specified, then - /// Power BI will use a default single time per day. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// The limit on the number of time slots per day depends on whether a - /// [Premium](/power-bi/admin/service-premium-what-is) or Shared - /// capacity is used. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// Update Refresh Schedule parameters, by specifying all or some of - /// the parameters - /// - /// - /// 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 UpdateRefreshScheduleWithHttpMessagesAsync(string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDirectQueryRefreshScheduleWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from **My workspace**. - /// - /// - /// - /// A request should contain either a set of days and times *or* a - /// valid frequency, but not both. If you choose a set of days without - /// specifying any times, then Power BI will use a default single time - /// per day. Setting the frequency will automatically overwrite the - /// days and times setting. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by - /// specifying all or some of the parameters - /// - /// - /// 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 UpdateDirectQueryRefreshScheduleWithHttpMessagesAsync(string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of parameters for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) - /// connections aren't supported. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetParametersWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the parameters values for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) - /// with this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - If you're using **enhanced dataset metadata**, refresh the - /// dataset to apply the new parameter values. - /// > - If you're not using **enhanced dataset metadata**, wait 30 - /// minutes for the update data sources operation to complete, and then - /// refresh the dataset. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't - /// supported. To make changes to those data sources, the admin must - /// use the Azure Analysis Services client library for Tabular Object - /// Model. - /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) - /// connections are only supported with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - Datasets with Azure Analysis Services live connections aren't - /// supported. - /// - Maximum of 100 parameters per request. - /// - All specified parameters must exist in the dataset. - /// - Parameters values should be of the expected type. - /// - The parameter list can't be empty or include duplicate - /// parameters. - /// - Parameters names are case-sensitive. - /// - Parameter `IsRequired` must have a non-empty value. - /// - The parameter types `Any` and `Binary` can't be updated. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// - /// - /// 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 UpdateParametersWithHttpMessagesAsync(string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of data sources for the specified dataset from **My - /// workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDatasourcesWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the data sources of the specified dataset from **My - /// workspace**. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) - /// with this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - The original data source and the new data source must have - /// the exact same schema. - /// > - If you're using **enhanced dataset metadata**, refresh the - /// dataset to get data from the new data sources. - /// > - If you're not using **enhanced dataset metadata**, wait 30 - /// minutes for the update data sources operation to complete, and then - /// refresh the dataset. - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't - /// supported. To make changes to those data sources, the admin must - /// use the Azure Analysis Services client library for Tabular Object - /// Model. - /// - Only these data sources are supported: SQL Server, Azure SQL - /// Server, Azure Analysis Services, Azure Synapse, OData, SharePoint, - /// Teradata, and SAP HANA. For other data sources, use the [Update - /// Parameters](/rest/api/power-bi/datasets/update-parameters) API - /// call. - /// - Changing the data source type isn't supported. - /// - Data sources that contain parameters in the connection string - /// aren't supported. - /// - Updating data sources that are part of merged or joined tables is - /// only supported if you're using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - For an Advanced Query that references multiple data sources, only - /// the first data source will be updated. To overcome this limitation, - /// define the data source as a parameter and use the [Update - /// Parameters](/rest/api/power-bi/datasets/update-parameters) API - /// call. - /// - Datasets with incremental refresh policy are not fully supported, - /// calling this API may not work as expected and result of partial - /// datasources update, to overcome this you can try run a dataset - /// refresh before calling this API. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// - /// - /// 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 UpdateDatasourcesWithHttpMessagesAsync(string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates all connections for the specified dataset from **My - /// workspace**. This API call only supports SQL DirectQuery datasets. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated and no longer supported. This API - /// call isn't compatible with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// > - /// > Instead use: - /// > - /// > - [Update - /// Parameters](/rest/api/power-bi/datasets/update-parameters) to - /// update connections for SQL, Azure Synapse, OData, and SharePoint - /// data sources. - /// > - [Update - /// Datasources](/rest/api/power-bi/datasets/update-datasources) to - /// connections for other data sources. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The body - /// - /// - /// 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 - /// - [System.Obsolete()] - Task SetAllDatasetConnectionsWithHttpMessagesAsync(string datasetId, ConnectionDetails parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Binds the specified dataset from **My workspace** to the specified - /// gateway, optionally with a given set of data source IDs. If you - /// don't supply a specific data source ID, the dataset will be bound - /// to the first matching data source in the gateway. - /// - /// - /// - /// > [!IMPORTANT] - /// > Add the API caller principal as a data source user on the - /// gateway. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Only supports the on-premises data gateway - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// The bind to gateway request - /// - /// - /// 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 BindToGatewayWithHttpMessagesAsync(string datasetId, BindToGatewayRequest bindToGatewayRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of gateway data sources for the specified dataset - /// from **My workspace**. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated, use [Get - /// Datasources](/rest/api/power-bi/datasets/get-datasources) instead. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetGatewayDatasourcesWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of gateways that the specified dataset from **My - /// workspace** can be bound to. - /// - /// - /// - /// This API call is only relevant to datasets that have at least one - /// on-premises connection. For datasets with cloud-only connections, - /// this API call returns an empty list. - /// - /// ## Required Scope - /// - /// Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> DiscoverGatewaysWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the query scale-out sync status for the specified dataset - /// from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetQueryScaleOutSyncStatusWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Triggers a query scale-out sync of read-only replicas for the - /// specified dataset from **My workspace**. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> TriggerQueryScaleOutSyncWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Grants the specified user's permissions to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the - /// new permissions might not be immediately available through API - /// calls. To refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API - /// call. - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Limitations - /// - /// - Adding permissions to service principals (app principalType) - /// isn't supported - /// - Caller must have ReadReshare permissions on the dataset. - /// - This API call can't be used to grant dataset Write permission on - /// the dataset - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - /// - /// 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 PostDatasetUserInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, PostDatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the existing dataset permissions of the specified user to - /// the specified permissions. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the - /// new permissions might not be immediately available through API - /// calls. To refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API - /// call. - /// This API call can be used to remove all the dataset permissions of - /// the specified user by using `datasetUserAccessRight: None` - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// ## Limitations - /// - /// - Updating permissions to service principals (app principalType) - /// isn't supported - /// - Caller must have ReadWriteReshare permissions on the dataset. - /// That is, folder admins, members and contributors with Reshare - /// permissions, or dataset owners. - /// - This API can't be used to add or remove *write* permission. - /// - This API can't be used to remove folder-level inherited - /// permissions. For folder admins and members, the - /// ReadWriteReshareExplore permission on the folder's datasets is - /// inherited. For folder contributors, the ReadWriteExplore permission - /// on the folder's datasets is inherited. For folder viewers, the Read - /// permission on the folder's datasets is inherited. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - /// - /// 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 PutDatasetUserInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of principals that have access to the specified - /// dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the - /// new permissions might not be immediately available through API - /// calls. To refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API - /// call. - /// - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// ## Limitations - /// - /// Caller must have ReadWriteReshare permissions on the dataset. That - /// is, folder admins, members and contributors with Reshare - /// permissions, or dataset owners. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDatasetUsersInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Grants the specified user's permissions to the specified dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the - /// new permissions might not be immediately available through API - /// calls. To refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API - /// call. - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Limitations - /// - /// - Adding permissions to service principals (app principalType) - /// isn't supported - /// - Caller must have ReadReshare permissions on the dataset. - /// - This API call can't be used to grant dataset Write permission on - /// the dataset - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - /// - /// 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 PostDatasetUserWithHttpMessagesAsync(string datasetId, PostDatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the existing dataset permissions of the specified user to - /// the specified permissions. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the - /// new permissions might not be immediately available through API - /// calls. To refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API - /// call. - /// This API call can be used to remove all the dataset permissions of - /// the specified user by using `datasetUserAccessRight: None` - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// ## Limitations - /// - /// - Updating permissions to service principals (app principalType) - /// isn't supported - /// - Caller must have ReadWriteReshare permissions on the dataset. - /// That is, folder admins, members and contributors with Reshare - /// permissions, or dataset owners. - /// - This API can't be used to add or remove *write* permission. - /// - This API can't be used to remove folder-level inherited - /// permissions. For folder admins and members, the - /// ReadWriteReshareExplore permission on the folder's datasets is - /// inherited. For folder contributors, the ReadWriteExplore permission - /// on the folder's datasets is inherited. For folder viewers, the Read - /// permission on the folder's datasets is inherited. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// Details of user access right - /// - /// - /// 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 PutDatasetUserWithHttpMessagesAsync(string datasetId, DatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of principals that have access to the specified - /// dataset. - /// - /// - /// - /// When user permissions to a dataset have been recently updated, the - /// new permissions might not be immediately available through API - /// calls. To refresh user permissions, use the [Refresh User - /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API - /// call. - /// - /// ## Permissions - /// - /// The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// ## Limitations - /// - /// Caller must have ReadWriteReshare permissions on the dataset. That - /// is, folder admins, members and contributors with Reshare - /// permissions, or dataset owners. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDatasetUsersWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of datasets from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// 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 - /// - Task> GetDatasetsInGroupWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Creates a new dataset in the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list - /// of limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// Create dataset parameters - /// - /// - /// The default retention policy. Possible values include: 'None', - /// 'basicFIFO' - /// - /// - /// 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> PostDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of upstream dataflows for datasets from the - /// specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// 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 - /// - Task> GetDatasetToDataflowsLinksInGroupWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the specified dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the properties for the specified dataset from the specified - /// workspace. - /// - /// - /// - /// ## Permissions - /// - /// The user must be the dataset owner. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Update dataset request parameters - /// - /// - /// 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 UpdateDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, UpdateDatasetRequest updateDatasetRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes the specified dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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 DeleteDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of tables within the specified dataset from the - /// specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list - /// of limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetTablesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the metadata and schema for the specified table within the - /// specified dataset from the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The request message - /// - /// - /// 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> PutTableInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, string tableName, Table requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Adds new data rows to the specified table within the specified - /// dataset from the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - This API call only supports **push datasets**. - /// - See [Power BI REST API - /// limitations](/power-bi/developer/automation/api-rest-api-limitations). - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The table name - /// - /// - /// The request message - /// - /// - /// 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 PostRowsInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, string tableName, PostRowsRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Deletes all rows from the specified table within the specified - /// dataset from the specified workspace. - /// - /// - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// This API call only supports **push datasets**. For a complete list - /// of limitations, see [Push datasets - /// limitations](/power-bi/developer/embedded/push-datasets-limitations). - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The table 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 DeleteRowsInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the refresh history for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// OneDrive refresh history isn't returned. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The requested number of entries in the refresh history. If not - /// provided, the default is the last available 60 entries. - /// - /// - /// 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> GetRefreshHistoryInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Triggers a refresh for the specified dataset from the specified - /// workspace. An [enhanced - /// refresh](/power-bi/connect-data/asynchronous-refresh) is triggered - /// only if a request payload other than `notifyOption` is set. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - For Shared capacities, a maximum of eight requests per day, - /// including refreshes executed by using scheduled refresh, can be - /// initiated. - /// - For Shared capacities, only `notifyOption` can be specified in - /// the request body. - /// - Enhanced refresh is not supported for shared capacities. - /// - For enhanced refresh, `notifyOption` is not required and must be - /// excluded from the request body. However, one or more parameters - /// other than `notifyOption` are required. - /// - For Premium capacities, the maximum requests per day is only - /// limited by the available resources in the capacity. If available - /// resources are overloaded, refreshes are throttled until the load is - /// reduced. The refresh will fail if throttling exceeds 1 hour. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// - /// - /// 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> RefreshDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns execution details of an [enhanced refresh - /// operation](/power-bi/connect-data/asynchronous-refresh) for the - /// specified dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - /// - /// 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 - /// - Task> GetRefreshExecutionDetailsInGroupWithHttpMessagesAsync(System.Guid groupId, System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Cancels the specified refresh operation for the specified dataset - /// from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The refresh ID - /// - /// - /// The headers that will be added to request. - /// - /// - /// The cancellation token. - /// - /// - /// Thrown when the operation returned an invalid status code - /// - Task CancelRefreshInGroupWithHttpMessagesAsync(System.Guid groupId, System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the refresh schedule for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the refresh schedule for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// A request that disables the refresh schedule should contain no - /// other changes. - /// - /// At least one day must be specified. If no times are specified, then - /// Power BI will use a default single time per day. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// The limit on the number of time slots per day depends on whether a - /// [Premium](/power-bi/admin/service-premium-what-is) or Shared - /// capacity is used. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Update Refresh Schedule parameters, by specifying all or some of - /// the parameters - /// - /// - /// 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 UpdateRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetDirectQueryRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the refresh schedule for a specified - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or - /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) - /// dataset from the specified workspace. - /// - /// - /// - /// A request should contain either a set of days and times *or* a - /// valid frequency, but not both. If you choose a set of days without - /// specifying any times, then Power BI will use a default single time - /// per day. Setting the frequency will automatically overwrite the - /// days and times setting. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by - /// specifying all or some of the parameters - /// - /// - /// 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 UpdateDirectQueryRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of parameters for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.Read.All or Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA - /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) - /// connections aren't supported. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// 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> GetParametersInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the parameters values for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) - /// with this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - If you're using **enhanced dataset metadata**, refresh the - /// dataset to apply the new parameter values. - /// > - If you're not using **enhanced dataset metadata**, wait 30 - /// minutes for the update data sources operation to complete, and then - /// refresh the dataset. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't - /// supported. To make changes to those data sources, the admin must - /// use the Azure Analysis Services client library for Tabular Object - /// Model. - /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) - /// connections are only supported with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - Datasets with Azure Analysis Services live connections aren't - /// supported. - /// - Maximum of 100 parameters per request. - /// - All specified parameters must exist in the dataset. - /// - Parameters values should be of the expected type. - /// - The parameter list can't be empty or include duplicate - /// parameters. - /// - Parameters names are case-sensitive. - /// - Parameter `IsRequired` must have a non-empty value. - /// - The parameter types `Any` and `Binary` can't be updated. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// - /// - /// 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 UpdateParametersInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of data sources for the specified dataset from the - /// specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// 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> GetDatasourcesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates the data sources of the specified dataset from the - /// specified workspace. - /// - /// - /// - /// > [!NOTE] - /// > We recommend using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) - /// with this API call. - /// - /// > [!IMPORTANT] - /// > - /// > - The original data source and the new data source must have - /// the exact same schema. - /// > - If you're using **enhanced dataset metadata**, refresh the - /// dataset to get data from the new data sources. - /// > - If you're not using **enhanced dataset metadata**, wait 30 - /// minutes for the update data sources operation to complete, and then - /// refresh the dataset. - /// - /// ## Permissions - /// - /// - The user must be the dataset owner. - /// - This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// - Datasets created using the public [XMLA - /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't - /// supported. To make changes to those data sources, the admin must - /// use the Azure Analysis Services client library for Tabular Object - /// Model. - /// - Only these data sources are supported: SQL Server, Azure SQL - /// Server, Azure Analysis Services, Azure Synapse, OData, SharePoint, - /// Teradata, and SAP HANA. For other data sources, use the [Update - /// Parameters In - /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API - /// call. - /// - Changing the data source type isn't supported. - /// - Data sources that contain parameters in the connection string - /// aren't supported. - /// - Updating data sources that are part of merged or joined tables is - /// only supported if you're using [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// - For an Advanced Query that reference multiple data sources, only - /// the first data source will be updated. To overcome this limitation, - /// define the data source as a parameter and use the [Update - /// Parameters In - /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API - /// call. - /// - Datasets with incremental refresh policy are not fully supported, - /// calling this API may not work as expected and result of partial - /// datasources update, to overcome this you can try run a dataset - /// refresh before calling this API. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// - /// - /// - /// - /// 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 UpdateDatasourcesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Updates all connections for the specified dataset from the - /// specified workspace. This API call only supports SQL DirectQuery - /// datasets. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated and no longer supported. This API - /// call isn't compatible with [enhanced dataset - /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). - /// > - /// > Instead use: - /// > - /// > - [Update Parameters In - /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) to - /// update connections for SQL, Azure Synapse, OData, and SharePoint - /// data sources. - /// > - [Update Datasources In - /// Group](/rest/api/power-bi/datasets/update-datasources-in-group) to - /// connections for other data sources. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Supports SQL DirectQuery datasets. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The body - /// - /// - /// 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 - /// - [System.Obsolete()] - Task SetAllDatasetConnectionsInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, ConnectionDetails parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Binds the specified dataset from the specified workspace to the - /// specified gateway, optionally with a given set of data source IDs. - /// If you don't supply a specific data source ID, the dataset will be - /// bound to the first matching data source in the gateway. - /// - /// - /// - /// > [!IMPORTANT] - /// > Add the API caller principal as a data source user on the - /// gateway. - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// - /// ## Limitations - /// - /// Only supports the on-premises data gateway - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The bind to gateway request - /// - /// - /// 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 BindToGatewayInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, BindToGatewayRequest bindToGatewayRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of gateway data sources for the specified dataset - /// from the specified workspace. - /// - /// - /// - /// > [!IMPORTANT] - /// > This API call is deprecated, use [Get Datasources In - /// Group](/rest/api/power-bi/datasets/get-datasources-in-group) - /// instead. - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetGatewayDatasourcesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of gateways that the specified dataset from the - /// specified workspace can be bound to. - /// - /// - /// - /// This API call is only relevant to datasets that have at least one - /// on-premises connection. For datasets with cloud-only connections, - /// this API call returns an empty list. - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> DiscoverGatewaysInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Transfers ownership over the specified dataset to the current - /// authorized user. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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 TakeOverInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Executes Data Analysis Expressions (DAX) queries against the - /// provided dataset. - /// - /// - /// - /// DAX query errors will result in: - /// - /// - A response error, such as `DAX query failure`. - /// - A failure HTTP status code (400). - /// - /// A query that requests more than one table, or more than the allowed - /// number of table rows, will result in: - /// - /// - Limited data being returned. - /// - A response error, such as `More than one result table in a query` - /// or `More than {allowed number} rows in a query result`. - /// - A successful HTTP status code (200). - /// - /// Columns that are fully qualified in the query will be returned with - /// a fully qualified name, for example, `MyTable[MyColumn]`. Columns - /// that are renamed or created in the query will be returned within - /// square bracket, for example, `[MyNewColumn]`. - /// - /// ## Permissions - /// - /// The user must have dataset read permissions. For more information, - /// see [Manage dataset access - /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// - /// ## Limitations - /// - /// - Datasets that are hosted in Azure Analysis Services or that have - /// a live connection to an on-premises Azure Analysis Services model - /// aren't supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found - /// under **Integration settings**, must be enabled. - /// - One query per API call. - /// - One table request per query. - /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever - /// is hit first). For example if you query for 5 columns, you can get - /// back max 100,000 rows. If you query for 20 columns, you can get - /// back max 50,000 rows (1 million divided by 20). - /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the - /// current row will be completed but no additional rows will be - /// written. - /// - There's a limit of 120 query requests per minute per user, - /// regardless of the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per - /// [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin - /// tenant setting [_Allow service principals to use Power BI - /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. - /// - Only DAX queries are supported at this time. MDX and DMV queries - /// are not supported. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// The request message - /// - /// - /// 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> ExecuteQueriesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DatasetExecuteQueriesRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns the query scale-out sync status for the specified dataset - /// from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> GetQueryScaleOutSyncStatusInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Triggers a query scale-out sync of read-only replicas for the - /// specified dataset from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// 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> TriggerQueryScaleOutSyncInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Generates an embed token based on the specified dataset from the - /// specified workspace. - /// - /// - /// - /// > [!TIP] - /// > To create embed tokens, it's recommended to use the latest - /// API, [Generate - /// Token](/rest/api/power-bi/embed-token/generate-token). Generate - /// token supports additional functions, such as creating a token for - /// multiple items. - /// - /// > [!NOTE] - /// > An embed token can be used to [embed - /// Q&A](/power-bi/developer/qanda) within your application. - /// - /// > [!IMPORTANT] - /// > This API call is only relevant to the [embed for your - /// customers](/power-bi/developer/embed-sample-for-customers) - /// scenario. To learn more about using this API, see [Considerations - /// when generating an embed - /// token](/power-bi/developer/embedded/generate-embed-token). - /// - /// ## Permissions - /// - /// - When using a service principal for authentication, refer to - /// [Embed Power BI content with service - /// principal](/power-bi/developer/embed-service-principal) and - /// [Considerations and - /// limitations](/power-bi/developer/embedded/embed-service-principal#considerations-and-limitations). - /// - This API call can be called by a service principal profile. For - /// more information see: [Service principal profiles in Power BI - /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). - /// - /// ## Required Scope - /// - /// Dataset.ReadWrite.All or Dataset.Read.All - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// The dataset ID - /// - /// - /// Generate token parameters - /// - /// - /// 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> GenerateTokenInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, GenerateTokenRequest requestParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of datasets for the organization. - /// - /// - /// - /// Each request takes two seconds to process, during which time other - /// requests are queued. - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 - /// Global Administrator or Power BI Service Administrator) or - /// authenticate using a service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must - /// not** have any admin-consent required premissions for Power BI set - /// on it in the Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin - /// access token. Must not be present when authentication via a service - /// principal is used. - /// <br><br> - /// - /// - /// Filters the results, based on a boolean condition - /// - /// - /// Returns only the first n results - /// - /// - /// Skips the first n results - /// - /// - /// 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 - /// - Task> GetDatasetsAsAdminWithHttpMessagesAsync(string filter = default(string), int? top = default(int?), int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of data sources for the specified dataset. - /// - /// - /// - /// Each request takes 0.5 seconds to process, during which time other - /// requests are queued. - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 - /// Global Administrator or Power BI Service Administrator) or - /// authenticate using a service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must - /// not** have any admin-consent required premissions for Power BI set - /// on it in the Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin - /// access token. Must not be present when authentication via a service - /// principal is used. - /// <br><br> - /// - /// - /// - /// - /// 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> GetDatasourcesAsAdminWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of users that have access to the specified dataset. - /// - /// - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 - /// Global Administrator or Power BI Service Administrator) or - /// authenticate using a service principal. - /// - Delegated permissions are supported. - /// - The permissions for this API call are listed in [Datasets - /// permissions](/power-bi/developer/embedded/datasets-permissions). - /// - /// When running under service prinicipal authentication, an app **must - /// not** have any admin-consent required premissions for Power BI set - /// on it in the Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin - /// access token. Must not be present when authentication via a service - /// principal is used. - /// - /// ## Limitations - /// - /// Maximum 200 requests per hour. - /// <br><br> - /// - /// - /// The dataset ID - /// - /// - /// 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 - /// - Task> GetDatasetUsersAsAdminWithHttpMessagesAsync(System.Guid datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of datasets from the specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 - /// Global Administrator or Power BI Service Administrator) or - /// authenticate using a service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must - /// not** have any admin-consent required premissions for Power BI set - /// on it in the Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin - /// access token. Must not be present when authentication via a service - /// principal is used. - /// - /// ## Limitations - /// - /// Maximum 200 requests per hour. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// Filters the results, based on a boolean condition - /// - /// - /// Returns only the first n results - /// - /// - /// Skips the first n results - /// - /// - /// Expands related entities inline - /// - /// - /// 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 - /// - Task> GetDatasetsInGroupAsAdminWithHttpMessagesAsync(System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Returns a list of upstream dataflows for datasets from the - /// specified workspace. - /// - /// - /// - /// ## Permissions - /// - /// - The user must have administrator rights (such as Office 365 - /// Global Administrator or Power BI Service Administrator) or - /// authenticate using a service principal. - /// - Delegated permissions are supported. - /// - /// When running under service prinicipal authentication, an app **must - /// not** have any admin-consent required premissions for Power BI set - /// on it in the Azure portal. - /// - /// ## Required Scope - /// - /// Tenant.Read.All or Tenant.ReadWrite.All - /// - /// Relevant only when authenticating via a standard delegated admin - /// access token. Must not be present when authentication via a service - /// principal is used. - /// - /// ## Limitations - /// - /// Maximum 200 requests per hour. - /// <br><br> - /// - /// - /// The workspace ID - /// - /// - /// 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 - /// - Task> GetDatasetToDataflowsLinksInGroupAsAdminWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); - } -} +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.PowerBI.Api +{ + using Microsoft.Rest; + using Models; + using System.Collections; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + /// + /// DatasetsOperations operations. + /// + public partial interface IDatasetsOperations + { + /// + /// Returns a list of datasets from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// 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 + /// + Task> GetDatasetsWithHttpMessagesAsync(Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new dataset on **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list + /// of limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// Dataset definition to create + /// + /// + /// The default retention policy. Possible values include: 'None', + /// 'basicFIFO' + /// + /// + /// 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> PostDatasetWithHttpMessagesAsync(CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDatasetWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the properties for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// Update dataset request parameters + /// + /// + /// 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 UpdateDatasetWithHttpMessagesAsync(string datasetId, UpdateDatasetRequest updateDatasetRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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 DeleteDatasetWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Executes Data Analysis Expressions (DAX) queries against the + /// provided dataset. The dataset must reside in **My workspace** or + /// another workspace. + /// + /// + /// + /// DAX query errors will result in: + /// + /// - A response error, such as `DAX query failure`. + /// - A failure HTTP status code (400). + /// + /// A query that requests more than one table, or more than the allowed + /// number of table rows, will result in: + /// + /// - Limited data being returned. + /// - A response error, such as `More than one result table in a query` + /// or `More than {allowed number} rows in a query result`. + /// - A successful HTTP status code (200). + /// + /// Columns that are fully qualified in the query will be returned with + /// a fully qualified name, for example, `MyTable[MyColumn]`. Columns + /// that are renamed or created in the query will be returned within + /// square bracket, for example, `[MyNewColumn]`. + /// + /// ## Permissions + /// + /// The user must have dataset read permissions. For more information, + /// see [Manage dataset access + /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// - Datasets that are hosted in Azure Analysis Services or that have + /// a live connection to an on-premises Azure Analysis Services model + /// aren't supported. + /// - The tenant setting **Dataset Execute Queries REST API**, found + /// under **Integration settings**, must be enabled. + /// - One query per API call. + /// - One table request per query. + /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever + /// is hit first). For example if you query for 5 columns, you can get + /// back max 100,000 rows. If you query for 20 columns, you can get + /// back max 50,000 rows (1 million divided by 20). + /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the + /// current row will be completed but no additional rows will be + /// written. + /// - There's a limit of 120 query requests per minute per user, + /// regardless of the dataset that's queried. + /// - Service Principals aren't supported for datasets with RLS per + /// [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or with SSO enabled. To use Service Principals, make sure the admin + /// tenant setting [_Allow service principals to use Power BI + /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) + /// under _Developer settings_ is enabled. + /// - Only DAX queries are supported at this time. MDX and DMV queries + /// are not supported. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The request message + /// + /// + /// 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> ExecuteQueriesWithHttpMessagesAsync(string datasetId, DatasetExecuteQueriesRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of tables within the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list + /// of limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetTablesWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the metadata and schema for the specified table within the + /// specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// Table name and columns to update existing table + /// + /// + /// 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> PutTableWithHttpMessagesAsync(string datasetId, string tableName, Table requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Adds new data rows to the specified table within the specified + /// dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - This API call only supports **push datasets**. + /// - See [Power BI REST API + /// limitations](/power-bi/developer/automation/api-rest-api-limitations). + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The request message + /// + /// + /// 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 PostRowsWithHttpMessagesAsync(string datasetId, string tableName, PostRowsRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes all rows from the specified table within the specified + /// dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list + /// of limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The table 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 DeleteRowsWithHttpMessagesAsync(string datasetId, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the refresh history for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// OneDrive refresh history isn't returned. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The requested number of entries in the refresh history. If not + /// provided, the default is the last available 60 entries. + /// + /// + /// 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> GetRefreshHistoryWithHttpMessagesAsync(string datasetId, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Triggers a refresh for the specified dataset from **My workspace**. + /// An [enhanced refresh](/power-bi/connect-data/asynchronous-refresh) + /// is triggered only if a request payload other than `notifyOption` is + /// set. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - For Shared capacities, a maximum of eight requests per day, + /// including refreshes executed by using scheduled refresh, can be + /// initiated. + /// - For Shared capacities, only `notifyOption` can be specified in + /// the request body. + /// - Enhanced refresh is not supported for shared capacities. + /// - For enhanced refresh, `notifyOption` is not required and must be + /// excluded from the request body. However, one or more parameters + /// other than `notifyOption` are required. + /// - For Premium capacities, the maximum requests per day is only + /// limited by the available resources in the capacity. If available + /// resources are overloaded, refreshes are throttled until the load is + /// reduced. The refresh will fail if throttling exceeds 1 hour. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// + /// + /// 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> RefreshDatasetWithHttpMessagesAsync(string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns execution details of an [enhanced refresh + /// operation](/power-bi/connect-data/asynchronous-refresh) for the + /// specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + /// + /// 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 + /// + Task> GetRefreshExecutionDetailsWithHttpMessagesAsync(System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Cancels the specified refresh operation for the specified dataset + /// from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + Task CancelRefreshWithHttpMessagesAsync(System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the refresh schedule for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetRefreshScheduleWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the refresh schedule for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// A request that disables the refresh schedule should contain no + /// other changes. + /// + /// At least one day must be specified. If no times are specified, then + /// Power BI will use a default single time per day. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// The limit on the number of time slots per day depends on whether a + /// [Premium](/power-bi/admin/service-premium-what-is) or Shared + /// capacity is used. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// Update Refresh Schedule parameters, by specifying all or some of + /// the parameters + /// + /// + /// 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 UpdateRefreshScheduleWithHttpMessagesAsync(string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDirectQueryRefreshScheduleWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from **My workspace**. + /// + /// + /// + /// A request should contain either a set of days and times *or* a + /// valid frequency, but not both. If you choose a set of days without + /// specifying any times, then Power BI will use a default single time + /// per day. Setting the frequency will automatically overwrite the + /// days and times setting. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by + /// specifying all or some of the parameters + /// + /// + /// 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 UpdateDirectQueryRefreshScheduleWithHttpMessagesAsync(string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of parameters for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) + /// connections aren't supported. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetParametersWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the parameters values for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) + /// with this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - If you're using **enhanced dataset metadata**, refresh the + /// dataset to apply the new parameter values. + /// > - If you're not using **enhanced dataset metadata**, wait 30 + /// minutes for the update data sources operation to complete, and then + /// refresh the dataset. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't + /// supported. To make changes to those data sources, the admin must + /// use the Azure Analysis Services client library for Tabular Object + /// Model. + /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) + /// connections are only supported with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - Datasets with Azure Analysis Services live connections aren't + /// supported. + /// - Maximum of 100 parameters per request. + /// - All specified parameters must exist in the dataset. + /// - Parameters values should be of the expected type. + /// - The parameter list can't be empty or include duplicate + /// parameters. + /// - Parameters names are case-sensitive. + /// - Parameter `IsRequired` must have a non-empty value. + /// - The parameter types `Any` and `Binary` can't be updated. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// + /// + /// 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 UpdateParametersWithHttpMessagesAsync(string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of data sources for the specified dataset from **My + /// workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDatasourcesWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the data sources of the specified dataset from **My + /// workspace**. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) + /// with this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - The original data source and the new data source must have + /// the exact same schema. + /// > - If you're using **enhanced dataset metadata**, refresh the + /// dataset to get data from the new data sources. + /// > - If you're not using **enhanced dataset metadata**, wait 30 + /// minutes for the update data sources operation to complete, and then + /// refresh the dataset. + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't + /// supported. To make changes to those data sources, the admin must + /// use the Azure Analysis Services client library for Tabular Object + /// Model. + /// - Only these data sources are supported: SQL Server, Azure SQL + /// Server, Azure Analysis Services, Azure Synapse, OData, SharePoint, + /// Teradata, and SAP HANA. For other data sources, use the [Update + /// Parameters](/rest/api/power-bi/datasets/update-parameters) API + /// call. + /// - Changing the data source type isn't supported. + /// - Data sources that contain parameters in the connection string + /// aren't supported. + /// - Updating data sources that are part of merged or joined tables is + /// only supported if you're using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - For an Advanced Query that references multiple data sources, only + /// the first data source will be updated. To overcome this limitation, + /// define the data source as a parameter and use the [Update + /// Parameters](/rest/api/power-bi/datasets/update-parameters) API + /// call. + /// - Datasets with incremental refresh policy are not fully supported, + /// calling this API may not work as expected and result of partial + /// datasources update, to overcome this you can try run a dataset + /// refresh before calling this API. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// + /// + /// 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 UpdateDatasourcesWithHttpMessagesAsync(string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates all connections for the specified dataset from **My + /// workspace**. This API call only supports SQL DirectQuery datasets. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated and no longer supported. This API + /// call isn't compatible with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// > + /// > Instead use: + /// > + /// > - [Update + /// Parameters](/rest/api/power-bi/datasets/update-parameters) to + /// update connections for SQL, Azure Synapse, OData, and SharePoint + /// data sources. + /// > - [Update + /// Datasources](/rest/api/power-bi/datasets/update-datasources) to + /// connections for other data sources. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The body + /// + /// + /// 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 + /// + [System.Obsolete()] + Task SetAllDatasetConnectionsWithHttpMessagesAsync(string datasetId, ConnectionDetails parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Binds the specified dataset from **My workspace** to the specified + /// gateway, optionally with a given set of data source IDs. If you + /// don't supply a specific data source ID, the dataset will be bound + /// to the first matching data source in the gateway. + /// + /// + /// + /// > [!IMPORTANT] + /// > Add the API caller principal as a data source user on the + /// gateway. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// The bind to gateway request + /// + /// + /// 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 BindToGatewayWithHttpMessagesAsync(string datasetId, BindToGatewayRequest bindToGatewayRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of gateway data sources for the specified dataset + /// from **My workspace**. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated, use [Get + /// Datasources](/rest/api/power-bi/datasets/get-datasources) instead. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetGatewayDatasourcesWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of gateways that the specified dataset from **My + /// workspace** can be bound to. + /// + /// + /// + /// This API call is only relevant to datasets that have at least one + /// on-premises connection. For datasets with cloud-only connections, + /// this API call returns an empty list. + /// + /// ## Required Scope + /// + /// Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> DiscoverGatewaysWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the query scale-out sync status for the specified dataset + /// from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetQueryScaleOutSyncStatusWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Triggers a query scale-out sync of read-only replicas for the + /// specified dataset from **My workspace**. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> TriggerQueryScaleOutSyncWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Grants the specified user's permissions to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the + /// new permissions might not be immediately available through API + /// calls. To refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API + /// call. + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Limitations + /// + /// - Adding permissions to service principals (app principalType) + /// isn't supported + /// - Caller must have ReadReshare permissions on the dataset. + /// - This API call can't be used to grant dataset Write permission on + /// the dataset + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + /// + /// 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 PostDatasetUserInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, PostDatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the existing dataset permissions of the specified user to + /// the specified permissions. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the + /// new permissions might not be immediately available through API + /// calls. To refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API + /// call. + /// This API call can be used to remove all the dataset permissions of + /// the specified user by using `datasetUserAccessRight: None` + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// ## Limitations + /// + /// - Updating permissions to service principals (app principalType) + /// isn't supported + /// - Caller must have ReadWriteReshare permissions on the dataset. + /// That is, folder admins, members and contributors with Reshare + /// permissions, or dataset owners. + /// - This API can't be used to add or remove *write* permission. + /// - This API can't be used to remove folder-level inherited + /// permissions. For folder admins and members, the + /// ReadWriteReshareExplore permission on the folder's datasets is + /// inherited. For folder contributors, the ReadWriteExplore permission + /// on the folder's datasets is inherited. For folder viewers, the Read + /// permission on the folder's datasets is inherited. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + /// + /// 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 PutDatasetUserInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of principals that have access to the specified + /// dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the + /// new permissions might not be immediately available through API + /// calls. To refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API + /// call. + /// + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// ## Limitations + /// + /// Caller must have ReadWriteReshare permissions on the dataset. That + /// is, folder admins, members and contributors with Reshare + /// permissions, or dataset owners. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDatasetUsersInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Grants the specified user's permissions to the specified dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the + /// new permissions might not be immediately available through API + /// calls. To refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API + /// call. + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Limitations + /// + /// - Adding permissions to service principals (app principalType) + /// isn't supported + /// - Caller must have ReadReshare permissions on the dataset. + /// - This API call can't be used to grant dataset Write permission on + /// the dataset + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + /// + /// 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 PostDatasetUserWithHttpMessagesAsync(string datasetId, PostDatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the existing dataset permissions of the specified user to + /// the specified permissions. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the + /// new permissions might not be immediately available through API + /// calls. To refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API + /// call. + /// This API call can be used to remove all the dataset permissions of + /// the specified user by using `datasetUserAccessRight: None` + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// ## Limitations + /// + /// - Updating permissions to service principals (app principalType) + /// isn't supported + /// - Caller must have ReadWriteReshare permissions on the dataset. + /// That is, folder admins, members and contributors with Reshare + /// permissions, or dataset owners. + /// - This API can't be used to add or remove *write* permission. + /// - This API can't be used to remove folder-level inherited + /// permissions. For folder admins and members, the + /// ReadWriteReshareExplore permission on the folder's datasets is + /// inherited. For folder contributors, the ReadWriteExplore permission + /// on the folder's datasets is inherited. For folder viewers, the Read + /// permission on the folder's datasets is inherited. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// Details of user access right + /// + /// + /// 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 PutDatasetUserWithHttpMessagesAsync(string datasetId, DatasetUserAccess userDetails, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of principals that have access to the specified + /// dataset. + /// + /// + /// + /// When user permissions to a dataset have been recently updated, the + /// new permissions might not be immediately available through API + /// calls. To refresh user permissions, use the [Refresh User + /// Permissions](/rest/api/power-bi/users/refresh-user-permissions) API + /// call. + /// + /// ## Permissions + /// + /// The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// ## Limitations + /// + /// Caller must have ReadWriteReshare permissions on the dataset. That + /// is, folder admins, members and contributors with Reshare + /// permissions, or dataset owners. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDatasetUsersWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of datasets from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// 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 + /// + Task> GetDatasetsInGroupWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Creates a new dataset in the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list + /// of limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// Create dataset parameters + /// + /// + /// The default retention policy. Possible values include: 'None', + /// 'basicFIFO' + /// + /// + /// 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> PostDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, CreateDatasetRequest dataset, DefaultRetentionPolicy? defaultRetentionPolicy = default(DefaultRetentionPolicy?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of upstream dataflows for datasets from the + /// specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// 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 + /// + Task> GetDatasetToDataflowsLinksInGroupWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the specified dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the properties for the specified dataset from the specified + /// workspace. + /// + /// + /// + /// ## Permissions + /// + /// The user must be the dataset owner. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Update dataset request parameters + /// + /// + /// 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 UpdateDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, UpdateDatasetRequest updateDatasetRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes the specified dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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 DeleteDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of tables within the specified dataset from the + /// specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list + /// of limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetTablesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the metadata and schema for the specified table within the + /// specified dataset from the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The request message + /// + /// + /// 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> PutTableInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, string tableName, Table requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Adds new data rows to the specified table within the specified + /// dataset from the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - This API call only supports **push datasets**. + /// - See [Power BI REST API + /// limitations](/power-bi/developer/automation/api-rest-api-limitations). + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The table name + /// + /// + /// The request message + /// + /// + /// 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 PostRowsInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, string tableName, PostRowsRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Deletes all rows from the specified table within the specified + /// dataset from the specified workspace. + /// + /// + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// This API call only supports **push datasets**. For a complete list + /// of limitations, see [Push datasets + /// limitations](/power-bi/developer/embedded/push-datasets-limitations). + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The table 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 DeleteRowsInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, string tableName, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the refresh history for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// OneDrive refresh history isn't returned. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The requested number of entries in the refresh history. If not + /// provided, the default is the last available 60 entries. + /// + /// + /// 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> GetRefreshHistoryInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, int? top = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Triggers a refresh for the specified dataset from the specified + /// workspace. An [enhanced + /// refresh](/power-bi/connect-data/asynchronous-refresh) is triggered + /// only if a request payload other than `notifyOption` is set. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - For Shared capacities, a maximum of eight requests per day, + /// including refreshes executed by using scheduled refresh, can be + /// initiated. + /// - For Shared capacities, only `notifyOption` can be specified in + /// the request body. + /// - Enhanced refresh is not supported for shared capacities. + /// - For enhanced refresh, `notifyOption` is not required and must be + /// excluded from the request body. However, one or more parameters + /// other than `notifyOption` are required. + /// - For Premium capacities, the maximum requests per day is only + /// limited by the available resources in the capacity. If available + /// resources are overloaded, refreshes are throttled until the load is + /// reduced. The refresh will fail if throttling exceeds 1 hour. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// + /// + /// 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> RefreshDatasetInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DatasetRefreshRequest datasetRefreshRequest = default(DatasetRefreshRequest), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns execution details of an [enhanced refresh + /// operation](/power-bi/connect-data/asynchronous-refresh) for the + /// specified dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + /// + /// 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 + /// + Task> GetRefreshExecutionDetailsInGroupWithHttpMessagesAsync(System.Guid groupId, System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Cancels the specified refresh operation for the specified dataset + /// from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The refresh ID + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + Task CancelRefreshInGroupWithHttpMessagesAsync(System.Guid groupId, System.Guid datasetId, System.Guid refreshId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the refresh schedule for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the refresh schedule for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// A request that disables the refresh schedule should contain no + /// other changes. + /// + /// At least one day must be specified. If no times are specified, then + /// Power BI will use a default single time per day. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// The limit on the number of time slots per day depends on whether a + /// [Premium](/power-bi/admin/service-premium-what-is) or Shared + /// capacity is used. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Update Refresh Schedule parameters, by specifying all or some of + /// the parameters + /// + /// + /// 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 UpdateRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, RefreshScheduleRequest datasetModelRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetDirectQueryRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the refresh schedule for a specified + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) or + /// [LiveConnection](/power-bi/connect-data/desktop-directquery-about#live-connections) + /// dataset from the specified workspace. + /// + /// + /// + /// A request should contain either a set of days and times *or* a + /// valid frequency, but not both. If you choose a set of days without + /// specifying any times, then Power BI will use a default single time + /// per day. Setting the frequency will automatically overwrite the + /// days and times setting. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Patch DirectQuery or LiveConnection Refresh Schedule parameters, by + /// specifying all or some of the parameters + /// + /// + /// 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 UpdateDirectQueryRefreshScheduleInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DirectQueryRefreshScheduleRequest datasetDQRefreshScheduleRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of parameters for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.Read.All or Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) + /// connections aren't supported. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// 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> GetParametersInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the parameters values for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) + /// with this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - If you're using **enhanced dataset metadata**, refresh the + /// dataset to apply the new parameter values. + /// > - If you're not using **enhanced dataset metadata**, wait 30 + /// minutes for the update data sources operation to complete, and then + /// refresh the dataset. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't + /// supported. To make changes to those data sources, the admin must + /// use the Azure Analysis Services client library for Tabular Object + /// Model. + /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) + /// connections are only supported with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - Datasets with Azure Analysis Services live connections aren't + /// supported. + /// - Maximum of 100 parameters per request. + /// - All specified parameters must exist in the dataset. + /// - Parameters values should be of the expected type. + /// - The parameter list can't be empty or include duplicate + /// parameters. + /// - Parameters names are case-sensitive. + /// - Parameter `IsRequired` must have a non-empty value. + /// - The parameter types `Any` and `Binary` can't be updated. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// + /// + /// 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 UpdateParametersInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, UpdateMashupParametersRequest updateMashupParametersRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of data sources for the specified dataset from the + /// specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// 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> GetDatasourcesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates the data sources of the specified dataset from the + /// specified workspace. + /// + /// + /// + /// > [!NOTE] + /// > We recommend using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) + /// with this API call. + /// + /// > [!IMPORTANT] + /// > + /// > - The original data source and the new data source must have + /// the exact same schema. + /// > - If you're using **enhanced dataset metadata**, refresh the + /// dataset to get data from the new data sources. + /// > - If you're not using **enhanced dataset metadata**, wait 30 + /// minutes for the update data sources operation to complete, and then + /// refresh the dataset. + /// + /// ## Permissions + /// + /// - The user must be the dataset owner. + /// - This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// - Datasets created using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't + /// supported. To make changes to those data sources, the admin must + /// use the Azure Analysis Services client library for Tabular Object + /// Model. + /// - Only these data sources are supported: SQL Server, Azure SQL + /// Server, Azure Analysis Services, Azure Synapse, OData, SharePoint, + /// Teradata, and SAP HANA. For other data sources, use the [Update + /// Parameters In + /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API + /// call. + /// - Changing the data source type isn't supported. + /// - Data sources that contain parameters in the connection string + /// aren't supported. + /// - Updating data sources that are part of merged or joined tables is + /// only supported if you're using [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// - For an Advanced Query that reference multiple data sources, only + /// the first data source will be updated. To overcome this limitation, + /// define the data source as a parameter and use the [Update + /// Parameters In + /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) API + /// call. + /// - Datasets with incremental refresh policy are not fully supported, + /// calling this API may not work as expected and result of partial + /// datasources update, to overcome this you can try run a dataset + /// refresh before calling this API. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// + /// + /// + /// + /// 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 UpdateDatasourcesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, UpdateDatasourcesRequest updateDatasourcesRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Updates all connections for the specified dataset from the + /// specified workspace. This API call only supports SQL DirectQuery + /// datasets. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated and no longer supported. This API + /// call isn't compatible with [enhanced dataset + /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). + /// > + /// > Instead use: + /// > + /// > - [Update Parameters In + /// Group](/rest/api/power-bi/datasets/update-parameters-in-group) to + /// update connections for SQL, Azure Synapse, OData, and SharePoint + /// data sources. + /// > - [Update Datasources In + /// Group](/rest/api/power-bi/datasets/update-datasources-in-group) to + /// connections for other data sources. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Supports SQL DirectQuery datasets. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The body + /// + /// + /// 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 + /// + [System.Obsolete()] + Task SetAllDatasetConnectionsInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, ConnectionDetails parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Binds the specified dataset from the specified workspace to the + /// specified gateway, optionally with a given set of data source IDs. + /// If you don't supply a specific data source ID, the dataset will be + /// bound to the first matching data source in the gateway. + /// + /// + /// + /// > [!IMPORTANT] + /// > Add the API caller principal as a data source user on the + /// gateway. + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The bind to gateway request + /// + /// + /// 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 BindToGatewayInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, BindToGatewayRequest bindToGatewayRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of gateway data sources for the specified dataset + /// from the specified workspace. + /// + /// + /// + /// > [!IMPORTANT] + /// > This API call is deprecated, use [Get Datasources In + /// Group](/rest/api/power-bi/datasets/get-datasources-in-group) + /// instead. + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetGatewayDatasourcesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of gateways that the specified dataset from the + /// specified workspace can be bound to. + /// + /// + /// + /// This API call is only relevant to datasets that have at least one + /// on-premises connection. For datasets with cloud-only connections, + /// this API call returns an empty list. + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> DiscoverGatewaysInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Transfers ownership over the specified dataset to the current + /// authorized user. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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 TakeOverInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Executes Data Analysis Expressions (DAX) queries against the + /// provided dataset. + /// + /// + /// + /// DAX query errors will result in: + /// + /// - A response error, such as `DAX query failure`. + /// - A failure HTTP status code (400). + /// + /// A query that requests more than one table, or more than the allowed + /// number of table rows, will result in: + /// + /// - Limited data being returned. + /// - A response error, such as `More than one result table in a query` + /// or `More than {allowed number} rows in a query result`. + /// - A successful HTTP status code (200). + /// + /// Columns that are fully qualified in the query will be returned with + /// a fully qualified name, for example, `MyTable[MyColumn]`. Columns + /// that are renamed or created in the query will be returned within + /// square bracket, for example, `[MyNewColumn]`. + /// + /// ## Permissions + /// + /// The user must have access to the workspace and dataset read + /// permissions. For more information, see [Manage dataset access + /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// + /// ## Limitations + /// + /// - Datasets that are hosted in Azure Analysis Services or that have + /// a live connection to an on-premises Azure Analysis Services model + /// aren't supported. + /// - The tenant setting **Dataset Execute Queries REST API**, found + /// under **Integration settings**, must be enabled. + /// - One query per API call. + /// - One table request per query. + /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever + /// is hit first). For example if you query for 5 columns, you can get + /// back max 100,000 rows. If you query for 20 columns, you can get + /// back max 50,000 rows (1 million divided by 20). + /// - Maximum of 15MB of data per query. Once 15MB is exceeded, the + /// current row will be completed but no additional rows will be + /// written. + /// - There's a limit of 120 query requests per minute per user, + /// regardless of the dataset that's queried. + /// - Service Principals aren't supported for datasets with RLS per + /// [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or with SSO enabled. To use Service Principals, make sure the admin + /// tenant setting [_Allow service principals to use Power BI + /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) + /// under _Developer settings_ is enabled. + /// - Only DAX queries are supported at this time. MDX and DMV queries + /// are not supported. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// The request message + /// + /// + /// 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> ExecuteQueriesInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, DatasetExecuteQueriesRequest requestMessage, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns the query scale-out sync status for the specified dataset + /// from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> GetQueryScaleOutSyncStatusInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Triggers a query scale-out sync of read-only replicas for the + /// specified dataset from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// 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> TriggerQueryScaleOutSyncInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Generates an embed token based on the specified dataset from the + /// specified workspace. + /// + /// + /// + /// > [!TIP] + /// > To create embed tokens, it's recommended to use the latest + /// API, [Generate + /// Token](/rest/api/power-bi/embed-token/generate-token). Generate + /// token supports additional functions, such as creating a token for + /// multiple items. + /// + /// > [!NOTE] + /// > An embed token can be used to [embed + /// Q&A](/power-bi/developer/qanda) within your application. + /// + /// > [!IMPORTANT] + /// > This API call is only relevant to the [embed for your + /// customers](/power-bi/developer/embed-sample-for-customers) + /// scenario. To learn more about using this API, see [Considerations + /// when generating an embed + /// token](/power-bi/developer/embedded/generate-embed-token). + /// + /// ## Permissions + /// + /// - When using a service principal for authentication, refer to + /// [Embed Power BI content with service + /// principal](/power-bi/developer/embed-service-principal) and + /// [Considerations and + /// limitations](/power-bi/developer/embedded/embed-service-principal#considerations-and-limitations). + /// - This API call can be called by a service principal profile. For + /// more information see: [Service principal profiles in Power BI + /// Embedded](/power-bi/developer/embedded/embed-multi-tenancy). + /// + /// ## Required Scope + /// + /// Dataset.ReadWrite.All or Dataset.Read.All + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The dataset ID + /// + /// + /// Generate token parameters + /// + /// + /// 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> GenerateTokenInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetId, GenerateTokenRequest requestParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of datasets for the organization. + /// + /// + /// + /// Each request takes two seconds to process, during which time other + /// requests are queued. + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 + /// Global Administrator or Power BI Service Administrator) or + /// authenticate using a service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must + /// not** have any admin-consent required premissions for Power BI set + /// on it in the Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin + /// access token. Must not be present when authentication via a service + /// principal is used. + /// <br><br> + /// + /// + /// Filters the results, based on a boolean condition + /// + /// + /// Returns only the first n results + /// + /// + /// Skips the first n results + /// + /// + /// 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 + /// + Task> GetDatasetsAsAdminWithHttpMessagesAsync(string filter = default(string), int? top = default(int?), int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of data sources for the specified dataset. + /// + /// + /// + /// Each request takes 0.5 seconds to process, during which time other + /// requests are queued. + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 + /// Global Administrator or Power BI Service Administrator) or + /// authenticate using a service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must + /// not** have any admin-consent required premissions for Power BI set + /// on it in the Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin + /// access token. Must not be present when authentication via a service + /// principal is used. + /// <br><br> + /// + /// + /// + /// + /// 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> GetDatasourcesAsAdminWithHttpMessagesAsync(string datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of users that have access to the specified dataset. + /// + /// + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 + /// Global Administrator or Power BI Service Administrator) or + /// authenticate using a service principal. + /// - Delegated permissions are supported. + /// - The permissions for this API call are listed in [Datasets + /// permissions](/power-bi/developer/embedded/datasets-permissions). + /// + /// When running under service prinicipal authentication, an app **must + /// not** have any admin-consent required premissions for Power BI set + /// on it in the Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin + /// access token. Must not be present when authentication via a service + /// principal is used. + /// + /// ## Limitations + /// + /// Maximum 200 requests per hour. + /// <br><br> + /// + /// + /// The dataset ID + /// + /// + /// 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 + /// + Task> GetDatasetUsersAsAdminWithHttpMessagesAsync(System.Guid datasetId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of datasets from the specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 + /// Global Administrator or Power BI Service Administrator) or + /// authenticate using a service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must + /// not** have any admin-consent required premissions for Power BI set + /// on it in the Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin + /// access token. Must not be present when authentication via a service + /// principal is used. + /// + /// ## Limitations + /// + /// Maximum 200 requests per hour. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// Filters the results, based on a boolean condition + /// + /// + /// Returns only the first n results + /// + /// + /// Skips the first n results + /// + /// + /// Expands related entities inline + /// + /// + /// 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 + /// + Task> GetDatasetsInGroupAsAdminWithHttpMessagesAsync(System.Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Returns a list of upstream dataflows for datasets from the + /// specified workspace. + /// + /// + /// + /// ## Permissions + /// + /// - The user must have administrator rights (such as Office 365 + /// Global Administrator or Power BI Service Administrator) or + /// authenticate using a service principal. + /// - Delegated permissions are supported. + /// + /// When running under service prinicipal authentication, an app **must + /// not** have any admin-consent required premissions for Power BI set + /// on it in the Azure portal. + /// + /// ## Required Scope + /// + /// Tenant.Read.All or Tenant.ReadWrite.All + /// + /// Relevant only when authenticating via a standard delegated admin + /// access token. Must not be present when authentication via a service + /// principal is used. + /// + /// ## Limitations + /// + /// Maximum 200 requests per hour. + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// 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 + /// + Task> GetDatasetToDataflowsLinksInGroupAsAdminWithHttpMessagesAsync(System.Guid groupId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } +} diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 75f4e768..16064e87 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -6500,7 +6500,7 @@ "Datasets" ], "summary": "Executes Data Analysis Expressions (DAX) queries against the provided dataset.", - "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have dataset read permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- There's a limit of 120 query requests per minute per user, regardless of the dataset that's queried.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", + "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have access to the workspace and dataset read permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- There's a limit of 120 query requests per minute per user, regardless of the dataset that's queried.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", "operationId": "Datasets_ExecuteQueriesInGroup", "consumes": [], "produces": [ From 6efb1b7bee2db8bbce286ee401464ef210ca0f3b Mon Sep 17 00:00:00 2001 From: Mounir Shmordok Date: Tue, 3 Oct 2023 11:26:45 +0000 Subject: [PATCH 09/35] Merged PR 459242: Release SDK version 4.17 Release SDK version 4.17 New Commits 1. Commit 580020dd: Merged PR 449122: Update execute queries permissions docs 2. Commit 92033fbd: Merged PR 446800: Add AuditableContext to the EffectiveIdentity to enable auditing of RLS --- .pipelines/OneBranch.Official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/OneBranch.Official.yml b/.pipelines/OneBranch.Official.yml index 1ecc8f7f..a241b18e 100644 --- a/.pipelines/OneBranch.Official.yml +++ b/.pipelines/OneBranch.Official.yml @@ -28,7 +28,7 @@ variables: ${{ if eq(variables['Build.DefinitionName'], 'PowerBI-CSharp-Official') }}: obpTemplate: v2/OneBranch.Official.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates obpMajor: 4 - obpMinor: 16 + obpMinor: 17 ${{ else }}: obpTemplate: v2/OneBranch.NonOfficial.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates obpMajor: 0 From aea85bf149816f9e6f1635e674ecc2c4f6b9a11a Mon Sep 17 00:00:00 2001 From: Sai Botchu Date: Tue, 24 Oct 2023 22:12:40 +0000 Subject: [PATCH 10/35] Merged PR 462426: Admin API Doc fix for AdminReport and GetRefreshables API 1. Add Original ReportId to AdminReport definition 2. update the description for GetRefreshables As API Related work items: #1161184, #1212484 --- sdk/PowerBI.Api/Source/CapacitiesOperations.cs | 2 +- .../Source/CapacitiesOperationsExtensions.cs | 4 ++-- sdk/PowerBI.Api/Source/ICapacitiesOperations.cs | 3 +-- sdk/PowerBI.Api/Source/Models/AdminReport.cs | 16 +++++++++++++--- sdk/PowerBI.Api/Source/Models/Report.cs | 16 +++++++++++++--- .../Source/Models/ReportBaseProperties.cs | 16 +++++++++++++--- .../Source/Models/WorkspaceInfoReport.cs | 16 +++++++++++++--- sdk/swaggers/swagger.json | 10 ++++++++-- 8 files changed, 64 insertions(+), 19 deletions(-) diff --git a/sdk/PowerBI.Api/Source/CapacitiesOperations.cs b/sdk/PowerBI.Api/Source/CapacitiesOperations.cs index 40dce379..46a8d78f 100644 --- a/sdk/PowerBI.Api/Source/CapacitiesOperations.cs +++ b/sdk/PowerBI.Api/Source/CapacitiesOperations.cs @@ -660,7 +660,7 @@ public CapacitiesOperations(PowerBIClient client) /// /// /// Accepts a comma-separated list of data types, which will be expanded inline - /// in the response. Supports `capacities` and `groups`. + /// in the response. Supports `capacity` and `group`. /// /// /// Filters the results based on a boolean condition diff --git a/sdk/PowerBI.Api/Source/CapacitiesOperationsExtensions.cs b/sdk/PowerBI.Api/Source/CapacitiesOperationsExtensions.cs index 8e7a57de..e00d64bc 100644 --- a/sdk/PowerBI.Api/Source/CapacitiesOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/CapacitiesOperationsExtensions.cs @@ -288,7 +288,7 @@ public static void PatchWorkload(this ICapacitiesOperations operations, System.G /// /// /// Accepts a comma-separated list of data types, which will be expanded inline - /// in the response. Supports `capacities` and `groups`. + /// in the response. Supports `capacity` and `group`. /// /// /// Filters the results based on a boolean condition @@ -324,7 +324,7 @@ public static void PatchWorkload(this ICapacitiesOperations operations, System.G /// /// /// Accepts a comma-separated list of data types, which will be expanded inline - /// in the response. Supports `capacities` and `groups`. + /// in the response. Supports `capacity` and `group`. /// /// /// Filters the results based on a boolean condition diff --git a/sdk/PowerBI.Api/Source/ICapacitiesOperations.cs b/sdk/PowerBI.Api/Source/ICapacitiesOperations.cs index 64628ca9..bd444fa1 100644 --- a/sdk/PowerBI.Api/Source/ICapacitiesOperations.cs +++ b/sdk/PowerBI.Api/Source/ICapacitiesOperations.cs @@ -175,8 +175,7 @@ public partial interface ICapacitiesOperations /// /// /// Accepts a comma-separated list of data types, which will be - /// expanded inline in the response. Supports `capacities` and - /// `groups`. + /// expanded inline in the response. Supports `capacity` and `group`. /// /// /// Filters the results based on a boolean condition diff --git a/sdk/PowerBI.Api/Source/Models/AdminReport.cs b/sdk/PowerBI.Api/Source/Models/AdminReport.cs index 68dcc2ce..215ffdf0 100644 --- a/sdk/PowerBI.Api/Source/Models/AdminReport.cs +++ b/sdk/PowerBI.Api/Source/Models/AdminReport.cs @@ -37,7 +37,9 @@ public AdminReport() /// to an app /// The report description /// The report type. Possible values include: - /// 'PaginatedReport' + /// 'PaginatedReport', 'PowerBIReport' + /// The actual report ID when the + /// workspace is published as an app. /// The web URL of the report /// The embed URL of the report /// The report owner. Available only for @@ -65,7 +67,7 @@ public AdminReport() /// API call. /// The workspace ID (GUID) of the report. /// This property will be returned only in GetReportsAsAdmin. - public AdminReport(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), string webUrl = default(string), string embedUrl = default(string), string createdBy = default(string), string modifiedBy = default(string), System.DateTime? createdDateTime = default(System.DateTime?), System.DateTime? modifiedDateTime = default(System.DateTime?), IList users = default(IList), IList subscriptions = default(IList), System.Guid? workspaceId = default(System.Guid?)) + public AdminReport(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), System.Guid? originalReportId = default(System.Guid?), string webUrl = default(string), string embedUrl = default(string), string createdBy = default(string), string modifiedBy = default(string), System.DateTime? createdDateTime = default(System.DateTime?), System.DateTime? modifiedDateTime = default(System.DateTime?), IList users = default(IList), IList subscriptions = default(IList), System.Guid? workspaceId = default(System.Guid?)) { Id = id; Name = name; @@ -73,6 +75,7 @@ public AdminReport() AppId = appId; Description = description; ReportType = reportType; + OriginalReportId = originalReportId; WebUrl = webUrl; EmbedUrl = embedUrl; CreatedBy = createdBy; @@ -123,11 +126,18 @@ public AdminReport() /// /// Gets or sets the report type. Possible values include: - /// 'PaginatedReport' + /// 'PaginatedReport', 'PowerBIReport' /// [JsonProperty(PropertyName = "reportType")] public string ReportType { get; set; } + /// + /// Gets or sets the actual report ID when the workspace is published + /// as an app. + /// + [JsonProperty(PropertyName = "originalReportId")] + public System.Guid? OriginalReportId { get; set; } + /// /// Gets or sets the web URL of the report /// diff --git a/sdk/PowerBI.Api/Source/Models/Report.cs b/sdk/PowerBI.Api/Source/Models/Report.cs index 1d6cf8f0..495782b9 100644 --- a/sdk/PowerBI.Api/Source/Models/Report.cs +++ b/sdk/PowerBI.Api/Source/Models/Report.cs @@ -36,7 +36,9 @@ public Report() /// to an app /// The report description /// The report type. Possible values include: - /// 'PaginatedReport' + /// 'PaginatedReport', 'PowerBIReport' + /// The actual report ID when the + /// workspace is published as an app. /// The web URL of the report /// The embed URL of the report /// (Empty value) The user access details for a @@ -54,7 +56,7 @@ public Report() /// report by using the [Get Report Subscriptions as /// Admin](/rest/api/power-bi/admin/reports-get-report-subscriptions-as-admin) /// API call. - public Report(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), string webUrl = default(string), string embedUrl = default(string), IList users = default(IList), IList subscriptions = default(IList)) + public Report(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), System.Guid? originalReportId = default(System.Guid?), string webUrl = default(string), string embedUrl = default(string), IList users = default(IList), IList subscriptions = default(IList)) { Id = id; Name = name; @@ -62,6 +64,7 @@ public Report() AppId = appId; Description = description; ReportType = reportType; + OriginalReportId = originalReportId; WebUrl = webUrl; EmbedUrl = embedUrl; Users = users; @@ -107,11 +110,18 @@ public Report() /// /// Gets or sets the report type. Possible values include: - /// 'PaginatedReport' + /// 'PaginatedReport', 'PowerBIReport' /// [JsonProperty(PropertyName = "reportType")] public string ReportType { get; set; } + /// + /// Gets or sets the actual report ID when the workspace is published + /// as an app. + /// + [JsonProperty(PropertyName = "originalReportId")] + public System.Guid? OriginalReportId { get; set; } + /// /// Gets or sets the web URL of the report /// diff --git a/sdk/PowerBI.Api/Source/Models/ReportBaseProperties.cs b/sdk/PowerBI.Api/Source/Models/ReportBaseProperties.cs index 971d2601..2f4b01ff 100644 --- a/sdk/PowerBI.Api/Source/Models/ReportBaseProperties.cs +++ b/sdk/PowerBI.Api/Source/Models/ReportBaseProperties.cs @@ -35,8 +35,10 @@ public ReportBaseProperties() /// to an app /// The report description /// The report type. Possible values include: - /// 'PaginatedReport' - public ReportBaseProperties(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string)) + /// 'PaginatedReport', 'PowerBIReport' + /// The actual report ID when the + /// workspace is published as an app. + public ReportBaseProperties(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), System.Guid? originalReportId = default(System.Guid?)) { Id = id; Name = name; @@ -44,6 +46,7 @@ public ReportBaseProperties() AppId = appId; Description = description; ReportType = reportType; + OriginalReportId = originalReportId; CustomInit(); } @@ -85,11 +88,18 @@ public ReportBaseProperties() /// /// Gets or sets the report type. Possible values include: - /// 'PaginatedReport' + /// 'PaginatedReport', 'PowerBIReport' /// [JsonProperty(PropertyName = "reportType")] public string ReportType { get; set; } + /// + /// Gets or sets the actual report ID when the workspace is published + /// as an app. + /// + [JsonProperty(PropertyName = "originalReportId")] + public System.Guid? OriginalReportId { get; set; } + /// /// Validate the object. /// diff --git a/sdk/PowerBI.Api/Source/Models/WorkspaceInfoReport.cs b/sdk/PowerBI.Api/Source/Models/WorkspaceInfoReport.cs index 7e9c10ee..684fa0b1 100644 --- a/sdk/PowerBI.Api/Source/Models/WorkspaceInfoReport.cs +++ b/sdk/PowerBI.Api/Source/Models/WorkspaceInfoReport.cs @@ -37,7 +37,9 @@ public WorkspaceInfoReport() /// to an app /// The report description /// The report type. Possible values include: - /// 'PaginatedReport' + /// 'PaginatedReport', 'PowerBIReport' + /// The actual report ID when the + /// workspace is published as an app. /// The report owner. Available only for /// reports created after June 2019. /// The last user that modified the @@ -63,7 +65,7 @@ public WorkspaceInfoReport() /// The workspace ID of the related /// dataset, returned only if the related dataset belongs to a /// different workspace - public WorkspaceInfoReport(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), string createdBy = default(string), string modifiedBy = default(string), System.DateTime? createdDateTime = default(System.DateTime?), System.DateTime? modifiedDateTime = default(System.DateTime?), string createdById = default(string), string modifiedById = default(string), EndorsementDetails endorsementDetails = default(EndorsementDetails), SensitivityLabel sensitivityLabel = default(SensitivityLabel), IList users = default(IList), System.Guid? datasetWorkspaceId = default(System.Guid?)) + public WorkspaceInfoReport(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), System.Guid? originalReportId = default(System.Guid?), string createdBy = default(string), string modifiedBy = default(string), System.DateTime? createdDateTime = default(System.DateTime?), System.DateTime? modifiedDateTime = default(System.DateTime?), string createdById = default(string), string modifiedById = default(string), EndorsementDetails endorsementDetails = default(EndorsementDetails), SensitivityLabel sensitivityLabel = default(SensitivityLabel), IList users = default(IList), System.Guid? datasetWorkspaceId = default(System.Guid?)) { Id = id; Name = name; @@ -71,6 +73,7 @@ public WorkspaceInfoReport() AppId = appId; Description = description; ReportType = reportType; + OriginalReportId = originalReportId; CreatedBy = createdBy; ModifiedBy = modifiedBy; CreatedDateTime = createdDateTime; @@ -122,11 +125,18 @@ public WorkspaceInfoReport() /// /// Gets or sets the report type. Possible values include: - /// 'PaginatedReport' + /// 'PaginatedReport', 'PowerBIReport' /// [JsonProperty(PropertyName = "reportType")] public string ReportType { get; set; } + /// + /// Gets or sets the actual report ID when the workspace is published + /// as an app. + /// + [JsonProperty(PropertyName = "originalReportId")] + public System.Guid? OriginalReportId { get; set; } + /// /// Gets or sets the report owner. Available only for reports created /// after June 2019. diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 16064e87..9cf44603 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -11737,7 +11737,7 @@ { "name": "$expand", "in": "query", - "description": "Accepts a comma-separated list of data types, which will be expanded inline in the response. Supports `capacities` and `groups`.", + "description": "Accepts a comma-separated list of data types, which will be expanded inline in the response. Supports `capacity` and `group`.", "required": false, "type": "string" }, @@ -23829,8 +23829,14 @@ "type": "string", "description": "The report type", "enum": [ - "PaginatedReport" + "PaginatedReport", + "PowerBIReport" ] + }, + "originalReportId": { + "type": "string", + "format": "uuid", + "description": "The actual report ID when the workspace is published as an app." } } }, From e2473095c38f86af913ad7ff72961fd03e83e554 Mon Sep 17 00:00:00 2001 From: Megan Kamiya Date: Wed, 1 Nov 2023 06:35:03 +0000 Subject: [PATCH 11/35] Merged PR 473463: Update required permissions for the Execute Dax Queries API This API requires read and build permissions. Updating the docs to reflect that. Confirmed the string changes with PM. --- sdk/PowerBI.Api/Source/DatasetsOperations.cs | 8 ++++---- .../Source/DatasetsOperationsExtensions.cs | 16 ++++++++-------- sdk/PowerBI.Api/Source/IDatasetsOperations.cs | 8 ++++---- sdk/swaggers/swagger.json | 4 ++-- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/sdk/PowerBI.Api/Source/DatasetsOperations.cs b/sdk/PowerBI.Api/Source/DatasetsOperations.cs index 4afe89c6..91fb1a5a 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperations.cs @@ -819,8 +819,8 @@ public DatasetsOperations(PowerBIClient client) /// /// ## Permissions /// - /// The user must have dataset read permissions. For more information, see - /// [Manage dataset access + /// The user must have dataset read and build permissions. For more + /// information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope @@ -9913,8 +9913,8 @@ public DatasetsOperations(PowerBIClient client) /// /// ## Permissions /// - /// The user must have access to the workspace and dataset read permissions. - /// For more information, see [Manage dataset access + /// The user must have access to the workspace, and dataset read and build + /// permissions. For more information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope diff --git a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs index 79ffec0d..3ed6694f 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs @@ -301,8 +301,8 @@ public static void DeleteDataset(this IDatasetsOperations operations, string dat /// /// ## Permissions /// - /// The user must have dataset read permissions. For more information, see - /// [Manage dataset access + /// The user must have dataset read and build permissions. For more + /// information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope @@ -376,8 +376,8 @@ public static DatasetExecuteQueriesResponse ExecuteQueries(this IDatasetsOperati /// /// ## Permissions /// - /// The user must have dataset read permissions. For more information, see - /// [Manage dataset access + /// The user must have dataset read and build permissions. For more + /// information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope @@ -4678,8 +4678,8 @@ public static void TakeOverInGroup(this IDatasetsOperations operations, System.G /// /// ## Permissions /// - /// The user must have access to the workspace and dataset read permissions. - /// For more information, see [Manage dataset access + /// The user must have access to the workspace, and dataset read and build + /// permissions. For more information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope @@ -4756,8 +4756,8 @@ public static DatasetExecuteQueriesResponse ExecuteQueriesInGroup(this IDatasets /// /// ## Permissions /// - /// The user must have access to the workspace and dataset read permissions. - /// For more information, see [Manage dataset access + /// The user must have access to the workspace, and dataset read and build + /// permissions. For more information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope diff --git a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs index 40b901cd..bdeef2c2 100644 --- a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs @@ -196,8 +196,8 @@ public partial interface IDatasetsOperations /// /// ## Permissions /// - /// The user must have dataset read permissions. For more information, - /// see [Manage dataset access + /// The user must have dataset read and build permissions. For more + /// information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope @@ -2646,8 +2646,8 @@ public partial interface IDatasetsOperations /// /// ## Permissions /// - /// The user must have access to the workspace and dataset read - /// permissions. For more information, see [Manage dataset access + /// The user must have access to the workspace, and dataset read and + /// build permissions. For more information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). /// /// ## Required Scope diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 9cf44603..7c559794 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -343,7 +343,7 @@ "Datasets" ], "summary": "Executes Data Analysis Expressions (DAX) queries against the provided dataset. The dataset must reside in **My workspace** or another workspace.", - "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have dataset read permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- There's a limit of 120 query requests per minute per user, regardless of the dataset that's queried.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", + "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have dataset read and build permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- There's a limit of 120 query requests per minute per user, regardless of the dataset that's queried.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", "operationId": "Datasets_ExecuteQueries", "consumes": [], "produces": [ @@ -6500,7 +6500,7 @@ "Datasets" ], "summary": "Executes Data Analysis Expressions (DAX) queries against the provided dataset.", - "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have access to the workspace and dataset read permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- There's a limit of 120 query requests per minute per user, regardless of the dataset that's queried.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", + "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have access to the workspace, and dataset read and build permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- There's a limit of 120 query requests per minute per user, regardless of the dataset that's queried.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", "operationId": "Datasets_ExecuteQueriesInGroup", "consumes": [], "produces": [ From e4051c7b624111c11af6b4f702a624c75bd4341a Mon Sep 17 00:00:00 2001 From: Rahul Roy Date: Mon, 6 Nov 2023 03:49:03 +0000 Subject: [PATCH 12/35] Merged PR 473965: Update Microsoft.Rest.ClientRuntime package to v2.3.24 PR to resolve the issue in #1242972 **Screenshots:** Tests after the changes: ![image.png](https://dev.azure.com/powerbi/4c7b5adb-c2d0-4f18-b23c-edc4ac30f4e1/_apis/git/repositories/4f4b7330-5c73-4eb2-b9cb-d2f4c16debf7/pullRequests/473965/attachments/image.png) Related work items: #1242972, #1244518 --- sdk/PowerBI.Api.Tests/PowerBI.Api.Tests.csproj | 3 ++- sdk/PowerBI.Api.Tests/packages.config | 2 +- sdk/PowerBI.Api/PowerBI.Api.csproj | 2 +- sdk/PowerBI.Api/packages.config | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sdk/PowerBI.Api.Tests/PowerBI.Api.Tests.csproj b/sdk/PowerBI.Api.Tests/PowerBI.Api.Tests.csproj index 9fa30740..b33779eb 100644 --- a/sdk/PowerBI.Api.Tests/PowerBI.Api.Tests.csproj +++ b/sdk/PowerBI.Api.Tests/PowerBI.Api.Tests.csproj @@ -46,7 +46,7 @@ - ..\packages\Microsoft.Rest.ClientRuntime.2.3.0\lib\net45\Microsoft.Rest.ClientRuntime.dll + ..\packages\Microsoft.Rest.ClientRuntime.2.3.24\lib\net461\Microsoft.Rest.ClientRuntime.dll ..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll @@ -62,6 +62,7 @@ + ..\packages\System.Security.Cryptography.Cng.4.7.0\lib\net462\System.Security.Cryptography.Cng.dll diff --git a/sdk/PowerBI.Api.Tests/packages.config b/sdk/PowerBI.Api.Tests/packages.config index 30f9d983..392ab352 100644 --- a/sdk/PowerBI.Api.Tests/packages.config +++ b/sdk/PowerBI.Api.Tests/packages.config @@ -1,6 +1,6 @@  - + diff --git a/sdk/PowerBI.Api/PowerBI.Api.csproj b/sdk/PowerBI.Api/PowerBI.Api.csproj index 8d906289..2d29e9ca 100644 --- a/sdk/PowerBI.Api/PowerBI.Api.csproj +++ b/sdk/PowerBI.Api/PowerBI.Api.csproj @@ -50,7 +50,7 @@ - + diff --git a/sdk/PowerBI.Api/packages.config b/sdk/PowerBI.Api/packages.config index 88890e9f..7ac84c97 100644 --- a/sdk/PowerBI.Api/packages.config +++ b/sdk/PowerBI.Api/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file From 07a9cd0110ed548ad5ef932d501380332d4b77a0 Mon Sep 17 00:00:00 2001 From: Ren Wu Date: Mon, 6 Nov 2023 09:10:06 +0000 Subject: [PATCH 13/35] Merged PR 452321: API doc change regarding RefreshAttempts API doc change regarding RefreshAttempts Related work items: #1190800 --- .../Source/Models/DatasetRefreshDetail.cs | 10 +- sdk/PowerBI.Api/Source/Models/Refresh.cs | 12 +- .../Source/Models/RefreshAttempt.cs | 88 +++++++++++ .../Source/Models/RefreshAttemptType.cs | 107 +++++++++++++ .../Models/RefreshAttemptTypeConverter.cs | 49 ++++++ sdk/swaggers/swagger.json | 147 +++++++++++++++++- 6 files changed, 407 insertions(+), 6 deletions(-) create mode 100644 sdk/PowerBI.Api/Source/Models/RefreshAttempt.cs create mode 100644 sdk/PowerBI.Api/Source/Models/RefreshAttemptType.cs create mode 100644 sdk/PowerBI.Api/Source/Models/RefreshAttemptTypeConverter.cs diff --git a/sdk/PowerBI.Api/Source/Models/DatasetRefreshDetail.cs b/sdk/PowerBI.Api/Source/Models/DatasetRefreshDetail.cs index 89f4584c..dfba3cf1 100644 --- a/sdk/PowerBI.Api/Source/Models/DatasetRefreshDetail.cs +++ b/sdk/PowerBI.Api/Source/Models/DatasetRefreshDetail.cs @@ -53,7 +53,8 @@ public DatasetRefreshDetail() /// request /// An array of engine error or warning messages /// for the refresh request - public DatasetRefreshDetail(System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), string type = default(string), string commitMode = default(string), string status = default(string), string extendedStatus = default(string), string currentRefreshType = default(string), int? numberOfAttempts = default(int?), IList objects = default(IList), IList messages = default(IList)) + /// The refresh attempt list. + public DatasetRefreshDetail(System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), string type = default(string), string commitMode = default(string), string status = default(string), string extendedStatus = default(string), string currentRefreshType = default(string), int? numberOfAttempts = default(int?), IList objects = default(IList), IList messages = default(IList), IList refreshAttempts = default(IList)) { StartTime = startTime; EndTime = endTime; @@ -65,6 +66,7 @@ public DatasetRefreshDetail() NumberOfAttempts = numberOfAttempts; Objects = objects; Messages = messages; + RefreshAttempts = refreshAttempts; CustomInit(); } @@ -145,5 +147,11 @@ public DatasetRefreshDetail() [JsonProperty(PropertyName = "messages")] public IList Messages { get; set; } + /// + /// Gets or sets the refresh attempt list. + /// + [JsonProperty(PropertyName = "refreshAttempts")] + public IList RefreshAttempts { get; set; } + } } diff --git a/sdk/PowerBI.Api/Source/Models/Refresh.cs b/sdk/PowerBI.Api/Source/Models/Refresh.cs index c7af5c97..5ed2fdfb 100644 --- a/sdk/PowerBI.Api/Source/Models/Refresh.cs +++ b/sdk/PowerBI.Api/Source/Models/Refresh.cs @@ -7,6 +7,8 @@ namespace Microsoft.PowerBI.Api.Models { using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; using System.Linq; /// @@ -43,7 +45,8 @@ public Refresh() /// refresh. /// The identifier of the refresh request. /// Provide this identifier in all service requests. - public Refresh(RefreshType? refreshType = default(RefreshType?), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), string serviceExceptionJson = default(string), string status = default(string), string requestId = default(string)) + /// The refresh attempt list. + public Refresh(RefreshType? refreshType = default(RefreshType?), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), string serviceExceptionJson = default(string), string status = default(string), string requestId = default(string), IList refreshAttempts = default(IList)) { RefreshType = refreshType; StartTime = startTime; @@ -51,6 +54,7 @@ public Refresh() ServiceExceptionJson = serviceExceptionJson; Status = status; RequestId = requestId; + RefreshAttempts = refreshAttempts; CustomInit(); } @@ -104,5 +108,11 @@ public Refresh() [JsonProperty(PropertyName = "requestId")] public string RequestId { get; set; } + /// + /// Gets or sets the refresh attempt list. + /// + [JsonProperty(PropertyName = "refreshAttempts")] + public IList RefreshAttempts { get; set; } + } } diff --git a/sdk/PowerBI.Api/Source/Models/RefreshAttempt.cs b/sdk/PowerBI.Api/Source/Models/RefreshAttempt.cs new file mode 100644 index 00000000..e32487ad --- /dev/null +++ b/sdk/PowerBI.Api/Source/Models/RefreshAttempt.cs @@ -0,0 +1,88 @@ +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.PowerBI.Api.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Power BI automatically makes multiple attempts to refresh a dataset if + /// it experiences a refresh failure. This object contains information + /// about each refresh attempt. + /// + public partial class RefreshAttempt + { + /// + /// Initializes a new instance of the RefreshAttempt class. + /// + public RefreshAttempt() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RefreshAttempt class. + /// + /// The index of the refresh attempt. + /// The start date and time of the refresh + /// attempt. + /// The end date and time of the refresh attempt. + /// The value is void if the refresh attempt is in progress. + /// Failure error code in JSON + /// format. Void if there's no error. + /// The type of refresh attempt. Possible values + /// include: 'Data', 'Query' + public RefreshAttempt(int? attemptId = default(int?), System.DateTime? startTime = default(System.DateTime?), System.DateTime? endTime = default(System.DateTime?), string serviceExceptionJson = default(string), RefreshAttemptType? type = default(RefreshAttemptType?)) + { + AttemptId = attemptId; + StartTime = startTime; + EndTime = endTime; + ServiceExceptionJson = serviceExceptionJson; + Type = type; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the index of the refresh attempt. + /// + [JsonProperty(PropertyName = "attemptId")] + public int? AttemptId { get; set; } + + /// + /// Gets or sets the start date and time of the refresh attempt. + /// + [JsonProperty(PropertyName = "startTime")] + public System.DateTime? StartTime { get; set; } + + /// + /// Gets or sets the end date and time of the refresh attempt. The + /// value is void if the refresh attempt is in progress. + /// + [JsonProperty(PropertyName = "endTime")] + public System.DateTime? EndTime { get; set; } + + /// + /// Gets or sets failure error code in JSON format. Void if there's no + /// error. + /// + [JsonProperty(PropertyName = "serviceExceptionJson")] + public string ServiceExceptionJson { get; set; } + + /// + /// Gets or sets the type of refresh attempt. Possible values include: + /// 'Data', 'Query' + /// + [JsonProperty(PropertyName = "type")] + public RefreshAttemptType? Type { get; set; } + + } +} diff --git a/sdk/PowerBI.Api/Source/Models/RefreshAttemptType.cs b/sdk/PowerBI.Api/Source/Models/RefreshAttemptType.cs new file mode 100644 index 00000000..97eb9eb7 --- /dev/null +++ b/sdk/PowerBI.Api/Source/Models/RefreshAttemptType.cs @@ -0,0 +1,107 @@ +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.PowerBI.Api.Models +{ + using Newtonsoft.Json; + + /// + /// Defines values for RefreshAttemptType. + /// + /// + /// Determine base value for a given allowed value if exists, else return + /// the value itself + /// + [JsonConverter(typeof(RefreshAttemptTypeConverter))] + public struct RefreshAttemptType : System.IEquatable + { + private RefreshAttemptType(string underlyingValue) + { + UnderlyingValue=underlyingValue; + } + + /// + /// The refresh attempt to load data into the dataset. + /// + public static readonly RefreshAttemptType Data = "Data"; + + /// + /// The attempt to refresh premium query caches and dashboard tiles.u + /// + public static readonly RefreshAttemptType Query = "Query"; + + + /// + /// Underlying value of enum RefreshAttemptType + /// + private readonly string UnderlyingValue; + + /// + /// Returns string representation for RefreshAttemptType + /// + public override string ToString() + { + return UnderlyingValue.ToString(); + } + + /// + /// Compares enums of type RefreshAttemptType + /// + public bool Equals(RefreshAttemptType e) + { + return UnderlyingValue.Equals(e.UnderlyingValue); + } + + /// + /// Implicit operator to convert string to RefreshAttemptType + /// + public static implicit operator RefreshAttemptType(string value) + { + return new RefreshAttemptType(value); + } + + /// + /// Implicit operator to convert RefreshAttemptType to string + /// + public static implicit operator string(RefreshAttemptType e) + { + return e.UnderlyingValue; + } + + /// + /// Overriding == operator for enum RefreshAttemptType + /// + public static bool operator == (RefreshAttemptType e1, RefreshAttemptType e2) + { + return e2.Equals(e1); + } + + /// + /// Overriding != operator for enum RefreshAttemptType + /// + public static bool operator != (RefreshAttemptType e1, RefreshAttemptType e2) + { + return !e2.Equals(e1); + } + + /// + /// Overrides Equals operator for RefreshAttemptType + /// + public override bool Equals(object obj) + { + return obj is RefreshAttemptType && Equals((RefreshAttemptType)obj); + } + + /// + /// Returns for hashCode RefreshAttemptType + /// + public override int GetHashCode() + { + return UnderlyingValue.GetHashCode(); + } + + } +} diff --git a/sdk/PowerBI.Api/Source/Models/RefreshAttemptTypeConverter.cs b/sdk/PowerBI.Api/Source/Models/RefreshAttemptTypeConverter.cs new file mode 100644 index 00000000..28d5d93d --- /dev/null +++ b/sdk/PowerBI.Api/Source/Models/RefreshAttemptTypeConverter.cs @@ -0,0 +1,49 @@ +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.PowerBI.Api.Models +{ + using Newtonsoft.Json; + + using System.Reflection; + + /// + /// Defines values for RefreshAttemptType. + /// + public sealed class RefreshAttemptTypeConverter : JsonConverter + { + + /// + /// Returns if objectType can be converted to RefreshAttemptType by the + /// converter. + /// + public override bool CanConvert(System.Type objectType) + { + return typeof(RefreshAttemptType).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); + } + + /// + /// Overrides ReadJson and converts token to RefreshAttemptType. + /// + public override object ReadJson(JsonReader reader, System.Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == Newtonsoft.Json.JsonToken.Null) + { + return null; + } + return (RefreshAttemptType)serializer.Deserialize(reader); + } + + /// + /// Overriding WriteJson for RefreshAttemptType for serialization. + /// + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) + { + writer.WriteValue(value.ToString()); + } + + } +} diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 7c559794..6be45d15 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -744,7 +744,21 @@ "startTime": "2017-06-13T09:25:43.153Z", "endTime": "2017-06-13T09:31:43.153Z", "status": "Completed", - "requestId": "9399bb89-25d1-44f8-8576-136d7e9014b1" + "requestId": "9399bb89-25d1-44f8-8576-136d7e9014b1", + "refreshAttempts": [ + { + "attemptId": 1, + "startTime": "2017-06-13T09:25:43.153Z", + "endTime": "2017-06-13T09:31:40.153Z", + "type": "Data" + }, + { + "attemptId": 1, + "startTime": "2017-06-13T09:31:40.156Z", + "endTime": "2017-06-13T09:31:43.153Z", + "type": "Query" + } + ] } ] } @@ -766,7 +780,16 @@ "endTime": "2017-06-13T09:31:43.153Z", "serviceExceptionJson": "{\"errorCode\":\"ModelRefreshFailed_CredentialsNotSpecified\"}", "status": "Failed", - "requestId": "11bf290a-346b-48b7-8973-c5df149337ff" + "requestId": "11bf290a-346b-48b7-8973-c5df149337ff", + "refreshAttempts": [ + { + "attemptId": 1, + "startTime": "2017-06-13T09:25:43.153Z", + "endTime": "2017-06-13T09:31:43.153Z", + "serviceExceptionJson": "{\"errorCode\":\"ModelRefreshFailed_CredentialsNotSpecified\"}", + "type": "Data" + } + ] } ] } @@ -1034,6 +1057,14 @@ "table": "FactInternetSales", "status": "Completed" } + ], + "refreshAttempts": [ + { + "attemptId": 1, + "startTime": "2021-12-10T08:40:31.57", + "endTime": "2021-12-10T08:40:43.87", + "type": "Data" + } ] } } @@ -1060,6 +1091,15 @@ "message": "RefreshApiRequest for table refresh using refresh policy must have the property 'CommitMode' = 'Transactional' instead of 'PartialBatch'.", "type": "Error" } + ], + "refreshAttempts": [ + { + "attemptId": 1, + "startTime": "2021-12-10T08:39:28.517", + "endTime": "2021-12-10T08:39:30.04", + "serviceExceptionJson": "{\"errorCode\":\"ModelRefresh_ShortMessage_ProcessingError\",\"errorDescription\":\"0xC112001C: Expression.Error: Forced Error. . The exception was raised by the IDbCommand interface.\\n0xC112001C: The command has been canceled.. The exception was raised by the IDbCommand interface.\\n0xC11C0006: The current operation was cancelled because another operation in the transaction failed.\\n0xC112001C: The command has been canceled.. The exception was raised by the IDbCommand interface.\\n0xC112001C: The command has been canceled.. The exception was raised by the IDbCommand interface.\\n0xC112001C: The command has been canceled.. The exception was raised by the IDbCommand interface.\"}", + "type": "Data" + } ] } } @@ -4888,7 +4928,21 @@ "startTime": "2017-06-13T09:25:43.153Z", "endTime": "2017-06-13T09:31:43.153Z", "status": "Completed", - "requestId": "9399bb89-25d1-44f8-8576-136d7e9014b1" + "requestId": "9399bb89-25d1-44f8-8576-136d7e9014b1", + "refreshAttempts": [ + { + "attemptId": 1, + "startTime": "2017-06-13T09:25:43.153Z", + "endTime": "2017-06-13T09:31:40.153Z", + "type": "Data" + }, + { + "attemptId": 1, + "startTime": "2017-06-13T09:31:40.156Z", + "endTime": "2017-06-13T09:31:43.153Z", + "type": "Query" + } + ] } ] } @@ -4910,7 +4964,16 @@ "endTime": "2017-06-13T09:31:43.153Z", "serviceExceptionJson": "{\"errorCode\":\"ModelRefreshFailed_CredentialsNotSpecified\"}", "status": "Failed", - "requestId": "11bf290a-346b-48b7-8973-c5df149337ff" + "requestId": "11bf290a-346b-48b7-8973-c5df149337ff", + "refreshAttempts": [ + { + "attemptId": 1, + "startTime": "2017-06-13T09:25:43.153Z", + "endTime": "2017-06-13T09:31:43.153Z", + "serviceExceptionJson": "{\"errorCode\":\"ModelRefreshFailed_CredentialsNotSpecified\"}", + "type": "Data" + } + ] } ] } @@ -5197,6 +5260,14 @@ "table": "FactInternetSales", "status": "Completed" } + ], + "refreshAttempts": [ + { + "attemptId": 1, + "startTime": "2021-12-10T08:40:31.57", + "endTime": "2021-12-10T08:40:43.87", + "type": "Data" + } ] } } @@ -5224,6 +5295,15 @@ "message": "RefreshApiRequest for table refresh using refresh policy must have the property 'CommitMode' = 'Transactional' instead of 'PartialBatch'.", "type": "Error" } + ], + "refreshAttempts": [ + { + "attemptId": 1, + "startTime": "2021-12-10T08:39:28.517", + "endTime": "2021-12-10T08:39:30.04", + "serviceExceptionJson": "{\"errorCode\":\"ModelRefresh_ShortMessage_ProcessingError\",\"errorDescription\":\"0xC112001C: Expression.Error: Forced Error. . The exception was raised by the IDbCommand interface.\\n0xC112001C: The command has been canceled.. The exception was raised by the IDbCommand interface.\\n0xC11C0006: The current operation was cancelled because another operation in the transaction failed.\\n0xC112001C: The command has been canceled.. The exception was raised by the IDbCommand interface.\\n0xC112001C: The command has been canceled.. The exception was raised by the IDbCommand interface.\\n0xC112001C: The command has been canceled.. The exception was raised by the IDbCommand interface.\"}", + "type": "Data" + } ] } } @@ -25084,6 +25164,58 @@ "requestId": { "type": "string", "description": "The identifier of the refresh request. Provide this identifier in all service requests." + }, + "refreshAttempts": { + "type": "array", + "description": "The refresh attempt list.", + "items": { + "$ref": "#/definitions/RefreshAttempt" + } + } + } + }, + "RefreshAttempt": { + "description": "Power BI automatically makes multiple attempts to refresh a dataset if it experiences a refresh failure. This object contains information about each refresh attempt.", + "properties": { + "attemptId": { + "type": "integer", + "description": "The index of the refresh attempt." + }, + "startTime": { + "type": "string", + "format": "date-time", + "description": "The start date and time of the refresh attempt." + }, + "endTime": { + "type": "string", + "format": "date-time", + "description": "The end date and time of the refresh attempt. The value is void if the refresh attempt is in progress." + }, + "serviceExceptionJson": { + "type": "string", + "description": "Failure error code in JSON format. Void if there's no error." + }, + "type": { + "type": "string", + "description": "The type of refresh attempt.", + "enum": [ + "Data", + "Query" + ], + "x-ms-enum": { + "name": "RefreshAttemptType", + "modelAsExtensible": true, + "values": [ + { + "value": "Data", + "description": "The refresh attempt to load data into the dataset." + }, + { + "value": "Query", + "description": "The attempt to refresh premium query caches and dashboard tiles.u" + } + ] + } } } }, @@ -25389,6 +25521,13 @@ "items": { "$ref": "#/definitions/EngineMessage" } + }, + "refreshAttempts": { + "type": "array", + "description": "The refresh attempt list.", + "items": { + "$ref": "#/definitions/RefreshAttempt" + } } } }, From 466304f8003c680f6e367399c36232f0da75ea6a Mon Sep 17 00:00:00 2001 From: Sai Botchu Date: Mon, 6 Nov 2023 19:51:35 +0000 Subject: [PATCH 14/35] Merged PR 473663: Update support for SG and SP Add\Delete User from workspace Support for Groups and service Principals for the Admin APIs POST /groups/{groupId}/users and DELETE /groups/{groupId}/users/{userID} --- sdk/PowerBI.Api/Source/GroupsOperations.cs | 25 +++++-- .../Source/GroupsOperationsExtensions.cs | 44 +++++++++---- sdk/PowerBI.Api/Source/IGroupsOperations.cs | 21 ++++-- sdk/swaggers/swagger.json | 66 +++++++++++++++++-- 4 files changed, 123 insertions(+), 33 deletions(-) diff --git a/sdk/PowerBI.Api/Source/GroupsOperations.cs b/sdk/PowerBI.Api/Source/GroupsOperations.cs index 9d3de011..9643fded 100644 --- a/sdk/PowerBI.Api/Source/GroupsOperations.cs +++ b/sdk/PowerBI.Api/Source/GroupsOperations.cs @@ -2856,7 +2856,8 @@ public GroupsOperations(PowerBIClient client) /// /// /// - /// This API call only supports adding a user principle. + /// This API call only supports adding a user, security group, M365 group and + /// service principal. /// /// ## Permissions /// @@ -3008,7 +3009,9 @@ public GroupsOperations(PowerBIClient client) ///
/// /// - /// This API call only supports adding a user principle. + /// This API call supports removing a user, security group, M365 group and + /// service principal.Please use email address or UPN for user, group object Id + /// for group and app object Id for service principal to delete. /// /// ## Permissions /// @@ -3025,13 +3028,18 @@ public GroupsOperations(PowerBIClient client) /// <br><br> /// /// - /// The workspace ID + /// The workspace ID. /// /// - /// The user principal name (UPN) of the user to remove + /// The user principal name (UPN) of the user or group object Id of the group + /// or app object Id of the service principal to delete. /// /// - /// The service principal profile ID to delete + /// The service principal profile ID to delete. + /// + /// + /// Whether a given user is a group or not. This parameter is required when + /// user to delete is group. /// /// /// Headers that will be added to request. @@ -3051,7 +3059,7 @@ public GroupsOperations(PowerBIClient client) /// /// A response object containing the response body and response headers. /// - public async Task DeleteUserAsAdminWithHttpMessagesAsync(System.Guid groupId, string user, System.Guid? profileId = default(System.Guid?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task DeleteUserAsAdminWithHttpMessagesAsync(System.Guid groupId, string user, System.Guid? profileId = default(System.Guid?), bool? isGroup = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (user == null) { @@ -3067,6 +3075,7 @@ public GroupsOperations(PowerBIClient client) tracingParameters.Add("groupId", groupId); tracingParameters.Add("user", user); tracingParameters.Add("profileId", profileId); + tracingParameters.Add("isGroup", isGroup); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "DeleteUserAsAdmin", tracingParameters); } @@ -3080,6 +3089,10 @@ public GroupsOperations(PowerBIClient client) { _queryParameters.Add(string.Format("profileId={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(profileId, Client.SerializationSettings).Trim('"')))); } + if (isGroup != null) + { + _queryParameters.Add(string.Format("isGroup={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(isGroup, Client.SerializationSettings).Trim('"')))); + } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); diff --git a/sdk/PowerBI.Api/Source/GroupsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/GroupsOperationsExtensions.cs index 4bed590a..08f2bc12 100644 --- a/sdk/PowerBI.Api/Source/GroupsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/GroupsOperationsExtensions.cs @@ -1363,7 +1363,8 @@ public static GroupUsers GetGroupUsersAsAdmin(this IGroupsOperations operations, /// /// /// - /// This API call only supports adding a user principle. + /// This API call only supports adding a user, security group, M365 group and + /// service principal. /// /// ## Permissions /// @@ -1398,7 +1399,8 @@ public static void AddUserAsAdmin(this IGroupsOperations operations, System.Guid /// /// /// - /// This API call only supports adding a user principle. + /// This API call only supports adding a user, security group, M365 group and + /// service principal. /// /// ## Permissions /// @@ -1436,7 +1438,9 @@ public static void AddUserAsAdmin(this IGroupsOperations operations, System.Guid /// /// /// - /// This API call only supports adding a user principle. + /// This API call supports removing a user, security group, M365 group and + /// service principal.Please use email address or UPN for user, group object Id + /// for group and app object Id for service principal to delete. /// /// ## Permissions /// @@ -1456,17 +1460,22 @@ public static void AddUserAsAdmin(this IGroupsOperations operations, System.Guid /// The operations group for this extension method. /// /// - /// The workspace ID + /// The workspace ID. /// /// - /// The user principal name (UPN) of the user to remove + /// The user principal name (UPN) of the user or group object Id of the group + /// or app object Id of the service principal to delete. /// /// - /// The service principal profile ID to delete + /// The service principal profile ID to delete. /// - public static void DeleteUserAsAdmin(this IGroupsOperations operations, System.Guid groupId, string user, System.Guid? profileId = default(System.Guid?)) + /// + /// Whether a given user is a group or not. This parameter is required when + /// user to delete is group. + /// + public static void DeleteUserAsAdmin(this IGroupsOperations operations, System.Guid groupId, string user, System.Guid? profileId = default(System.Guid?), bool? isGroup = default(bool?)) { - operations.DeleteUserAsAdminAsync(groupId, user, profileId).GetAwaiter().GetResult(); + operations.DeleteUserAsAdminAsync(groupId, user, profileId, isGroup).GetAwaiter().GetResult(); } /// @@ -1474,7 +1483,9 @@ public static void AddUserAsAdmin(this IGroupsOperations operations, System.Guid /// /// /// - /// This API call only supports adding a user principle. + /// This API call supports removing a user, security group, M365 group and + /// service principal.Please use email address or UPN for user, group object Id + /// for group and app object Id for service principal to delete. /// /// ## Permissions /// @@ -1494,20 +1505,25 @@ public static void AddUserAsAdmin(this IGroupsOperations operations, System.Guid /// The operations group for this extension method. /// /// - /// The workspace ID + /// The workspace ID. /// /// - /// The user principal name (UPN) of the user to remove + /// The user principal name (UPN) of the user or group object Id of the group + /// or app object Id of the service principal to delete. /// /// - /// The service principal profile ID to delete + /// The service principal profile ID to delete. + /// + /// + /// Whether a given user is a group or not. This parameter is required when + /// user to delete is group. /// /// /// The cancellation token. /// - public static async Task DeleteUserAsAdminAsync(this IGroupsOperations operations, System.Guid groupId, string user, System.Guid? profileId = default(System.Guid?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task DeleteUserAsAdminAsync(this IGroupsOperations operations, System.Guid groupId, string user, System.Guid? profileId = default(System.Guid?), bool? isGroup = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) { - (await operations.DeleteUserAsAdminWithHttpMessagesAsync(groupId, user, profileId, null, cancellationToken).ConfigureAwait(false)).Dispose(); + (await operations.DeleteUserAsAdminWithHttpMessagesAsync(groupId, user, profileId, isGroup, null, cancellationToken).ConfigureAwait(false)).Dispose(); } /// diff --git a/sdk/PowerBI.Api/Source/IGroupsOperations.cs b/sdk/PowerBI.Api/Source/IGroupsOperations.cs index 8893b721..80957da1 100644 --- a/sdk/PowerBI.Api/Source/IGroupsOperations.cs +++ b/sdk/PowerBI.Api/Source/IGroupsOperations.cs @@ -760,7 +760,8 @@ public partial interface IGroupsOperations /// /// /// - /// This API call only supports adding a user principle. + /// This API call only supports adding a user, security group, M365 + /// group and service principal. /// /// ## Permissions /// @@ -800,7 +801,10 @@ public partial interface IGroupsOperations /// /// /// - /// This API call only supports adding a user principle. + /// This API call supports removing a user, security group, M365 group + /// and service principal.Please use email address or UPN for user, + /// group object Id for group and app object Id for service principal + /// to delete. /// /// ## Permissions /// @@ -817,13 +821,18 @@ public partial interface IGroupsOperations /// <br><br> /// /// - /// The workspace ID + /// The workspace ID. /// /// - /// The user principal name (UPN) of the user to remove + /// The user principal name (UPN) of the user or group object Id of the + /// group or app object Id of the service principal to delete. /// /// - /// The service principal profile ID to delete + /// The service principal profile ID to delete. + /// + /// + /// Whether a given user is a group or not. This parameter is required + /// when user to delete is group. /// /// /// The headers that will be added to request. @@ -837,7 +846,7 @@ public partial interface IGroupsOperations /// /// Thrown when a required parameter is null /// - Task DeleteUserAsAdminWithHttpMessagesAsync(System.Guid groupId, string user, System.Guid? profileId = default(System.Guid?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task DeleteUserAsAdminWithHttpMessagesAsync(System.Guid groupId, string user, System.Guid? profileId = default(System.Guid?), bool? isGroup = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Restores a deleted workspace. /// diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 6be45d15..d81ffd67 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -15410,7 +15410,7 @@ "Admin" ], "summary": "Grants user permissions to the specified workspace.", - "description": "\nThis API call only supports adding a user principle.\n\n## Permissions\n\nThe user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator).\n\n## Required Scope\n\nTenant.ReadWrite.All\n\n## Limitations\n\nMaximum 200 requests per hour.\n

", + "description": "\nThis API call only supports adding a user, security group, M365 group and service principal.\n\n## Permissions\n\nThe user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator).\n\n## Required Scope\n\nTenant.ReadWrite.All\n\n## Limitations\n\nMaximum 200 requests per hour.\n

", "operationId": "Groups_AddUserAsAdmin", "consumes": [ "application/json" @@ -15441,7 +15441,7 @@ } }, "x-ms-examples": { - "Example": { + "Add user to group example": { "parameters": { "groupId": "206d27ca-94e8-4a69-855b-5c32bdd458a8", "userDetails": { @@ -15452,6 +15452,32 @@ "responses": { "200": {} } + }, + "Add eecurity group to workspace example": { + "parameters": { + "groupId": "206d27ca-94e8-4a69-855b-5c32bdd458a8", + "userDetails": { + "identifier": "ece007fa-2f19-4df1-bdd5-539881ec5f83", + "principalType": "Group", + "groupUserAccessRight": "Member" + } + }, + "responses": { + "200": {} + } + }, + "Add service principal to workspace example": { + "parameters": { + "groupId": "206d27ca-94e8-4a69-855b-5c32bdd458a8", + "userDetails": { + "identifier": "84c468ad-12f1-471e-af6f-0999da422391", + "principalType": "App", + "groupUserAccessRight": "Viewer" + } + }, + "responses": { + "200": {} + } } }, "deprecated": false @@ -15463,7 +15489,7 @@ "Admin" ], "summary": "Removes user permissions from the specified workspace.", - "description": "\nThis API call only supports adding a user principle.\n\n## Permissions\n\nThe user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator).\n\n## Required Scope\n\nTenant.ReadWrite.All\n\n## Limitations\n\nMaximum 200 requests per hour.\n

", + "description": "\nThis API call supports removing a user, security group, M365 group and service principal.Please use email address or UPN for user, group object Id for group and app object Id for service principal to delete.\n\n## Permissions\n\nThe user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator).\n\n## Required Scope\n\nTenant.ReadWrite.All\n\n## Limitations\n\nMaximum 200 requests per hour.\n

", "operationId": "Groups_DeleteUserAsAdmin", "consumes": [], "produces": [], @@ -15472,7 +15498,7 @@ "name": "groupId", "in": "path", "required": true, - "description": "The workspace ID", + "description": "The workspace ID.", "type": "string", "format": "uuid" }, @@ -15480,16 +15506,23 @@ "name": "user", "in": "path", "required": true, - "description": "The user principal name (UPN) of the user to remove", + "description": "The user principal name (UPN) of the user or group object Id of the group or app object Id of the service principal to delete.", "type": "string" }, { "name": "profileId", "in": "query", - "description": "The service principal profile ID to delete", + "description": "The service principal profile ID to delete.", "required": false, "type": "string", "format": "uuid" + }, + { + "name": "isGroup", + "in": "query", + "description": "Whether a given user is a group or not. This parameter is required when user to delete is group.", + "required": false, + "type": "boolean" } ], "responses": { @@ -15498,7 +15531,7 @@ } }, "x-ms-examples": { - "Example": { + "Delete user example": { "parameters": { "groupId": "f7d76f5a-7190-43c6-bf12-7a135c6c2d69", "user": "john@contoso.com" @@ -15506,6 +15539,25 @@ "responses": { "200": {} } + }, + "Delete group example": { + "parameters": { + "groupId": "f7d76f5a-7190-43c6-bf12-7a135c6c2d23", + "user": "23476f5a-7190-43c6-bf12-7a135c6c2d23", + "isGroup": true + }, + "responses": { + "200": {} + } + }, + "Delete service principal example": { + "parameters": { + "groupId": "f7d76f5a-7190-43c6-bf12-7a135c6c2d23", + "user": "23476f5a-7190-43c6-bf12-7a135c6c2d23" + }, + "responses": { + "200": {} + } } }, "deprecated": false From 52961650ebea9ca89b9e0cb4049f268548d13598 Mon Sep 17 00:00:00 2001 From: Alon Yeshurun Date: Wed, 8 Nov 2023 09:51:08 +0000 Subject: [PATCH 15/35] Merged PR 465527: GetRefreshHistory description update Added explanation of number of refresh entries to GetRefreshHistory --- sdk/PowerBI.Api/Source/DatasetsOperations.cs | 6 ++++++ .../Source/DatasetsOperationsExtensions.cs | 12 ++++++++++++ sdk/PowerBI.Api/Source/IDatasetsOperations.cs | 7 +++++++ sdk/swaggers/swagger.json | 2 +- 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/sdk/PowerBI.Api/Source/DatasetsOperations.cs b/sdk/PowerBI.Api/Source/DatasetsOperations.cs index 91fb1a5a..949b40a4 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperations.cs @@ -1658,6 +1658,12 @@ public DatasetsOperations(PowerBIClient client) /// ## Limitations /// /// OneDrive refresh history isn't returned. + /// + /// There are always between 20–60 available refresh history entries for each + /// dataset, depending on the number of refreshes in the last 3 days. + /// The most recent 60 are kept if they are all less than 3 days old. + /// Entries more than 3 days old are deleted when there are more than 20 + /// entries. /// <br><br> ///
/// diff --git a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs index 3ed6694f..7a1833de 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs @@ -712,6 +712,12 @@ public static void DeleteRows(this IDatasetsOperations operations, string datase /// ## Limitations /// /// OneDrive refresh history isn't returned. + /// + /// There are always between 20–60 available refresh history entries for each + /// dataset, depending on the number of refreshes in the last 3 days. + /// The most recent 60 are kept if they are all less than 3 days old. + /// Entries more than 3 days old are deleted when there are more than 20 + /// entries. /// <br><br> ///
/// @@ -742,6 +748,12 @@ public static void DeleteRows(this IDatasetsOperations operations, string datase /// ## Limitations /// /// OneDrive refresh history isn't returned. + /// + /// There are always between 20–60 available refresh history entries for each + /// dataset, depending on the number of refreshes in the last 3 days. + /// The most recent 60 are kept if they are all less than 3 days old. + /// Entries more than 3 days old are deleted when there are more than 20 + /// entries. /// <br><br> ///
/// diff --git a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs index bdeef2c2..a045ea21 100644 --- a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs @@ -419,6 +419,13 @@ public partial interface IDatasetsOperations /// ## Limitations /// /// OneDrive refresh history isn't returned. + /// + /// There are always between 20–60 available refresh history entries + /// for each dataset, depending on the number of refreshes in the last + /// 3 days. + /// The most recent 60 are kept if they are all less than 3 days old. + /// Entries more than 3 days old are deleted when there are more than + /// 20 entries. /// <br><br> ///
/// diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index d81ffd67..1cd29003 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -678,7 +678,7 @@ "Datasets" ], "summary": "Returns the refresh history for the specified dataset from **My workspace**.", - "description": "\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\nOneDrive refresh history isn't returned.\n

", + "description": "\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\nOneDrive refresh history isn't returned.\n\nThere are always between 20–60 available refresh history entries for each dataset, depending on the number of refreshes in the last 3 days. \nThe most recent 60 are kept if they are all less than 3 days old. \nEntries more than 3 days old are deleted when there are more than 20 entries.\n

", "operationId": "Datasets_GetRefreshHistory", "consumes": [], "produces": [ From 6b21c489b34fc9caa405272787e0ee84ed1a99f3 Mon Sep 17 00:00:00 2001 From: Megan Kamiya Date: Thu, 16 Nov 2023 16:42:21 +0000 Subject: [PATCH 16/35] Merged PR 476214: Updated OneBranch.Official.yml to 4.18.0 Updated version to 4.18.0 --- .pipelines/OneBranch.Official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/OneBranch.Official.yml b/.pipelines/OneBranch.Official.yml index a241b18e..261c0c88 100644 --- a/.pipelines/OneBranch.Official.yml +++ b/.pipelines/OneBranch.Official.yml @@ -28,7 +28,7 @@ variables: ${{ if eq(variables['Build.DefinitionName'], 'PowerBI-CSharp-Official') }}: obpTemplate: v2/OneBranch.Official.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates obpMajor: 4 - obpMinor: 17 + obpMinor: 18 ${{ else }}: obpTemplate: v2/OneBranch.NonOfficial.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates obpMajor: 0 From f8ebbc965736cba9d9ed476dcf74062c60a4c275 Mon Sep 17 00:00:00 2001 From: Sheik Badhusha Mahaboob Basha Date: Tue, 21 Nov 2023 07:04:53 +0000 Subject: [PATCH 17/35] Merged PR 477196: Pull Request: TSA Integration - PowerBI-CSharp Repo As part of this PR, tsa has been added and enabled to Official pipeline. Kindly refer the files changed for more details. Test run with PR pipeline : https://dev.azure.com/powerbi/Embedded/_build/results?buildId=8415876&view=logs&j=15dfcb1a-0989-5cf6-3160-3e181e44de87&t=482c0fb4-b418-5769-a05a-f38dfb422c52 --- .config/tsaoptions.json | 14 ++++++++++++++ .pipelines/OneBranch.Official.yml | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .config/tsaoptions.json diff --git a/.config/tsaoptions.json b/.config/tsaoptions.json new file mode 100644 index 00000000..e0d7c29d --- /dev/null +++ b/.config/tsaoptions.json @@ -0,0 +1,14 @@ +{ + "codebaseName": "PowerBI-CSharp", + "instanceUrl": "https://powerbi.visualstudio.com", + "projectName": "Trident", + "areaPath" : "Trident\\ISV and ALM\\Embedded", + "iterationPath": "Trident\\Releases", + "notificationAliases": [ + "corembed@microsoft.com" + ], + "codebaseAdmins": [ + "redmond\\corembed" + ], + "ignoreBranchName": true +} \ No newline at end of file diff --git a/.pipelines/OneBranch.Official.yml b/.pipelines/OneBranch.Official.yml index 261c0c88..38529d19 100644 --- a/.pipelines/OneBranch.Official.yml +++ b/.pipelines/OneBranch.Official.yml @@ -48,7 +48,7 @@ extends: parameters: globalSdl: # https://aka.ms/obpipelines/sdl tsa: - enabled: false + enabled: true cg: failOnAlert: false From 3f13f7fa199728a0db9a65fcb01b6c483bb92487 Mon Sep 17 00:00:00 2001 From: Sai Botchu Date: Mon, 4 Dec 2023 23:34:44 +0000 Subject: [PATCH 18/35] Merged PR 486682: Typo for Security Group update word eecurity -> security Add examples for Guestt user --- sdk/swaggers/swagger.json | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 1cd29003..d37b4f7c 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -15453,7 +15453,7 @@ "200": {} } }, - "Add eecurity group to workspace example": { + "Add security group to workspace example": { "parameters": { "groupId": "206d27ca-94e8-4a69-855b-5c32bdd458a8", "userDetails": { @@ -15558,6 +15558,15 @@ "responses": { "200": {} } + }, + "Delete guest user example": { + "parameters": { + "groupId": "f7d76f5a-7190-43c6-bf12-7a135c6c2d23", + "user": "john_contoso.com%23EXT%23@test.com" + }, + "responses": { + "200": {} + } } }, "deprecated": false @@ -18583,7 +18592,28 @@ } } } - } + }, + "Example with Guest User": { + "parameters": { + "userId": "testUser_microsoft.com%23EXT%23@contoso.com" + }, + "responses": { + "200": { + "body": { + "artifactAccessEntities": [ + { + "artifactId": "41ce06d1-d81b-4ea0-bc6d-2ce3dd2f8e87", + "displayName": "test report", + "artifactType": "Report", + "accessRight": "ReadWrite" + } + ], + "continuationUri": "https://api.powerbi.com/v1.0/myorg/admin/users/testUser_microsoft.com%23EXT%23%40contoso.com/artifactAccess?continuationToken='LDEsMTAwMDAwLDA%3D'", + "continuationToken": "LDEsMTAwMDAwLDA%3D" + } + } + } + }, }, "deprecated": false } From defb446caa8b9c17754194deb246af63c62fd338 Mon Sep 17 00:00:00 2001 From: Che An Lu Date: Tue, 26 Dec 2023 01:50:07 +0000 Subject: [PATCH 19/35] Merged PR 496892: Clarify the impact when using partialBatch commit mode Clarify the impact when using partialBatch commit mode Related work items: #1231177 --- sdk/PowerBI.Api/Source/Models/DatasetCommitMode.cs | 9 ++++++++- sdk/swaggers/swagger.json | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sdk/PowerBI.Api/Source/Models/DatasetCommitMode.cs b/sdk/PowerBI.Api/Source/Models/DatasetCommitMode.cs index 2a84f84b..c6f84e2d 100644 --- a/sdk/PowerBI.Api/Source/Models/DatasetCommitMode.cs +++ b/sdk/PowerBI.Api/Source/Models/DatasetCommitMode.cs @@ -29,7 +29,14 @@ private DatasetCommitMode(string underlyingValue) public static readonly DatasetCommitMode Transactional = "Transactional"; /// - /// Commit the refresh operation in batches + /// Commit the refresh operation in batches. When utilizing + /// `partialBatch` mode, the refresh operation does not occur within a + /// transaction. Consequently, each command will be committed + /// individually, and in the event of a failure, the model may end up + /// in a state where only a subset of the data is loaded, or the table + /// is left empty. If you desire to guarantee the preservation of + /// previous data in case of a failure, you should execute the + /// operation with `commitMode = transactional.` /// public static readonly DatasetCommitMode PartialBatch = "PartialBatch"; diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index d37b4f7c..56360e55 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -18613,7 +18613,7 @@ } } } - }, + } }, "deprecated": false } @@ -25425,7 +25425,7 @@ }, { "value": "PartialBatch", - "description": "Commit the refresh operation in batches" + "description": "Commit the refresh operation in batches. When utilizing `partialBatch` mode, the refresh operation does not occur within a transaction. Consequently, each command will be committed individually, and in the event of a failure, the model may end up in a state where only a subset of the data is loaded, or the table is left empty. If you desire to guarantee the preservation of previous data in case of a failure, you should execute the operation with `commitMode = transactional.`" } ] } From 073cb4207766b2250e11ea452f9300de78333750 Mon Sep 17 00:00:00 2001 From: Megan Kamiya Date: Sun, 21 Jan 2024 07:01:43 +0000 Subject: [PATCH 20/35] Merged PR 505440: Update Execute Queries limitations wording Update Execute Queries limitations wording to be more clear about when SPNs are supported per PM suggestion. Also moved the tenant setting requirement to the permissions section to make it more obvious (since this isn't really a limitation). Related work items: #1298489 --- sdk/PowerBI.Api/Source/DatasetsOperations.cs | 34 ++++++---- .../Source/DatasetsOperationsExtensions.cs | 68 +++++++++++-------- sdk/swaggers/swagger.json | 4 +- 3 files changed, 62 insertions(+), 44 deletions(-) diff --git a/sdk/PowerBI.Api/Source/DatasetsOperations.cs b/sdk/PowerBI.Api/Source/DatasetsOperations.cs index 949b40a4..bbfa5be2 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperations.cs @@ -819,6 +819,9 @@ public DatasetsOperations(PowerBIClient client) /// /// ## Permissions /// + /// The tenant setting **Dataset Execute Queries REST API**, found under + /// **Integration settings**, must be enabled. + /// /// The user must have dataset read and build permissions. For more /// information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). @@ -832,8 +835,6 @@ public DatasetsOperations(PowerBIClient client) /// - Datasets that are hosted in Azure Analysis Services or that have a live /// connection to an on-premises Azure Analysis Services model aren't /// supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found under - /// **Integration settings**, must be enabled. /// - One query per API call. /// - One table request per query. /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit @@ -844,12 +845,14 @@ public DatasetsOperations(PowerBIClient client) /// will be completed but no additional rows will be written. /// - There's a limit of 120 query requests per minute per user, regardless of /// the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin tenant - /// setting [_Allow service principals to use Power BI + /// - To use Service Principals, make sure the admin tenant setting [_Allow + /// service principals to use Power BI /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. + /// under _Developer settings_ is enabled. However, regardless of the admin + /// tenant setting, Service Principals aren't supported for datasets with RLS + /// per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or datasets with SSO enabled. /// - Only DAX queries are supported at this time. MDX and DMV queries are not /// supported. /// <br><br> @@ -9919,6 +9922,9 @@ public DatasetsOperations(PowerBIClient client) /// /// ## Permissions /// + /// The tenant setting **Dataset Execute Queries REST API**, found under + /// **Integration settings**, must be enabled. + /// /// The user must have access to the workspace, and dataset read and build /// permissions. For more information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). @@ -9932,8 +9938,6 @@ public DatasetsOperations(PowerBIClient client) /// - Datasets that are hosted in Azure Analysis Services or that have a live /// connection to an on-premises Azure Analysis Services model aren't /// supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found under - /// **Integration settings**, must be enabled. /// - One query per API call. /// - One table request per query. /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit @@ -9944,12 +9948,14 @@ public DatasetsOperations(PowerBIClient client) /// will be completed but no additional rows will be written. /// - There's a limit of 120 query requests per minute per user, regardless of /// the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin tenant - /// setting [_Allow service principals to use Power BI + /// - To use Service Principals, make sure the admin tenant setting [_Allow + /// service principals to use Power BI /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. + /// under _Developer settings_ is enabled. However, regardless of the admin + /// tenant setting, Service Principals aren't supported for datasets with RLS + /// per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or datasets with SSO enabled. /// - Only DAX queries are supported at this time. MDX and DMV queries are not /// supported. /// <br><br> diff --git a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs index 7a1833de..31568573 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs @@ -301,6 +301,9 @@ public static void DeleteDataset(this IDatasetsOperations operations, string dat /// /// ## Permissions /// + /// The tenant setting **Dataset Execute Queries REST API**, found under + /// **Integration settings**, must be enabled. + /// /// The user must have dataset read and build permissions. For more /// information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). @@ -314,8 +317,6 @@ public static void DeleteDataset(this IDatasetsOperations operations, string dat /// - Datasets that are hosted in Azure Analysis Services or that have a live /// connection to an on-premises Azure Analysis Services model aren't /// supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found under - /// **Integration settings**, must be enabled. /// - One query per API call. /// - One table request per query. /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit @@ -326,12 +327,14 @@ public static void DeleteDataset(this IDatasetsOperations operations, string dat /// will be completed but no additional rows will be written. /// - There's a limit of 120 query requests per minute per user, regardless of /// the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin tenant - /// setting [_Allow service principals to use Power BI + /// - To use Service Principals, make sure the admin tenant setting [_Allow + /// service principals to use Power BI /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. + /// under _Developer settings_ is enabled. However, regardless of the admin + /// tenant setting, Service Principals aren't supported for datasets with RLS + /// per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or datasets with SSO enabled. /// - Only DAX queries are supported at this time. MDX and DMV queries are not /// supported. /// <br><br> @@ -376,6 +379,9 @@ public static DatasetExecuteQueriesResponse ExecuteQueries(this IDatasetsOperati /// /// ## Permissions /// + /// The tenant setting **Dataset Execute Queries REST API**, found under + /// **Integration settings**, must be enabled. + /// /// The user must have dataset read and build permissions. For more /// information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). @@ -389,8 +395,6 @@ public static DatasetExecuteQueriesResponse ExecuteQueries(this IDatasetsOperati /// - Datasets that are hosted in Azure Analysis Services or that have a live /// connection to an on-premises Azure Analysis Services model aren't /// supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found under - /// **Integration settings**, must be enabled. /// - One query per API call. /// - One table request per query. /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit @@ -401,12 +405,14 @@ public static DatasetExecuteQueriesResponse ExecuteQueries(this IDatasetsOperati /// will be completed but no additional rows will be written. /// - There's a limit of 120 query requests per minute per user, regardless of /// the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin tenant - /// setting [_Allow service principals to use Power BI + /// - To use Service Principals, make sure the admin tenant setting [_Allow + /// service principals to use Power BI /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. + /// under _Developer settings_ is enabled. However, regardless of the admin + /// tenant setting, Service Principals aren't supported for datasets with RLS + /// per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or datasets with SSO enabled. /// - Only DAX queries are supported at this time. MDX and DMV queries are not /// supported. /// <br><br> @@ -4690,6 +4696,9 @@ public static void TakeOverInGroup(this IDatasetsOperations operations, System.G /// /// ## Permissions /// + /// The tenant setting **Dataset Execute Queries REST API**, found under + /// **Integration settings**, must be enabled. + /// /// The user must have access to the workspace, and dataset read and build /// permissions. For more information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). @@ -4703,8 +4712,6 @@ public static void TakeOverInGroup(this IDatasetsOperations operations, System.G /// - Datasets that are hosted in Azure Analysis Services or that have a live /// connection to an on-premises Azure Analysis Services model aren't /// supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found under - /// **Integration settings**, must be enabled. /// - One query per API call. /// - One table request per query. /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit @@ -4715,12 +4722,14 @@ public static void TakeOverInGroup(this IDatasetsOperations operations, System.G /// will be completed but no additional rows will be written. /// - There's a limit of 120 query requests per minute per user, regardless of /// the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin tenant - /// setting [_Allow service principals to use Power BI + /// - To use Service Principals, make sure the admin tenant setting [_Allow + /// service principals to use Power BI /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. + /// under _Developer settings_ is enabled. However, regardless of the admin + /// tenant setting, Service Principals aren't supported for datasets with RLS + /// per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or datasets with SSO enabled. /// - Only DAX queries are supported at this time. MDX and DMV queries are not /// supported. /// <br><br> @@ -4768,6 +4777,9 @@ public static DatasetExecuteQueriesResponse ExecuteQueriesInGroup(this IDatasets /// /// ## Permissions /// + /// The tenant setting **Dataset Execute Queries REST API**, found under + /// **Integration settings**, must be enabled. + /// /// The user must have access to the workspace, and dataset read and build /// permissions. For more information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). @@ -4781,8 +4793,6 @@ public static DatasetExecuteQueriesResponse ExecuteQueriesInGroup(this IDatasets /// - Datasets that are hosted in Azure Analysis Services or that have a live /// connection to an on-premises Azure Analysis Services model aren't /// supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found under - /// **Integration settings**, must be enabled. /// - One query per API call. /// - One table request per query. /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit @@ -4793,12 +4803,14 @@ public static DatasetExecuteQueriesResponse ExecuteQueriesInGroup(this IDatasets /// will be completed but no additional rows will be written. /// - There's a limit of 120 query requests per minute per user, regardless of /// the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin tenant - /// setting [_Allow service principals to use Power BI + /// - To use Service Principals, make sure the admin tenant setting [_Allow + /// service principals to use Power BI /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. + /// under _Developer settings_ is enabled. However, regardless of the admin + /// tenant setting, Service Principals aren't supported for datasets with RLS + /// per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or datasets with SSO enabled. /// - Only DAX queries are supported at this time. MDX and DMV queries are not /// supported. /// <br><br> diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 56360e55..0d1377bc 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -343,7 +343,7 @@ "Datasets" ], "summary": "Executes Data Analysis Expressions (DAX) queries against the provided dataset. The dataset must reside in **My workspace** or another workspace.", - "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have dataset read and build permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- There's a limit of 120 query requests per minute per user, regardless of the dataset that's queried.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", + "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n\nThe user must have dataset read and build permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- There's a limit of 120 query requests per minute per user, regardless of the dataset that's queried.\n- To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled. However, regardless of the admin tenant setting, Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or datasets with SSO enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", "operationId": "Datasets_ExecuteQueries", "consumes": [], "produces": [ @@ -6580,7 +6580,7 @@ "Datasets" ], "summary": "Executes Data Analysis Expressions (DAX) queries against the provided dataset.", - "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe user must have access to the workspace, and dataset read and build permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- The tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- There's a limit of 120 query requests per minute per user, regardless of the dataset that's queried.\n- Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or with SSO enabled. To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", + "description": "\nDAX query errors will result in:\n\n- A response error, such as `DAX query failure`.\n- A failure HTTP status code (400).\n\nA query that requests more than one table, or more than the allowed number of table rows, will result in:\n\n- Limited data being returned.\n- A response error, such as `More than one result table in a query` or `More than {allowed number} rows in a query result`.\n- A successful HTTP status code (200).\n\nColumns that are fully qualified in the query will be returned with a fully qualified name, for example, `MyTable[MyColumn]`. Columns that are renamed or created in the query will be returned within square bracket, for example, `[MyNewColumn]`.\n\n## Permissions\n\nThe tenant setting **Dataset Execute Queries REST API**, found under **Integration settings**, must be enabled.\n\nThe user must have access to the workspace, and dataset read and build permissions. For more information, see [Manage dataset access permissions](/power-bi/connect-data/service-datasets-manage-access-permissions).\n\n## Required Scope\n\nDataset.ReadWrite.All or Dataset.Read.All\n\n## Limitations\n\n- Datasets that are hosted in Azure Analysis Services or that have a live connection to an on-premises Azure Analysis Services model aren't supported.\n- One query per API call.\n- One table request per query.\n- Maximum of 100,000 rows or 1,000,000 values per query (whichever is hit first). For example if you query for 5 columns, you can get back max 100,000 rows. If you query for 20 columns, you can get back max 50,000 rows (1 million divided by 20).\n- Maximum of 15MB of data per query. Once 15MB is exceeded, the current row will be completed but no additional rows will be written.\n- There's a limit of 120 query requests per minute per user, regardless of the dataset that's queried.\n- To use Service Principals, make sure the admin tenant setting [_Allow service principals to use Power BI APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) under _Developer settings_ is enabled. However, regardless of the admin tenant setting, Service Principals aren't supported for datasets with RLS per [RLS limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) or datasets with SSO enabled.\n- Only DAX queries are supported at this time. MDX and DMV queries are not supported. \n

", "operationId": "Datasets_ExecuteQueriesInGroup", "consumes": [], "produces": [ From 53626d2f9c27dd957a8f25ba91fafbcd9a608dcb Mon Sep 17 00:00:00 2001 From: Kesem Sharabi Date: Thu, 25 Jan 2024 13:56:10 +0000 Subject: [PATCH 21/35] Merged PR 509384: Move goals link fix2 --- sdk/PowerBI.Api/Source/IDatasetsOperations.cs | 36 ++++++++++--------- .../Source/Models/GoalRankValidationInfo.cs | 7 ++-- .../Source/Models/GoalsMoveRequest.cs | 2 +- sdk/swaggers/swagger.json | 4 +-- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs index a045ea21..d33ef2fa 100644 --- a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs @@ -196,6 +196,9 @@ public partial interface IDatasetsOperations /// /// ## Permissions /// + /// The tenant setting **Dataset Execute Queries REST API**, found + /// under **Integration settings**, must be enabled. + /// /// The user must have dataset read and build permissions. For more /// information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). @@ -209,8 +212,6 @@ public partial interface IDatasetsOperations /// - Datasets that are hosted in Azure Analysis Services or that have /// a live connection to an on-premises Azure Analysis Services model /// aren't supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found - /// under **Integration settings**, must be enabled. /// - One query per API call. /// - One table request per query. /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever @@ -222,13 +223,14 @@ public partial interface IDatasetsOperations /// written. /// - There's a limit of 120 query requests per minute per user, /// regardless of the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per - /// [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin - /// tenant setting [_Allow service principals to use Power BI + /// - To use Service Principals, make sure the admin tenant setting + /// [_Allow service principals to use Power BI /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. + /// under _Developer settings_ is enabled. However, regardless of the + /// admin tenant setting, Service Principals aren't supported for + /// datasets with RLS per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or datasets with SSO enabled. /// - Only DAX queries are supported at this time. MDX and DMV queries /// are not supported. /// <br><br> @@ -2653,6 +2655,9 @@ public partial interface IDatasetsOperations /// /// ## Permissions /// + /// The tenant setting **Dataset Execute Queries REST API**, found + /// under **Integration settings**, must be enabled. + /// /// The user must have access to the workspace, and dataset read and /// build permissions. For more information, see [Manage dataset access /// permissions](/power-bi/connect-data/service-datasets-manage-access-permissions). @@ -2666,8 +2671,6 @@ public partial interface IDatasetsOperations /// - Datasets that are hosted in Azure Analysis Services or that have /// a live connection to an on-premises Azure Analysis Services model /// aren't supported. - /// - The tenant setting **Dataset Execute Queries REST API**, found - /// under **Integration settings**, must be enabled. /// - One query per API call. /// - One table request per query. /// - Maximum of 100,000 rows or 1,000,000 values per query (whichever @@ -2679,13 +2682,14 @@ public partial interface IDatasetsOperations /// written. /// - There's a limit of 120 query requests per minute per user, /// regardless of the dataset that's queried. - /// - Service Principals aren't supported for datasets with RLS per - /// [RLS - /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) - /// or with SSO enabled. To use Service Principals, make sure the admin - /// tenant setting [_Allow service principals to use Power BI + /// - To use Service Principals, make sure the admin tenant setting + /// [_Allow service principals to use Power BI /// APIs_](/power-bi/admin/service-admin-portal-developer#allow-service-principals-to-use-power-bi-apis) - /// under _Developer settings_ is enabled. + /// under _Developer settings_ is enabled. However, regardless of the + /// admin tenant setting, Service Principals aren't supported for + /// datasets with RLS per [RLS + /// limitations](/power-bi/admin/service-admin-rls#considerations-and-limitations) + /// or datasets with SSO enabled. /// - Only DAX queries are supported at this time. MDX and DMV queries /// are not supported. /// <br><br> diff --git a/sdk/PowerBI.Api/Source/Models/GoalRankValidationInfo.cs b/sdk/PowerBI.Api/Source/Models/GoalRankValidationInfo.cs index 8e733307..395a0f2d 100644 --- a/sdk/PowerBI.Api/Source/Models/GoalRankValidationInfo.cs +++ b/sdk/PowerBI.Api/Source/Models/GoalRankValidationInfo.cs @@ -11,9 +11,10 @@ namespace Microsoft.PowerBI.Api.Models /// /// The rank validation information for a Power BI goal, to be used with - /// the [Move Goals](/rest/api/power-bi/scorecards/move-goals) API request. - /// The caller provides validation information to confirm that they know - /// the existing position of the goal within the hierarchy of goals. + /// the [Move Goals](/rest/api/power-bi/scorecards_(preview)/move-goals) + /// API request. The caller provides validation information to confirm that + /// they know the existing position of the goal within the hierarchy of + /// goals. /// public partial class GoalRankValidationInfo { diff --git a/sdk/PowerBI.Api/Source/Models/GoalsMoveRequest.cs b/sdk/PowerBI.Api/Source/Models/GoalsMoveRequest.cs index 37b8e254..0555d359 100644 --- a/sdk/PowerBI.Api/Source/Models/GoalsMoveRequest.cs +++ b/sdk/PowerBI.Api/Source/Models/GoalsMoveRequest.cs @@ -12,7 +12,7 @@ namespace Microsoft.PowerBI.Api.Models /// /// A request object to be used with the [Move - /// Goals](/rest/api/power-bi/scorecards/move-goals) API request + /// Goals](/rest/api/power-bi/scorecards_(preview)/move-goals) API request /// public partial class GoalsMoveRequest { diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 0d1377bc..025bb76f 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -30284,7 +30284,7 @@ } }, "GoalRankValidationInfo": { - "description": "The rank validation information for a Power BI goal, to be used with the [Move Goals](/rest/api/power-bi/scorecards/move-goals) API request. The caller provides validation information to confirm that they know the existing position of the goal within the hierarchy of goals.", + "description": "The rank validation information for a Power BI goal, to be used with the [Move Goals](/rest/api/power-bi/scorecards_(preview)/move-goals) API request. The caller provides validation information to confirm that they know the existing position of the goal within the hierarchy of goals.", "properties": { "goalId": { "description": "The goal ID", @@ -30299,7 +30299,7 @@ } }, "GoalsMoveRequest": { - "description": "A request object to be used with the [Move Goals](/rest/api/power-bi/scorecards/move-goals) API request", + "description": "A request object to be used with the [Move Goals](/rest/api/power-bi/scorecards_(preview)/move-goals) API request", "required": [ "goalToMove" ], From 4b8af8dee5f45584526a99105f9973f757a243aa Mon Sep 17 00:00:00 2001 From: Kesem Sharabi Date: Tue, 6 Feb 2024 11:16:51 +0000 Subject: [PATCH 22/35] Merged PR 515029: Paginated report limitation Paginated report limitation in [Reports - Rebind Report In Group](https://learn.microsoft.com/en-us/rest/api/power-bi/reports/rebind-report-in-group) as described in [doc bug 208062](https://dev.azure.com/msft-skilling/Content/_workitems/edit/208062). --- sdk/PowerBI.Api/Source/IReportsOperations.cs | 5 ++++- sdk/PowerBI.Api/Source/ReportsOperations.cs | 5 ++++- sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs | 10 ++++++++-- sdk/swaggers/swagger.json | 2 +- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sdk/PowerBI.Api/Source/IReportsOperations.cs b/sdk/PowerBI.Api/Source/IReportsOperations.cs index e4128b8a..9ff00ec0 100644 --- a/sdk/PowerBI.Api/Source/IReportsOperations.cs +++ b/sdk/PowerBI.Api/Source/IReportsOperations.cs @@ -828,7 +828,10 @@ public partial interface IReportsOperations /// ## Required Scope /// /// Report.ReadWrite.All - /// <br><br> + /// + /// ## Limitations + /// + /// Paginated reports are not supported.<br><br> ///
/// /// The workspace ID diff --git a/sdk/PowerBI.Api/Source/ReportsOperations.cs b/sdk/PowerBI.Api/Source/ReportsOperations.cs index f8381c31..8570ebd3 100644 --- a/sdk/PowerBI.Api/Source/ReportsOperations.cs +++ b/sdk/PowerBI.Api/Source/ReportsOperations.cs @@ -3147,7 +3147,10 @@ public ReportsOperations(PowerBIClient client) /// ## Required Scope /// /// Report.ReadWrite.All - /// <br><br> + /// + /// ## Limitations + /// + /// Paginated reports are not supported.<br><br> /// /// /// The workspace ID diff --git a/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs index 604b92b7..14e79a4d 100644 --- a/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs @@ -1444,7 +1444,10 @@ public static Report UpdateReportContentInGroup(this IReportsOperations operatio /// ## Required Scope /// /// Report.ReadWrite.All - /// <br><br> + /// + /// ## Limitations + /// + /// Paginated reports are not supported.<br><br> /// /// /// The operations group for this extension method. @@ -1490,7 +1493,10 @@ public static void RebindReportInGroup(this IReportsOperations operations, Syste /// ## Required Scope /// /// Report.ReadWrite.All - /// <br><br> + /// + /// ## Limitations + /// + /// Paginated reports are not supported.<br><br> /// /// /// The operations group for this extension method. diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 025bb76f..f627699c 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -7528,7 +7528,7 @@ "Reports" ], "summary": "Rebinds the specified report from the specified workspace to the specified dataset.", - "description": "\n- If the specified dataset resides in a different workspace than the report or in **My workspace**, then a shared dataset will be created in the report's workspace.\n- On rebind, reports with a [live connection](/power-bi/desktop-report-lifecycle-datasets) will lose that connection and instead have a direct binding to the target dataset.\n\n## Permissions\n\n- The user must have all of the following:\n\n - **Write** permission on the specified report.\n - **Build** permission on the target dataset.\n\n- This API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nReport.ReadWrite.All\n

", + "description": "\n- If the specified dataset resides in a different workspace than the report or in **My workspace**, then a shared dataset will be created in the report's workspace.\n- On rebind, reports with a [live connection](/power-bi/desktop-report-lifecycle-datasets) will lose that connection and instead have a direct binding to the target dataset.\n\n## Permissions\n\n- The user must have all of the following:\n\n - **Write** permission on the specified report.\n - **Build** permission on the target dataset.\n\n- This API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nReport.ReadWrite.All\n\n## Limitations\n\nPaginated reports are not supported.

", "operationId": "Reports_RebindReportInGroup", "consumes": [ "application/json" From aaa3bbb729bc1fa5b30cdb0d5597ecf27107a8e7 Mon Sep 17 00:00:00 2001 From: Sai Botchu Date: Tue, 13 Feb 2024 17:07:56 +0000 Subject: [PATCH 23/35] Merged PR 517824: Update Throttle limits 1. Update the throttle limits as below for below APIs ![image (3).png](https://dev.azure.com/powerbi/4c7b5adb-c2d0-4f18-b23c-edc4ac30f4e1/_apis/git/repositories/4f4b7330-5c73-4eb2-b9cb-d2f4c16debf7/pullRequests/517824/attachments/image%20%283%29.png) 1. Update GetAppsAsAdmnin - parameters. --- sdk/PowerBI.Api/Source/AppsOperations.cs | 17 +++++++++++++--- .../Source/AppsOperationsExtensions.cs | 20 +++++++++++-------- .../Source/DashboardsOperations.cs | 2 +- .../Source/DashboardsOperationsExtensions.cs | 4 ++-- sdk/PowerBI.Api/Source/DatasetsOperations.cs | 7 ++++--- .../Source/DatasetsOperationsExtensions.cs | 14 +++++++------ sdk/PowerBI.Api/Source/GroupsOperations.cs | 5 +++-- .../Source/GroupsOperationsExtensions.cs | 10 ++++++---- sdk/PowerBI.Api/Source/IAppsOperations.cs | 8 +++++--- .../Source/IDashboardsOperations.cs | 2 +- sdk/PowerBI.Api/Source/IDatasetsOperations.cs | 7 ++++--- sdk/PowerBI.Api/Source/IGroupsOperations.cs | 6 +++--- sdk/PowerBI.Api/Source/IReportsOperations.cs | 2 +- sdk/PowerBI.Api/Source/ReportsOperations.cs | 2 +- .../Source/ReportsOperationsExtensions.cs | 4 ++-- sdk/swaggers/swagger.json | 18 ++++++++++++----- 16 files changed, 80 insertions(+), 48 deletions(-) diff --git a/sdk/PowerBI.Api/Source/AppsOperations.cs b/sdk/PowerBI.Api/Source/AppsOperations.cs index 47139f77..303af01c 100644 --- a/sdk/PowerBI.Api/Source/AppsOperations.cs +++ b/sdk/PowerBI.Api/Source/AppsOperations.cs @@ -1239,8 +1239,10 @@ public AppsOperations(PowerBIClient client) /// <br><br> /// /// - /// The requested number of entries in the refresh history. If not provided, - /// the default is all available entries. + /// The requested number of apps. + /// + /// + /// The number entries to be skipped. /// /// /// Headers that will be added to request. @@ -1257,12 +1259,16 @@ public AppsOperations(PowerBIClient client) /// /// A response object containing the response body and response headers. /// - public async Task> GetAppsAsAdminWithHttpMessagesAsync(int top, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> GetAppsAsAdminWithHttpMessagesAsync(int top, int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (top < 1) { throw new ValidationException(ValidationRules.InclusiveMinimum, "top", 1); } + if (skip < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "skip", 1); + } // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; string _invocationId = null; @@ -1271,6 +1277,7 @@ public AppsOperations(PowerBIClient client) _invocationId = ServiceClientTracing.NextInvocationId.ToString(); Dictionary tracingParameters = new Dictionary(); tracingParameters.Add("top", top); + tracingParameters.Add("skip", skip); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "GetAppsAsAdmin", tracingParameters); } @@ -1279,6 +1286,10 @@ public AppsOperations(PowerBIClient client) var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/admin/apps").ToString(); List _queryParameters = new List(); _queryParameters.Add(string.Format("$top={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(top, Client.SerializationSettings).Trim('"')))); + if (skip != null) + { + _queryParameters.Add(string.Format("$skip={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(skip, Client.SerializationSettings).Trim('"')))); + } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); diff --git a/sdk/PowerBI.Api/Source/AppsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/AppsOperationsExtensions.cs index 810a19c0..ae69ffa7 100644 --- a/sdk/PowerBI.Api/Source/AppsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/AppsOperationsExtensions.cs @@ -532,12 +532,14 @@ public static Tile GetTile(this IAppsOperations operations, System.Guid appId, S /// The operations group for this extension method. /// /// - /// The requested number of entries in the refresh history. If not provided, - /// the default is all available entries. + /// The requested number of apps. /// - public static AdminApps GetAppsAsAdmin(this IAppsOperations operations, int top) + /// + /// The number entries to be skipped. + /// + public static AdminApps GetAppsAsAdmin(this IAppsOperations operations, int top, int? skip = default(int?)) { - return operations.GetAppsAsAdminAsync(top).GetAwaiter().GetResult(); + return operations.GetAppsAsAdminAsync(top, skip).GetAwaiter().GetResult(); } /// @@ -575,15 +577,17 @@ public static AdminApps GetAppsAsAdmin(this IAppsOperations operations, int top) /// The operations group for this extension method. /// /// - /// The requested number of entries in the refresh history. If not provided, - /// the default is all available entries. + /// The requested number of apps. + /// + /// + /// The number entries to be skipped. /// /// /// The cancellation token. /// - public static async Task GetAppsAsAdminAsync(this IAppsOperations operations, int top, CancellationToken cancellationToken = default(CancellationToken)) + public static async Task GetAppsAsAdminAsync(this IAppsOperations operations, int top, int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.GetAppsAsAdminWithHttpMessagesAsync(top, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.GetAppsAsAdminWithHttpMessagesAsync(top, skip, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/PowerBI.Api/Source/DashboardsOperations.cs b/sdk/PowerBI.Api/Source/DashboardsOperations.cs index bd751d16..43462c16 100644 --- a/sdk/PowerBI.Api/Source/DashboardsOperations.cs +++ b/sdk/PowerBI.Api/Source/DashboardsOperations.cs @@ -2573,7 +2573,7 @@ public DashboardsOperations(PowerBIClient client) /// /// ## Limitations /// - /// Maximum 200 requests per hour. + /// Maximum 50 requests per hour or 5 requests per minute, per tenant. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/DashboardsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/DashboardsOperationsExtensions.cs index e7274925..2625c6ab 100644 --- a/sdk/PowerBI.Api/Source/DashboardsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/DashboardsOperationsExtensions.cs @@ -1199,7 +1199,7 @@ public static EmbedToken GenerateTokenInGroup(this IDashboardsOperations operati /// /// ## Limitations /// - /// Maximum 200 requests per hour. + /// Maximum 50 requests per hour or 5 requests per minute, per tenant. /// <br><br> /// /// @@ -1249,7 +1249,7 @@ public static EmbedToken GenerateTokenInGroup(this IDashboardsOperations operati /// /// ## Limitations /// - /// Maximum 200 requests per hour. + /// Maximum 50 requests per hour or 5 requests per minute, per tenant. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/DatasetsOperations.cs b/sdk/PowerBI.Api/Source/DatasetsOperations.cs index bbfa5be2..55e00b76 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperations.cs @@ -10641,9 +10641,6 @@ public DatasetsOperations(PowerBIClient client) /// /// /// - /// Each request takes two seconds to process, during which time other requests - /// are queued. - /// /// ## Permissions /// /// - The user must have administrator rights (such as Office 365 Global @@ -10662,6 +10659,10 @@ public DatasetsOperations(PowerBIClient client) /// Relevant only when authenticating via a standard delegated admin access /// token. Must not be present when authentication via a service principal is /// used. + /// + /// ## Limitations + /// + /// Maximum 50 requests per hour or 5 requests per minute, per tenant. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs index 31568573..bee3fae3 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs @@ -5095,9 +5095,6 @@ public static EmbedToken GenerateTokenInGroup(this IDatasetsOperations operation /// /// /// - /// Each request takes two seconds to process, during which time other requests - /// are queued. - /// /// ## Permissions /// /// - The user must have administrator rights (such as Office 365 Global @@ -5116,6 +5113,10 @@ public static EmbedToken GenerateTokenInGroup(this IDatasetsOperations operation /// Relevant only when authenticating via a standard delegated admin access /// token. Must not be present when authentication via a service principal is /// used. + /// + /// ## Limitations + /// + /// Maximum 50 requests per hour or 5 requests per minute, per tenant. /// <br><br> /// /// @@ -5140,9 +5141,6 @@ public static EmbedToken GenerateTokenInGroup(this IDatasetsOperations operation /// /// /// - /// Each request takes two seconds to process, during which time other requests - /// are queued. - /// /// ## Permissions /// /// - The user must have administrator rights (such as Office 365 Global @@ -5161,6 +5159,10 @@ public static EmbedToken GenerateTokenInGroup(this IDatasetsOperations operation /// Relevant only when authenticating via a standard delegated admin access /// token. Must not be present when authentication via a service principal is /// used. + /// + /// ## Limitations + /// + /// Maximum 50 requests per hour or 5 requests per minute, per tenant. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/GroupsOperations.cs b/sdk/PowerBI.Api/Source/GroupsOperations.cs index 9643fded..07653625 100644 --- a/sdk/PowerBI.Api/Source/GroupsOperations.cs +++ b/sdk/PowerBI.Api/Source/GroupsOperations.cs @@ -2205,8 +2205,9 @@ public GroupsOperations(PowerBIClient client) /// /// ## Limitations /// - /// Maximum 50 requests per hour, per tenant. This call will also time out - /// after 30 seconds to prevent adverse effect on the Power BI service. + /// Maximum 50 requests per hour or 15 requests per minute, per tenant. This + /// call will also time out after 30 seconds to prevent adverse effect on the + /// Power BI service. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/GroupsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/GroupsOperationsExtensions.cs index 08f2bc12..2159b29f 100644 --- a/sdk/PowerBI.Api/Source/GroupsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/GroupsOperationsExtensions.cs @@ -1023,8 +1023,9 @@ public static void AssignToDataflowStorage(this IGroupsOperations operations, Sy /// /// ## Limitations /// - /// Maximum 50 requests per hour, per tenant. This call will also time out - /// after 30 seconds to prevent adverse effect on the Power BI service. + /// Maximum 50 requests per hour or 15 requests per minute, per tenant. This + /// call will also time out after 30 seconds to prevent adverse effect on the + /// Power BI service. /// <br><br> /// /// @@ -1077,8 +1078,9 @@ public static void AssignToDataflowStorage(this IGroupsOperations operations, Sy /// /// ## Limitations /// - /// Maximum 50 requests per hour, per tenant. This call will also time out - /// after 30 seconds to prevent adverse effect on the Power BI service. + /// Maximum 50 requests per hour or 15 requests per minute, per tenant. This + /// call will also time out after 30 seconds to prevent adverse effect on the + /// Power BI service. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/IAppsOperations.cs b/sdk/PowerBI.Api/Source/IAppsOperations.cs index 9c9f08e6..8b206bd3 100644 --- a/sdk/PowerBI.Api/Source/IAppsOperations.cs +++ b/sdk/PowerBI.Api/Source/IAppsOperations.cs @@ -307,8 +307,10 @@ public partial interface IAppsOperations /// <br><br> /// /// - /// The requested number of entries in the refresh history. If not - /// provided, the default is all available entries. + /// The requested number of apps. + /// + /// + /// The number entries to be skipped. /// /// /// The headers that will be added to request. @@ -322,7 +324,7 @@ public partial interface IAppsOperations /// /// Thrown when unable to deserialize the response /// - Task> GetAppsAsAdminWithHttpMessagesAsync(int top, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> GetAppsAsAdminWithHttpMessagesAsync(int top, int? skip = default(int?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns a list of users that have access to the specified app. /// diff --git a/sdk/PowerBI.Api/Source/IDashboardsOperations.cs b/sdk/PowerBI.Api/Source/IDashboardsOperations.cs index 2cd62a6c..add377ae 100644 --- a/sdk/PowerBI.Api/Source/IDashboardsOperations.cs +++ b/sdk/PowerBI.Api/Source/IDashboardsOperations.cs @@ -668,7 +668,7 @@ public partial interface IDashboardsOperations /// /// ## Limitations /// - /// Maximum 200 requests per hour. + /// Maximum 50 requests per hour or 5 requests per minute, per tenant. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs index d33ef2fa..df8c934d 100644 --- a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs @@ -2867,9 +2867,6 @@ public partial interface IDatasetsOperations /// /// /// - /// Each request takes two seconds to process, during which time other - /// requests are queued. - /// /// ## Permissions /// /// - The user must have administrator rights (such as Office 365 @@ -2888,6 +2885,10 @@ public partial interface IDatasetsOperations /// Relevant only when authenticating via a standard delegated admin /// access token. Must not be present when authentication via a service /// principal is used. + /// + /// ## Limitations + /// + /// Maximum 50 requests per hour or 5 requests per minute, per tenant. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/IGroupsOperations.cs b/sdk/PowerBI.Api/Source/IGroupsOperations.cs index 80957da1..02ac93c5 100644 --- a/sdk/PowerBI.Api/Source/IGroupsOperations.cs +++ b/sdk/PowerBI.Api/Source/IGroupsOperations.cs @@ -586,9 +586,9 @@ public partial interface IGroupsOperations /// /// ## Limitations /// - /// Maximum 50 requests per hour, per tenant. This call will also time - /// out after 30 seconds to prevent adverse effect on the Power BI - /// service. + /// Maximum 50 requests per hour or 15 requests per minute, per tenant. + /// This call will also time out after 30 seconds to prevent adverse + /// effect on the Power BI service. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/IReportsOperations.cs b/sdk/PowerBI.Api/Source/IReportsOperations.cs index 9ff00ec0..cd8eacc1 100644 --- a/sdk/PowerBI.Api/Source/IReportsOperations.cs +++ b/sdk/PowerBI.Api/Source/IReportsOperations.cs @@ -1393,7 +1393,7 @@ public partial interface IReportsOperations /// /// ## Limitations /// - /// Maximum 1 request per 10 minutes. + /// Maximum 50 requests per hour or 5 requests per minute, per tenant. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/ReportsOperations.cs b/sdk/PowerBI.Api/Source/ReportsOperations.cs index 8570ebd3..ab0f6250 100644 --- a/sdk/PowerBI.Api/Source/ReportsOperations.cs +++ b/sdk/PowerBI.Api/Source/ReportsOperations.cs @@ -5052,7 +5052,7 @@ public ReportsOperations(PowerBIClient client) /// /// ## Limitations /// - /// Maximum 1 request per 10 minutes. + /// Maximum 50 requests per hour or 5 requests per minute, per tenant. /// <br><br> /// /// diff --git a/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs index 14e79a4d..a10b2680 100644 --- a/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs @@ -2472,7 +2472,7 @@ public static EmbedToken GenerateTokenInGroup(this IReportsOperations operations /// /// ## Limitations /// - /// Maximum 1 request per 10 minutes. + /// Maximum 50 requests per hour or 5 requests per minute, per tenant. /// <br><br> /// /// @@ -2518,7 +2518,7 @@ public static EmbedToken GenerateTokenInGroup(this IReportsOperations operations /// /// ## Limitations /// - /// Maximum 1 request per 10 minutes. + /// Maximum 50 requests per hour or 5 requests per minute, per tenant. /// <br><br> /// /// diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index f627699c..f1e4c037 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -14636,7 +14636,7 @@ "Admin" ], "summary": "Returns a list of datasets for the organization.", - "description": "\nEach request takes two seconds to process, during which time other requests are queued.\n\n## Permissions\n\n- The user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator) or authenticate using a service principal.\n- Delegated permissions are supported.\n\nWhen running under service prinicipal authentication, an app **must not** have any admin-consent required premissions for Power BI set on it in the Azure portal. \n\n## Required Scope\n\nTenant.Read.All or Tenant.ReadWrite.All\n\nRelevant only when authenticating via a standard delegated admin access token. Must not be present when authentication via a service principal is used.\n

", + "description": "\n## Permissions\n\n- The user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator) or authenticate using a service principal.\n- Delegated permissions are supported.\n\nWhen running under service prinicipal authentication, an app **must not** have any admin-consent required premissions for Power BI set on it in the Azure portal. \n\n## Required Scope\n\nTenant.Read.All or Tenant.ReadWrite.All\n\nRelevant only when authenticating via a standard delegated admin access token. Must not be present when authentication via a service principal is used.\n\n## Limitations\n\nMaximum 50 requests per hour or 5 requests per minute, per tenant.\n

", "operationId": "Datasets_GetDatasetsAsAdmin", "consumes": [], "produces": [ @@ -14820,7 +14820,7 @@ "Admin" ], "summary": "Returns a list of workspaces for the organization.", - "description": "\n## Permissions\n\n- The user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator) or authenticate using a service principal.\n- Delegated permissions are supported.\n\nWhen running under service prinicipal authentication, an app **must not** have any admin-consent required premissions for Power BI set on it in the Azure portal. \n\n## Required Scope\n\nTenant.Read.All or Tenant.ReadWrite.All\n\nRelevant only when authenticating via a standard delegated admin access token. Must not be present when authentication via a service principal is used.\n\n## Limitations\n\nMaximum 50 requests per hour, per tenant. This call will also time out after 30 seconds to prevent adverse effect on the Power BI service.\n

", + "description": "\n## Permissions\n\n- The user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator) or authenticate using a service principal.\n- Delegated permissions are supported.\n\nWhen running under service prinicipal authentication, an app **must not** have any admin-consent required premissions for Power BI set on it in the Azure portal. \n\n## Required Scope\n\nTenant.Read.All or Tenant.ReadWrite.All\n\nRelevant only when authenticating via a standard delegated admin access token. Must not be present when authentication via a service principal is used.\n\n## Limitations\n\nMaximum 50 requests per hour or 15 requests per minute, per tenant. This call will also time out after 30 seconds to prevent adverse effect on the Power BI service.\n

", "operationId": "Groups_GetGroupsAsAdmin", "consumes": [], "produces": [ @@ -16163,7 +16163,7 @@ "Admin" ], "summary": "Returns a list of reports for the organization.", - "description": "\n## Permissions\n\n- The user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator) or authenticate using a service principal.\n- Delegated permissions are supported.\n\nWhen running under service prinicipal authentication, an app **must not** have any admin-consent required premissions for Power BI set on it in the Azure portal.\n\n## Required Scope\n\nTenant.Read.All or Tenant.ReadWrite.All\n\nRelevant only when authenticating via a standard delegated admin access token. Must not be present when authentication via a service principal is used.\n\n## Limitations\n\nMaximum 1 request per 10 minutes.\n

", + "description": "\n## Permissions\n\n- The user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator) or authenticate using a service principal.\n- Delegated permissions are supported.\n\nWhen running under service prinicipal authentication, an app **must not** have any admin-consent required premissions for Power BI set on it in the Azure portal.\n\n## Required Scope\n\nTenant.Read.All or Tenant.ReadWrite.All\n\nRelevant only when authenticating via a standard delegated admin access token. Must not be present when authentication via a service principal is used.\n\n## Limitations\n\nMaximum 50 requests per hour or 5 requests per minute, per tenant.\n

", "operationId": "Reports_GetReportsAsAdmin", "consumes": [], "produces": [ @@ -16356,7 +16356,7 @@ "Admin" ], "summary": "Returns a list of dashboards for the organization.", - "description": "\n## Permissions\n\n- The user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator) or authenticate using a service principal.\n- Delegated permissions are supported.\n\nWhen running under service prinicipal authentication, an app **must not** have any admin-consent required premissions for Power BI set on it in the Azure portal.\n\n## Required Scope\n\nTenant.Read.All or Tenant.ReadWrite.All\n\nRelevant only when authenticating via a standard delegated admin access token. Must not be present when authentication via a service principal is used.\n\n## Limitations\n\nMaximum 200 requests per hour.\n

", + "description": "\n## Permissions\n\n- The user must have administrator rights (such as Office 365 Global Administrator or Power BI Service Administrator) or authenticate using a service principal.\n- Delegated permissions are supported.\n\nWhen running under service prinicipal authentication, an app **must not** have any admin-consent required premissions for Power BI set on it in the Azure portal.\n\n## Required Scope\n\nTenant.Read.All or Tenant.ReadWrite.All\n\nRelevant only when authenticating via a standard delegated admin access token. Must not be present when authentication via a service principal is used.\n\n## Limitations\n\nMaximum 50 requests per hour or 5 requests per minute, per tenant.\n

", "operationId": "Dashboards_GetDashboardsAsAdmin", "consumes": [], "produces": [ @@ -18384,11 +18384,19 @@ "parameters": [ { "name": "$top", - "description": "The requested number of entries in the refresh history. If not provided, the default is all available entries.", + "description": "The requested number of apps.", "in": "query", "required": true, "type": "integer", "minimum": 1 + }, + { + "name": "$skip", + "description": "The number entries to be skipped.", + "in": "query", + "required": false, + "type": "integer", + "minimum": 1 } ], "responses": { From f6bbd3ec83707a7743d6d8a1e781638a310809cd Mon Sep 17 00:00:00 2001 From: Mahir Diab Date: Sun, 10 Mar 2024 12:39:22 +0000 Subject: [PATCH 24/35] Merged PR 530459: [Documentation] Update limitation of Get Dataset Parameters API [Documentation] Update limitation of Get Dataset Parameters API --- sdk/PowerBI.Api/Source/DatasetsOperations.cs | 24 ++++++---- .../Source/DatasetsOperationsExtensions.cs | 48 +++++++++++-------- sdk/PowerBI.Api/Source/IDatasetsOperations.cs | 27 ++++++----- sdk/swaggers/swagger.json | 12 ++--- 4 files changed, 64 insertions(+), 47 deletions(-) diff --git a/sdk/PowerBI.Api/Source/DatasetsOperations.cs b/sdk/PowerBI.Api/Source/DatasetsOperations.cs index 55e00b76..de3032cf 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperations.cs @@ -2906,9 +2906,11 @@ public DatasetsOperations(PowerBIClient client) /// /// ## Limitations /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// - Datasets with SQL, Oracle, Teradata, and SAP HANA /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections /// aren't supported. + /// - Datasets created or modified using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. /// <br><br> /// /// @@ -3078,10 +3080,10 @@ public DatasetsOperations(PowerBIClient client) /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. + /// To make changes to those datasets, the admin must use the Azure Analysis + /// Services client library for Tabular Object Model. /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections are only supported with [enhanced dataset /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). @@ -3404,7 +3406,7 @@ public DatasetsOperations(PowerBIClient client) /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. /// To make changes to those data sources, the admin must use the Azure /// Analysis Services client library for Tabular Object Model. @@ -8411,9 +8413,11 @@ public DatasetsOperations(PowerBIClient client) /// /// ## Limitations /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// - Datasets with SQL, Oracle, Teradata, and SAP HANA /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections /// aren't supported. + /// - Datasets created or modified using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. /// <br><br> /// /// @@ -8590,10 +8594,10 @@ public DatasetsOperations(PowerBIClient client) /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. + /// To make changes to those datsets, the admin must use the Azure Analysis + /// Services client library for Tabular Object Model. /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections are only supported with [enhanced dataset /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). @@ -8938,7 +8942,7 @@ public DatasetsOperations(PowerBIClient client) /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. /// To make changes to those data sources, the admin must use the Azure /// Analysis Services client library for Tabular Object Model. diff --git a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs index bee3fae3..93c2797a 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs @@ -1260,9 +1260,11 @@ public static void UpdateDirectQueryRefreshSchedule(this IDatasetsOperations ope /// /// ## Limitations /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// - Datasets with SQL, Oracle, Teradata, and SAP HANA /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections /// aren't supported. + /// - Datasets created or modified using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. /// <br><br> /// /// @@ -1288,9 +1290,11 @@ public static MashupParameters GetParameters(this IDatasetsOperations operations /// /// ## Limitations /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// - Datasets with SQL, Oracle, Teradata, and SAP HANA /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections /// aren't supported. + /// - Datasets created or modified using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. /// <br><br> /// /// @@ -1339,10 +1343,10 @@ public static MashupParameters GetParameters(this IDatasetsOperations operations /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. + /// To make changes to those datasets, the admin must use the Azure Analysis + /// Services client library for Tabular Object Model. /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections are only supported with [enhanced dataset /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). @@ -1398,10 +1402,10 @@ public static void UpdateParameters(this IDatasetsOperations operations, string /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. + /// To make changes to those datasets, the admin must use the Azure Analysis + /// Services client library for Tabular Object Model. /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections are only supported with [enhanced dataset /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). @@ -1507,7 +1511,7 @@ public static Datasources GetDatasources(this IDatasetsOperations operations, st /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. /// To make changes to those data sources, the admin must use the Azure /// Analysis Services client library for Tabular Object Model. @@ -1573,7 +1577,7 @@ public static void UpdateDatasources(this IDatasetsOperations operations, string /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. /// To make changes to those data sources, the admin must use the Azure /// Analysis Services client library for Tabular Object Model. @@ -3875,9 +3879,11 @@ public static void UpdateDirectQueryRefreshScheduleInGroup(this IDatasetsOperati /// /// ## Limitations /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// - Datasets with SQL, Oracle, Teradata, and SAP HANA /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections /// aren't supported. + /// - Datasets created or modified using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. /// <br><br> /// /// @@ -3911,9 +3917,11 @@ public static MashupParameters GetParametersInGroup(this IDatasetsOperations ope /// /// ## Limitations /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// - Datasets with SQL, Oracle, Teradata, and SAP HANA /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections /// aren't supported. + /// - Datasets created or modified using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. /// <br><br> /// /// @@ -3967,10 +3975,10 @@ public static MashupParameters GetParametersInGroup(this IDatasetsOperations ope /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. + /// To make changes to those datsets, the admin must use the Azure Analysis + /// Services client library for Tabular Object Model. /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections are only supported with [enhanced dataset /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). @@ -4031,10 +4039,10 @@ public static void UpdateParametersInGroup(this IDatasetsOperations operations, /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those data sources, the admin must use the Azure - /// Analysis Services client library for Tabular Object Model. + /// To make changes to those datsets, the admin must use the Azure Analysis + /// Services client library for Tabular Object Model. /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections are only supported with [enhanced dataset /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). @@ -4166,7 +4174,7 @@ public static Datasources GetDatasourcesInGroup(this IDatasetsOperations operati /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. /// To make changes to those data sources, the admin must use the Azure /// Analysis Services client library for Tabular Object Model. @@ -4238,7 +4246,7 @@ public static void UpdateDatasourcesInGroup(this IDatasetsOperations operations, /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. /// To make changes to those data sources, the admin must use the Azure /// Analysis Services client library for Tabular Object Model. diff --git a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs index df8c934d..dcf5ce10 100644 --- a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs @@ -722,9 +722,12 @@ public partial interface IDatasetsOperations /// /// ## Limitations /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// - Datasets with SQL, Oracle, Teradata, and SAP HANA /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections aren't supported. + /// - Datasets created or modified using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't + /// supported. /// <br><br> /// /// @@ -775,10 +778,10 @@ public partial interface IDatasetsOperations /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't - /// supported. To make changes to those data sources, the admin must - /// use the Azure Analysis Services client library for Tabular Object + /// supported. To make changes to those datasets, the admin must use + /// the Azure Analysis Services client library for Tabular Object /// Model. /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections are only supported with [enhanced dataset @@ -870,7 +873,7 @@ public partial interface IDatasetsOperations /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't /// supported. To make changes to those data sources, the admin must /// use the Azure Analysis Services client library for Tabular Object @@ -2190,9 +2193,12 @@ public partial interface IDatasetsOperations /// /// ## Limitations /// - /// Datasets with SQL, Oracle, Teradata, and SAP HANA + /// - Datasets with SQL, Oracle, Teradata, and SAP HANA /// [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections aren't supported. + /// - Datasets created or modified using the public [XMLA + /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't + /// supported. /// <br><br> /// /// @@ -2248,11 +2254,10 @@ public partial interface IDatasetsOperations /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't - /// supported. To make changes to those data sources, the admin must - /// use the Azure Analysis Services client library for Tabular Object - /// Model. + /// supported. To make changes to those datsets, the admin must use the + /// Azure Analysis Services client library for Tabular Object Model. /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections are only supported with [enhanced dataset /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). @@ -2360,7 +2365,7 @@ public partial interface IDatasetsOperations /// /// ## Limitations /// - /// - Datasets created using the public [XMLA + /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't /// supported. To make changes to those data sources, the admin must /// use the Azure Analysis Services client library for Tabular Object diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index f1e4c037..d21d50d9 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -1502,7 +1502,7 @@ "Datasets" ], "summary": "Returns a list of parameters for the specified dataset from **My workspace**.", - "description": "\n## Required Scope\n\nDataset.Read.All or Dataset.ReadWrite.All\n\n## Limitations\n\nDatasets with SQL, Oracle, Teradata, and SAP HANA [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections aren't supported.\n

", + "description": "\n## Required Scope\n\nDataset.Read.All or Dataset.ReadWrite.All\n\n## Limitations\n\n- Datasets with SQL, Oracle, Teradata, and SAP HANA [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections aren't supported.\n- Datasets created or modified using the public [XMLA endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported.\n

", "operationId": "Datasets_GetParameters", "consumes": [], "produces": [ @@ -1585,7 +1585,7 @@ "Datasets" ], "summary": "Updates the parameters values for the specified dataset from **My workspace**.", - "description": "\n> [!NOTE]\n> We recommend using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with this API call.\n\n> [!IMPORTANT]\n>\n> - If you're using **enhanced dataset metadata**, refresh the dataset to apply the new parameter values.\n> - If you're not using **enhanced dataset metadata**, wait 30 minutes for the update data sources operation to complete, and then refresh the dataset.\n\n## Permissions\n\nThe user must be the dataset owner.\n\n## Required Scope\n\nDataset.ReadWrite.All\n\n## Limitations\n\n- Datasets created using the public [XMLA endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. To make changes to those data sources, the admin must use the Azure Analysis Services client library for Tabular Object Model.\n- [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections are only supported with [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata).\n- Datasets with Azure Analysis Services live connections aren't supported.\n- Maximum of 100 parameters per request.\n- All specified parameters must exist in the dataset.\n- Parameters values should be of the expected type.\n- The parameter list can't be empty or include duplicate parameters.\n- Parameters names are case-sensitive.\n- Parameter `IsRequired` must have a non-empty value.\n- The parameter types `Any` and `Binary` can't be updated.\n

", + "description": "\n> [!NOTE]\n> We recommend using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with this API call.\n\n> [!IMPORTANT]\n>\n> - If you're using **enhanced dataset metadata**, refresh the dataset to apply the new parameter values.\n> - If you're not using **enhanced dataset metadata**, wait 30 minutes for the update data sources operation to complete, and then refresh the dataset.\n\n## Permissions\n\nThe user must be the dataset owner.\n\n## Required Scope\n\nDataset.ReadWrite.All\n\n## Limitations\n\n- Datasets created or modified using the public [XMLA endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. To make changes to those datasets, the admin must use the Azure Analysis Services client library for Tabular Object Model.\n- [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections are only supported with [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata).\n- Datasets with Azure Analysis Services live connections aren't supported.\n- Maximum of 100 parameters per request.\n- All specified parameters must exist in the dataset.\n- Parameters values should be of the expected type.\n- The parameter list can't be empty or include duplicate parameters.\n- Parameters names are case-sensitive.\n- Parameter `IsRequired` must have a non-empty value.\n- The parameter types `Any` and `Binary` can't be updated.\n

", "operationId": "Datasets_UpdateParameters", "consumes": [ "application/json" @@ -1897,7 +1897,7 @@ "Datasets" ], "summary": "Updates the data sources of the specified dataset from **My workspace**.", - "description": "\n> [!NOTE]\n> We recommend using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with this API call.\n\n> [!IMPORTANT]\n>\n> - The original data source and the new data source must have the exact same schema.\n> - If you're using **enhanced dataset metadata**, refresh the dataset to get data from the new data sources.\n> - If you're not using **enhanced dataset metadata**, wait 30 minutes for the update data sources operation to complete, and then refresh the dataset.\n\n## Permissions\n\nThe user must be the dataset owner.\n\n## Limitations\n\n- Datasets created using the public [XMLA endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. To make changes to those data sources, the admin must use the Azure Analysis Services client library for Tabular Object Model.\n- Only these data sources are supported: SQL Server, Azure SQL Server, Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and SAP HANA. For other data sources, use the [Update Parameters](/rest/api/power-bi/datasets/update-parameters) API call.\n- Changing the data source type isn't supported.\n- Data sources that contain parameters in the connection string aren't supported.\n- Updating data sources that are part of merged or joined tables is only supported if you're using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata).\n- For an Advanced Query that references multiple data sources, only the first data source will be updated. To overcome this limitation, define the data source as a parameter and use the [Update Parameters](/rest/api/power-bi/datasets/update-parameters) API call.\n- Datasets with incremental refresh policy are not fully supported, calling this API may not work as expected and result of partial datasources update, to overcome this you can try run a dataset refresh before calling this API.\n\n## Required Scope\n\nDataset.ReadWrite.All\n

", + "description": "\n> [!NOTE]\n> We recommend using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with this API call.\n\n> [!IMPORTANT]\n>\n> - The original data source and the new data source must have the exact same schema.\n> - If you're using **enhanced dataset metadata**, refresh the dataset to get data from the new data sources.\n> - If you're not using **enhanced dataset metadata**, wait 30 minutes for the update data sources operation to complete, and then refresh the dataset.\n\n## Permissions\n\nThe user must be the dataset owner.\n\n## Limitations\n\n- Datasets created or modified using the public [XMLA endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. To make changes to those data sources, the admin must use the Azure Analysis Services client library for Tabular Object Model.\n- Only these data sources are supported: SQL Server, Azure SQL Server, Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and SAP HANA. For other data sources, use the [Update Parameters](/rest/api/power-bi/datasets/update-parameters) API call.\n- Changing the data source type isn't supported.\n- Data sources that contain parameters in the connection string aren't supported.\n- Updating data sources that are part of merged or joined tables is only supported if you're using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata).\n- For an Advanced Query that references multiple data sources, only the first data source will be updated. To overcome this limitation, define the data source as a parameter and use the [Update Parameters](/rest/api/power-bi/datasets/update-parameters) API call.\n- Datasets with incremental refresh policy are not fully supported, calling this API may not work as expected and result of partial datasources update, to overcome this you can try run a dataset refresh before calling this API.\n\n## Required Scope\n\nDataset.ReadWrite.All\n

", "operationId": "Datasets_UpdateDatasources", "consumes": [ "application/json" @@ -5744,7 +5744,7 @@ "Datasets" ], "summary": "Returns a list of parameters for the specified dataset from the specified workspace.", - "description": "\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nDataset.Read.All or Dataset.ReadWrite.All\n\n## Limitations\n\nDatasets with SQL, Oracle, Teradata, and SAP HANA [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections aren't supported.\n

", + "description": "\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nDataset.Read.All or Dataset.ReadWrite.All\n\n## Limitations\n\n- Datasets with SQL, Oracle, Teradata, and SAP HANA [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections aren't supported.\n- Datasets created or modified using the public [XMLA endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported.\n

", "operationId": "Datasets_GetParametersInGroup", "consumes": [], "produces": [ @@ -5835,7 +5835,7 @@ "Datasets" ], "summary": "Updates the parameters values for the specified dataset from the specified workspace.", - "description": "\n> [!NOTE]\n> We recommend using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with this API call.\n\n> [!IMPORTANT]\n>\n> - If you're using **enhanced dataset metadata**, refresh the dataset to apply the new parameter values.\n> - If you're not using **enhanced dataset metadata**, wait 30 minutes for the update data sources operation to complete, and then refresh the dataset.\n\n## Permissions\n\n- The user must be the dataset owner.\n- This API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nDataset.ReadWrite.All\n\n## Limitations\n\n- Datasets created using the public [XMLA endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. To make changes to those data sources, the admin must use the Azure Analysis Services client library for Tabular Object Model.\n- [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections are only supported with [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata).\n- Datasets with Azure Analysis Services live connections aren't supported.\n- Maximum of 100 parameters per request.\n- All specified parameters must exist in the dataset.\n- Parameters values should be of the expected type.\n- The parameter list can't be empty or include duplicate parameters.\n- Parameters names are case-sensitive.\n- Parameter `IsRequired` must have a non-empty value.\n- The parameter types `Any` and `Binary` can't be updated.\n

", + "description": "\n> [!NOTE]\n> We recommend using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with this API call.\n\n> [!IMPORTANT]\n>\n> - If you're using **enhanced dataset metadata**, refresh the dataset to apply the new parameter values.\n> - If you're not using **enhanced dataset metadata**, wait 30 minutes for the update data sources operation to complete, and then refresh the dataset.\n\n## Permissions\n\n- The user must be the dataset owner.\n- This API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nDataset.ReadWrite.All\n\n## Limitations\n\n- Datasets created or modified using the public [XMLA endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. To make changes to those datsets, the admin must use the Azure Analysis Services client library for Tabular Object Model.\n- [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections are only supported with [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata).\n- Datasets with Azure Analysis Services live connections aren't supported.\n- Maximum of 100 parameters per request.\n- All specified parameters must exist in the dataset.\n- Parameters values should be of the expected type.\n- The parameter list can't be empty or include duplicate parameters.\n- Parameters names are case-sensitive.\n- Parameter `IsRequired` must have a non-empty value.\n- The parameter types `Any` and `Binary` can't be updated.\n

", "operationId": "Datasets_UpdateParametersInGroup", "consumes": [ "application/json" @@ -6188,7 +6188,7 @@ "Datasets" ], "summary": "Updates the data sources of the specified dataset from the specified workspace.", - "description": "\n> [!NOTE]\n> We recommend using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with this API call.\n\n> [!IMPORTANT]\n>\n> - The original data source and the new data source must have the exact same schema.\n> - If you're using **enhanced dataset metadata**, refresh the dataset to get data from the new data sources.\n> - If you're not using **enhanced dataset metadata**, wait 30 minutes for the update data sources operation to complete, and then refresh the dataset.\n\n## Permissions\n\n- The user must be the dataset owner.\n- This API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nDataset.ReadWrite.All\n\n## Limitations\n\n- Datasets created using the public [XMLA endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. To make changes to those data sources, the admin must use the Azure Analysis Services client library for Tabular Object Model.\n- Only these data sources are supported: SQL Server, Azure SQL Server, Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and SAP HANA. For other data sources, use the [Update Parameters In Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call.\n- Changing the data source type isn't supported.\n- Data sources that contain parameters in the connection string aren't supported.\n- Updating data sources that are part of merged or joined tables is only supported if you're using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata).\n- For an Advanced Query that reference multiple data sources, only the first data source will be updated. To overcome this limitation, define the data source as a parameter and use the [Update Parameters In Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call.\n- Datasets with incremental refresh policy are not fully supported, calling this API may not work as expected and result of partial datasources update, to overcome this you can try run a dataset refresh before calling this API.\n

", + "description": "\n> [!NOTE]\n> We recommend using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with this API call.\n\n> [!IMPORTANT]\n>\n> - The original data source and the new data source must have the exact same schema.\n> - If you're using **enhanced dataset metadata**, refresh the dataset to get data from the new data sources.\n> - If you're not using **enhanced dataset metadata**, wait 30 minutes for the update data sources operation to complete, and then refresh the dataset.\n\n## Permissions\n\n- The user must be the dataset owner.\n- This API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nDataset.ReadWrite.All\n\n## Limitations\n\n- Datasets created or modified using the public [XMLA endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. To make changes to those data sources, the admin must use the Azure Analysis Services client library for Tabular Object Model.\n- Only these data sources are supported: SQL Server, Azure SQL Server, Azure Analysis Services, Azure Synapse, OData, SharePoint, Teradata, and SAP HANA. For other data sources, use the [Update Parameters In Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call.\n- Changing the data source type isn't supported.\n- Data sources that contain parameters in the connection string aren't supported.\n- Updating data sources that are part of merged or joined tables is only supported if you're using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata).\n- For an Advanced Query that reference multiple data sources, only the first data source will be updated. To overcome this limitation, define the data source as a parameter and use the [Update Parameters In Group](/rest/api/power-bi/datasets/update-parameters-in-group) API call.\n- Datasets with incremental refresh policy are not fully supported, calling this API may not work as expected and result of partial datasources update, to overcome this you can try run a dataset refresh before calling this API.\n

", "operationId": "Datasets_UpdateDatasourcesInGroup", "consumes": [ "application/json" From 9efcc0d9fd51e2e657dbf852ec790d2cfaea3c57 Mon Sep 17 00:00:00 2001 From: Mahir Diab Date: Sun, 10 Mar 2024 17:24:55 +0000 Subject: [PATCH 25/35] Merged PR 530484: [Documentation] Fix Typo [Documentation] Fix Typo --- sdk/PowerBI.Api/Source/DatasetsOperations.cs | 2 +- sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs | 4 ++-- sdk/PowerBI.Api/Source/IDatasetsOperations.cs | 5 +++-- sdk/swaggers/swagger.json | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/sdk/PowerBI.Api/Source/DatasetsOperations.cs b/sdk/PowerBI.Api/Source/DatasetsOperations.cs index de3032cf..46afc2c6 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperations.cs @@ -8596,7 +8596,7 @@ public DatasetsOperations(PowerBIClient client) /// /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those datsets, the admin must use the Azure Analysis + /// To make changes to those datasets, the admin must use the Azure Analysis /// Services client library for Tabular Object Model. /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections are only supported with [enhanced dataset diff --git a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs index 93c2797a..c9b6a3c3 100644 --- a/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/DatasetsOperationsExtensions.cs @@ -3977,7 +3977,7 @@ public static MashupParameters GetParametersInGroup(this IDatasetsOperations ope /// /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those datsets, the admin must use the Azure Analysis + /// To make changes to those datasets, the admin must use the Azure Analysis /// Services client library for Tabular Object Model. /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections are only supported with [enhanced dataset @@ -4041,7 +4041,7 @@ public static void UpdateParametersInGroup(this IDatasetsOperations operations, /// /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. - /// To make changes to those datsets, the admin must use the Azure Analysis + /// To make changes to those datasets, the admin must use the Azure Analysis /// Services client library for Tabular Object Model. /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections are only supported with [enhanced dataset diff --git a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs index dcf5ce10..bcc281d5 100644 --- a/sdk/PowerBI.Api/Source/IDatasetsOperations.cs +++ b/sdk/PowerBI.Api/Source/IDatasetsOperations.cs @@ -2256,8 +2256,9 @@ public partial interface IDatasetsOperations /// /// - Datasets created or modified using the public [XMLA /// endpoint](/power-bi/admin/service-premium-connect-tools) aren't - /// supported. To make changes to those datsets, the admin must use the - /// Azure Analysis Services client library for Tabular Object Model. + /// supported. To make changes to those datasets, the admin must use + /// the Azure Analysis Services client library for Tabular Object + /// Model. /// - [DirectQuery](/power-bi/connect-data/desktop-directquery-about) /// connections are only supported with [enhanced dataset /// metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata). diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index d21d50d9..b52424b3 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -5835,7 +5835,7 @@ "Datasets" ], "summary": "Updates the parameters values for the specified dataset from the specified workspace.", - "description": "\n> [!NOTE]\n> We recommend using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with this API call.\n\n> [!IMPORTANT]\n>\n> - If you're using **enhanced dataset metadata**, refresh the dataset to apply the new parameter values.\n> - If you're not using **enhanced dataset metadata**, wait 30 minutes for the update data sources operation to complete, and then refresh the dataset.\n\n## Permissions\n\n- The user must be the dataset owner.\n- This API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nDataset.ReadWrite.All\n\n## Limitations\n\n- Datasets created or modified using the public [XMLA endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. To make changes to those datsets, the admin must use the Azure Analysis Services client library for Tabular Object Model.\n- [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections are only supported with [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata).\n- Datasets with Azure Analysis Services live connections aren't supported.\n- Maximum of 100 parameters per request.\n- All specified parameters must exist in the dataset.\n- Parameters values should be of the expected type.\n- The parameter list can't be empty or include duplicate parameters.\n- Parameters names are case-sensitive.\n- Parameter `IsRequired` must have a non-empty value.\n- The parameter types `Any` and `Binary` can't be updated.\n

", + "description": "\n> [!NOTE]\n> We recommend using [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata) with this API call.\n\n> [!IMPORTANT]\n>\n> - If you're using **enhanced dataset metadata**, refresh the dataset to apply the new parameter values.\n> - If you're not using **enhanced dataset metadata**, wait 30 minutes for the update data sources operation to complete, and then refresh the dataset.\n\n## Permissions\n\n- The user must be the dataset owner.\n- This API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n## Required Scope\n\nDataset.ReadWrite.All\n\n## Limitations\n\n- Datasets created or modified using the public [XMLA endpoint](/power-bi/admin/service-premium-connect-tools) aren't supported. To make changes to those datasets, the admin must use the Azure Analysis Services client library for Tabular Object Model.\n- [DirectQuery](/power-bi/connect-data/desktop-directquery-about) connections are only supported with [enhanced dataset metadata](/power-bi/connect-data/desktop-enhanced-dataset-metadata).\n- Datasets with Azure Analysis Services live connections aren't supported.\n- Maximum of 100 parameters per request.\n- All specified parameters must exist in the dataset.\n- Parameters values should be of the expected type.\n- The parameter list can't be empty or include duplicate parameters.\n- Parameters names are case-sensitive.\n- Parameter `IsRequired` must have a non-empty value.\n- The parameter types `Any` and `Binary` can't be updated.\n

", "operationId": "Datasets_UpdateParametersInGroup", "consumes": [ "application/json" From 00b40fbea6bd0400192864a042f8132c49bd5dcf Mon Sep 17 00:00:00 2001 From: Shunbo Cui Date: Sun, 7 Apr 2024 12:16:11 +0000 Subject: [PATCH 26/35] Merged PR 540988: Add isOwnedByMe Property to report object. PBIRB lists items in MyWorkspace that are from other workspaces, when these items are shared. We want to add a filter to not show items that are shared. So need isOwnedByMe Property in Report object. --- sdk/PowerBI.Api/Source/Models/AdminReport.cs | 12 +++++++++++- sdk/PowerBI.Api/Source/Models/Report.cs | 12 +++++++++++- .../Source/Models/ReportBaseProperties.cs | 12 +++++++++++- sdk/PowerBI.Api/Source/Models/WorkspaceInfoReport.cs | 12 +++++++++++- sdk/swaggers/swagger.json | 4 ++++ 5 files changed, 48 insertions(+), 4 deletions(-) diff --git a/sdk/PowerBI.Api/Source/Models/AdminReport.cs b/sdk/PowerBI.Api/Source/Models/AdminReport.cs index 215ffdf0..74aaba35 100644 --- a/sdk/PowerBI.Api/Source/Models/AdminReport.cs +++ b/sdk/PowerBI.Api/Source/Models/AdminReport.cs @@ -40,6 +40,8 @@ public AdminReport() /// 'PaginatedReport', 'PowerBIReport' /// The actual report ID when the /// workspace is published as an app. + /// Determine if the report is created by the + /// current user. /// The web URL of the report /// The embed URL of the report /// The report owner. Available only for @@ -67,7 +69,7 @@ public AdminReport() /// API call. /// The workspace ID (GUID) of the report. /// This property will be returned only in GetReportsAsAdmin. - public AdminReport(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), System.Guid? originalReportId = default(System.Guid?), string webUrl = default(string), string embedUrl = default(string), string createdBy = default(string), string modifiedBy = default(string), System.DateTime? createdDateTime = default(System.DateTime?), System.DateTime? modifiedDateTime = default(System.DateTime?), IList users = default(IList), IList subscriptions = default(IList), System.Guid? workspaceId = default(System.Guid?)) + public AdminReport(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), System.Guid? originalReportId = default(System.Guid?), bool? isOwnedByMe = default(bool?), string webUrl = default(string), string embedUrl = default(string), string createdBy = default(string), string modifiedBy = default(string), System.DateTime? createdDateTime = default(System.DateTime?), System.DateTime? modifiedDateTime = default(System.DateTime?), IList users = default(IList), IList subscriptions = default(IList), System.Guid? workspaceId = default(System.Guid?)) { Id = id; Name = name; @@ -76,6 +78,7 @@ public AdminReport() Description = description; ReportType = reportType; OriginalReportId = originalReportId; + IsOwnedByMe = isOwnedByMe; WebUrl = webUrl; EmbedUrl = embedUrl; CreatedBy = createdBy; @@ -138,6 +141,13 @@ public AdminReport() [JsonProperty(PropertyName = "originalReportId")] public System.Guid? OriginalReportId { get; set; } + /// + /// Gets or sets determine if the report is created by the current + /// user. + /// + [JsonProperty(PropertyName = "isOwnedByMe")] + public bool? IsOwnedByMe { get; set; } + /// /// Gets or sets the web URL of the report /// diff --git a/sdk/PowerBI.Api/Source/Models/Report.cs b/sdk/PowerBI.Api/Source/Models/Report.cs index 495782b9..527d788b 100644 --- a/sdk/PowerBI.Api/Source/Models/Report.cs +++ b/sdk/PowerBI.Api/Source/Models/Report.cs @@ -39,6 +39,8 @@ public Report() /// 'PaginatedReport', 'PowerBIReport' /// The actual report ID when the /// workspace is published as an app. + /// Determine if the report is created by the + /// current user. /// The web URL of the report /// The embed URL of the report /// (Empty value) The user access details for a @@ -56,7 +58,7 @@ public Report() /// report by using the [Get Report Subscriptions as /// Admin](/rest/api/power-bi/admin/reports-get-report-subscriptions-as-admin) /// API call. - public Report(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), System.Guid? originalReportId = default(System.Guid?), string webUrl = default(string), string embedUrl = default(string), IList users = default(IList), IList subscriptions = default(IList)) + public Report(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), System.Guid? originalReportId = default(System.Guid?), bool? isOwnedByMe = default(bool?), string webUrl = default(string), string embedUrl = default(string), IList users = default(IList), IList subscriptions = default(IList)) { Id = id; Name = name; @@ -65,6 +67,7 @@ public Report() Description = description; ReportType = reportType; OriginalReportId = originalReportId; + IsOwnedByMe = isOwnedByMe; WebUrl = webUrl; EmbedUrl = embedUrl; Users = users; @@ -122,6 +125,13 @@ public Report() [JsonProperty(PropertyName = "originalReportId")] public System.Guid? OriginalReportId { get; set; } + /// + /// Gets or sets determine if the report is created by the current + /// user. + /// + [JsonProperty(PropertyName = "isOwnedByMe")] + public bool? IsOwnedByMe { get; set; } + /// /// Gets or sets the web URL of the report /// diff --git a/sdk/PowerBI.Api/Source/Models/ReportBaseProperties.cs b/sdk/PowerBI.Api/Source/Models/ReportBaseProperties.cs index 2f4b01ff..88195e3d 100644 --- a/sdk/PowerBI.Api/Source/Models/ReportBaseProperties.cs +++ b/sdk/PowerBI.Api/Source/Models/ReportBaseProperties.cs @@ -38,7 +38,9 @@ public ReportBaseProperties() /// 'PaginatedReport', 'PowerBIReport' /// The actual report ID when the /// workspace is published as an app. - public ReportBaseProperties(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), System.Guid? originalReportId = default(System.Guid?)) + /// Determine if the report is created by the + /// current user. + public ReportBaseProperties(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), System.Guid? originalReportId = default(System.Guid?), bool? isOwnedByMe = default(bool?)) { Id = id; Name = name; @@ -47,6 +49,7 @@ public ReportBaseProperties() Description = description; ReportType = reportType; OriginalReportId = originalReportId; + IsOwnedByMe = isOwnedByMe; CustomInit(); } @@ -100,6 +103,13 @@ public ReportBaseProperties() [JsonProperty(PropertyName = "originalReportId")] public System.Guid? OriginalReportId { get; set; } + /// + /// Gets or sets determine if the report is created by the current + /// user. + /// + [JsonProperty(PropertyName = "isOwnedByMe")] + public bool? IsOwnedByMe { get; set; } + /// /// Validate the object. /// diff --git a/sdk/PowerBI.Api/Source/Models/WorkspaceInfoReport.cs b/sdk/PowerBI.Api/Source/Models/WorkspaceInfoReport.cs index 684fa0b1..ae82e2c3 100644 --- a/sdk/PowerBI.Api/Source/Models/WorkspaceInfoReport.cs +++ b/sdk/PowerBI.Api/Source/Models/WorkspaceInfoReport.cs @@ -40,6 +40,8 @@ public WorkspaceInfoReport() /// 'PaginatedReport', 'PowerBIReport' /// The actual report ID when the /// workspace is published as an app. + /// Determine if the report is created by the + /// current user. /// The report owner. Available only for /// reports created after June 2019. /// The last user that modified the @@ -65,7 +67,7 @@ public WorkspaceInfoReport() /// The workspace ID of the related /// dataset, returned only if the related dataset belongs to a /// different workspace - public WorkspaceInfoReport(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), System.Guid? originalReportId = default(System.Guid?), string createdBy = default(string), string modifiedBy = default(string), System.DateTime? createdDateTime = default(System.DateTime?), System.DateTime? modifiedDateTime = default(System.DateTime?), string createdById = default(string), string modifiedById = default(string), EndorsementDetails endorsementDetails = default(EndorsementDetails), SensitivityLabel sensitivityLabel = default(SensitivityLabel), IList users = default(IList), System.Guid? datasetWorkspaceId = default(System.Guid?)) + public WorkspaceInfoReport(System.Guid id, string name = default(string), string datasetId = default(string), string appId = default(string), string description = default(string), string reportType = default(string), System.Guid? originalReportId = default(System.Guid?), bool? isOwnedByMe = default(bool?), string createdBy = default(string), string modifiedBy = default(string), System.DateTime? createdDateTime = default(System.DateTime?), System.DateTime? modifiedDateTime = default(System.DateTime?), string createdById = default(string), string modifiedById = default(string), EndorsementDetails endorsementDetails = default(EndorsementDetails), SensitivityLabel sensitivityLabel = default(SensitivityLabel), IList users = default(IList), System.Guid? datasetWorkspaceId = default(System.Guid?)) { Id = id; Name = name; @@ -74,6 +76,7 @@ public WorkspaceInfoReport() Description = description; ReportType = reportType; OriginalReportId = originalReportId; + IsOwnedByMe = isOwnedByMe; CreatedBy = createdBy; ModifiedBy = modifiedBy; CreatedDateTime = createdDateTime; @@ -137,6 +140,13 @@ public WorkspaceInfoReport() [JsonProperty(PropertyName = "originalReportId")] public System.Guid? OriginalReportId { get; set; } + /// + /// Gets or sets determine if the report is created by the current + /// user. + /// + [JsonProperty(PropertyName = "isOwnedByMe")] + public bool? IsOwnedByMe { get; set; } + /// /// Gets or sets the report owner. Available only for reports created /// after June 2019. diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index b52424b3..d12267bf 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -24007,6 +24007,10 @@ "type": "string", "format": "uuid", "description": "The actual report ID when the workspace is published as an app." + }, + "isOwnedByMe": { + "type": "boolean", + "description": "Determine if the report is created by the current user." } } }, From 0ef0a174a56ea1eef0364bac4995ae79ab25c7ff Mon Sep 17 00:00:00 2001 From: Kotana Sai Date: Wed, 17 Apr 2024 11:35:52 +0000 Subject: [PATCH 27/35] Merged PR 548024: [C# SDK]: Enable CodeQL in official pipeline Referred https://dev.azure.com/powerbi/Embedded/_git/powerbi-client-vue-js/pullrequest/398374 to enable CodeQL Related work items: #1374549 --- .pipelines/OneBranch.Official.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.pipelines/OneBranch.Official.yml b/.pipelines/OneBranch.Official.yml index 38529d19..7af1976c 100644 --- a/.pipelines/OneBranch.Official.yml +++ b/.pipelines/OneBranch.Official.yml @@ -49,6 +49,9 @@ extends: globalSdl: # https://aka.ms/obpipelines/sdl tsa: enabled: true + codeql: + compiled: + enabled: true cg: failOnAlert: false From f118b8eee1d26d2e99d6e20dc3b3604d71bdfb7e Mon Sep 17 00:00:00 2001 From: Maksim Melnikov Date: Mon, 22 Apr 2024 16:22:02 +0000 Subject: [PATCH 28/35] Merged PR 524148: Add support for importing files to a subfolderObjectId ## Description This pull request is required to be able to add a subfolderObjectId when publishing reports. ## Question ### What inside? - [ ] Bug Fixes? - [x] New Features? - [x] Documentation? ### Is pull request totally generated from swagger file? - [ ] Yes. - [x] No, part of it is auto-generated. ### Backward compatibility break? - [ ] Yes. // No, the PR doesn't break the compatibility --- sdk/PowerBI.Api.Tests/ImportsTests.cs | 17 +++++++++++ .../Extensions/ImportsOperationsExtensions.cs | 28 +++++++++++++------ sdk/PowerBI.Api/Imports/IImportsOperations.cs | 10 +++++-- sdk/PowerBI.Api/Imports/ImportsOperations.cs | 28 +++++++++++++------ .../Imports/ImportsOperationsExtensions.cs | 28 +++++++++++++------ sdk/PowerBI.Api/Source/IImportsOperations.cs | 10 +++++-- sdk/PowerBI.Api/Source/ImportsOperations.cs | 20 +++++++++++-- .../Source/ImportsOperationsExtensions.cs | 28 +++++++++++++------ sdk/swaggers/swagger.json | 16 +++++++++++ 9 files changed, 147 insertions(+), 38 deletions(-) diff --git a/sdk/PowerBI.Api.Tests/ImportsTests.cs b/sdk/PowerBI.Api.Tests/ImportsTests.cs index c18ddbd5..01988f07 100644 --- a/sdk/PowerBI.Api.Tests/ImportsTests.cs +++ b/sdk/PowerBI.Api.Tests/ImportsTests.cs @@ -259,6 +259,23 @@ public async Task PostImportWithFileWithNameAndConflictAndSkipReport() } } + [TestMethod] + public async Task PostImportWithFileWithNameAndSubfolderObjectId() + { + var datasetDisplayName = "TestDataset"; + Guid subfolderObjectId = new Guid(); + var importResponse = CreateSampleImportResponse(); + + using (var handler = new FakeHttpClientHandler(importResponse)) + using (var client = CreatePowerBIClient(handler)) + using (var stream = new MemoryStream()) + { + await client.Imports.PostImportWithFileAsync(stream, datasetDisplayName, subfolderObjectId: subfolderObjectId); + var expectedRequesetUrl = $"https://api.powerbi.com/v1.0/myorg/imports?datasetDisplayName={datasetDisplayName}&subfolderObjectId={subfolderObjectId}"; + Assert.AreEqual(expectedRequesetUrl, handler.Request.RequestUri.ToString()); + } + } + private static HttpResponseMessage CreateSampleImportResponse(string name = default(string)) { var import = new Import diff --git a/sdk/PowerBI.Api/Extensions/ImportsOperationsExtensions.cs b/sdk/PowerBI.Api/Extensions/ImportsOperationsExtensions.cs index 808ffedd..d9ac8997 100644 --- a/sdk/PowerBI.Api/Extensions/ImportsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Extensions/ImportsOperationsExtensions.cs @@ -72,9 +72,12 @@ public static Imports GetImports(this IImportsOperations operations, Guid groupI /// /// Determines whether to override existing label on model during republish of PBIX file, service default value is true. /// - public static Import PostImport(this IImportsOperations operations, Guid groupId, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?)) + /// + /// The subfolder ID to import the file to subfolder. + /// + public static Import PostImport(this IImportsOperations operations, Guid groupId, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?)) { - return operations.PostImportAsync(groupId, datasetDisplayName, importInfo, nameConflict, skipReport, overrideReportLabel, overrideModelLabel).GetAwaiter().GetResult(); + return operations.PostImportAsync(groupId, datasetDisplayName, importInfo, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId).GetAwaiter().GetResult(); } /// @@ -104,12 +107,15 @@ public static Imports GetImports(this IImportsOperations operations, Guid groupI /// /// Determines whether to override existing label on model during republish of PBIX file, service default value is true. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// /// The cancellation token. /// - public static async Task PostImportAsync(this IImportsOperations operations, Guid groupId, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task PostImportAsync(this IImportsOperations operations, Guid groupId, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.PostImportInGroupWithHttpMessagesAsync(groupId, datasetDisplayName, importInfo, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.PostImportInGroupWithHttpMessagesAsync(groupId, datasetDisplayName, importInfo, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -216,9 +222,12 @@ public static TemporaryUploadLocation CreateTemporaryUploadLocation(this IImport /// /// Determines whether to override existing label on model during republish of PBIX file, service default value is true. /// - public static Import PostImportWithFile(this IImportsOperations operations, Guid groupId, Stream fileStream, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?)) + /// + /// The subfolder ID to import the file to subfolder. + /// + public static Import PostImportWithFile(this IImportsOperations operations, Guid groupId, Stream fileStream, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?)) { - return Task.Factory.StartNew(s => ((IImportsOperations)s).PostImportFileWithHttpMessage(groupId, fileStream, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult().Body; + return Task.Factory.StartNew(s => ((IImportsOperations)s).PostImportFileWithHttpMessage(groupId, fileStream, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult().Body; } /// @@ -249,12 +258,15 @@ public static TemporaryUploadLocation CreateTemporaryUploadLocation(this IImport /// /// Determines whether to override existing label on model during republish of PBIX file, service default value is true. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// /// The cancellation token. /// - public static async Task PostImportWithFileAsync(this IImportsOperations operations, Guid groupId, Stream fileStream, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task PostImportWithFileAsync(this IImportsOperations operations, Guid groupId, Stream fileStream, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.PostImportFileWithHttpMessage(groupId, fileStream, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.PostImportFileWithHttpMessage(groupId, fileStream, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/PowerBI.Api/Imports/IImportsOperations.cs b/sdk/PowerBI.Api/Imports/IImportsOperations.cs index ba7f5f05..fb46752d 100644 --- a/sdk/PowerBI.Api/Imports/IImportsOperations.cs +++ b/sdk/PowerBI.Api/Imports/IImportsOperations.cs @@ -34,10 +34,13 @@ public partial interface IImportsOperations /// /// Determines whether to override existing label on model during republish of PBIX file, service default value is true. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// Optional custom headers /// Optional cancellation token /// - Task> PostImportFileWithHttpMessage(Stream file, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> PostImportFileWithHttpMessage(Stream file, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Uploads a PBIX file to the specified group @@ -63,12 +66,15 @@ public partial interface IImportsOperations /// /// Determines whether to override existing label on model during republish of PBIX file, service default value is true. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// /// Optional custom headers /// /// /// Optional cancellation token /// - Task> PostImportFileWithHttpMessage(Guid? groupId, Stream file, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> PostImportFileWithHttpMessage(Guid? groupId, Stream file, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); } } diff --git a/sdk/PowerBI.Api/Imports/ImportsOperations.cs b/sdk/PowerBI.Api/Imports/ImportsOperations.cs index 438df78f..2a0d9ea0 100644 --- a/sdk/PowerBI.Api/Imports/ImportsOperations.cs +++ b/sdk/PowerBI.Api/Imports/ImportsOperations.cs @@ -54,13 +54,16 @@ public int PostImportTimeoutInMinutes /// /// Determines whether to override existing label on model during republish of PBIX file, service default value is true. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// /// Optional custom headers /// /// /// Optional cancellation token /// - public async Task> PostImportFileWithHttpMessage(Stream file, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> PostImportFileWithHttpMessage(Stream file, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { return await PostImportFileWithHttpMessage( groupId: null, @@ -70,6 +73,7 @@ public int PostImportTimeoutInMinutes skipReport: skipReport, overrideReportLabel: overrideReportLabel, overrideModelLabel: overrideModelLabel, + subfolderObjectId: subfolderObjectId, customHeaders: customHeaders, cancellationToken: cancellationToken); } @@ -98,13 +102,16 @@ public int PostImportTimeoutInMinutes /// /// Determines whether to override existing label on model during republish of PBIX file, service default value is true. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// /// Optional custom headers /// /// /// Optional cancellation token /// - public async Task> PostImportFileWithHttpMessage(Guid? groupId, Stream file, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> PostImportFileWithHttpMessage(Guid? groupId, Stream file, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing string _invocationId = null; @@ -119,6 +126,7 @@ public int PostImportTimeoutInMinutes tracingParameters.Add("skipReport", skipReport); tracingParameters.Add("overrideReportLabel", overrideReportLabel); tracingParameters.Add("overrideModelLabel", overrideModelLabel); + tracingParameters.Add("subfolderObjectId", subfolderObjectId); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "PostImport", tracingParameters); } @@ -135,15 +143,15 @@ public int PostImportTimeoutInMinutes if (file.Length > 1 * GB) { - return await UploadLargeFile(groupId, file, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, customHeaders, cancellationToken); + return await UploadLargeFile(groupId, file, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId, customHeaders, cancellationToken); } else { - return await UploadFile(groupId, file, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, customHeaders, cancellationToken); + return await UploadFile(groupId, file, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId, customHeaders, cancellationToken); } } - private async Task> UploadFile(Guid? groupId, Stream file, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + private async Task> UploadFile(Guid? groupId, Stream file, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Tracing bool _shouldTrace = ServiceClientTracing.IsEnabled; @@ -179,6 +187,10 @@ public int PostImportTimeoutInMinutes { _queryParameters.Add(string.Format("overrideModelLabel={0}", overrideModelLabel)); } + if (subfolderObjectId != null) + { + _queryParameters.Add(string.Format("subfolderObjectId={0}", subfolderObjectId)); + } if (_queryParameters.Count > 0) { @@ -279,7 +291,7 @@ public int PostImportTimeoutInMinutes } - private async Task> UploadLargeFile(Guid? groupId, Stream file, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + private async Task> UploadLargeFile(Guid? groupId, Stream file, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { TemporaryUploadLocation temporaryUploadLocation; @@ -312,11 +324,11 @@ public int PostImportTimeoutInMinutes if (groupId == null) { - return await powerBIClient.Imports.PostImportWithHttpMessagesAsync(datasetDisplayName, new ImportInfo { FileUrl = temporaryUploadLocation.Url }, nameConflict, skipReport, overrideReportLabel, overrideModelLabel); + return await powerBIClient.Imports.PostImportWithHttpMessagesAsync(datasetDisplayName, new ImportInfo { FileUrl = temporaryUploadLocation.Url }, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId); } else { - return await powerBIClient.Imports.PostImportInGroupWithHttpMessagesAsync(groupId.Value, datasetDisplayName, new ImportInfo { FileUrl = temporaryUploadLocation.Url }, nameConflict, skipReport, overrideReportLabel, overrideModelLabel); + return await powerBIClient.Imports.PostImportInGroupWithHttpMessagesAsync(groupId.Value, datasetDisplayName, new ImportInfo { FileUrl = temporaryUploadLocation.Url }, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId); } } } diff --git a/sdk/PowerBI.Api/Imports/ImportsOperationsExtensions.cs b/sdk/PowerBI.Api/Imports/ImportsOperationsExtensions.cs index 1d02f5e5..30eada8f 100644 --- a/sdk/PowerBI.Api/Imports/ImportsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Imports/ImportsOperationsExtensions.cs @@ -35,9 +35,12 @@ public static partial class ImportsOperationsExtensions /// /// Determines whether to override existing label on model during republish of PBIX file, service default value is true. /// - public static Import PostImportWithFileInGroup(this IImportsOperations operations, Guid groupId, Stream fileStream, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?)) + /// + /// The subfolder ID to import the file to subfolder. + /// + public static Import PostImportWithFileInGroup(this IImportsOperations operations, Guid groupId, Stream fileStream, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?)) { - return Task.Factory.StartNew(s => ((IImportsOperations)s).PostImportFileWithHttpMessage(groupId, fileStream, datasetDisplayName, nameConflict, skipReport, overrideReportLabel: overrideReportLabel, overrideModelLabel: overrideModelLabel), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult().Body; + return Task.Factory.StartNew(s => ((IImportsOperations)s).PostImportFileWithHttpMessage(groupId, fileStream, datasetDisplayName, nameConflict, skipReport, overrideReportLabel: overrideReportLabel, overrideModelLabel: overrideModelLabel, subfolderObjectId: subfolderObjectId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult().Body; } /// @@ -67,12 +70,15 @@ public static partial class ImportsOperationsExtensions /// /// Determines whether to override existing label on model during republish of PBIX file, service default value is true. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// /// The cancellation token. /// - public static async Task PostImportWithFileAsyncInGroup(this IImportsOperations operations, Guid groupId, Stream fileStream, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task PostImportWithFileAsyncInGroup(this IImportsOperations operations, Guid groupId, Stream fileStream, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.PostImportFileWithHttpMessage(groupId, fileStream, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.PostImportFileWithHttpMessage(groupId, fileStream, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -102,9 +108,12 @@ public static partial class ImportsOperationsExtensions /// /// Determines whether to override existing label on model during republish of PBIX file, service default value is true. /// - public static Import PostImportWithFile(this IImportsOperations operations, Stream fileStream, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?)) + /// + /// The subfolder ID to import the file to subfolder. + /// + public static Import PostImportWithFile(this IImportsOperations operations, Stream fileStream, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?)) { - return Task.Factory.StartNew(s => ((IImportsOperations)s).PostImportFileWithHttpMessage(fileStream, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult().Body; + return Task.Factory.StartNew(s => ((IImportsOperations)s).PostImportFileWithHttpMessage(fileStream, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult().Body; } /// @@ -131,12 +140,15 @@ public static partial class ImportsOperationsExtensions /// /// Determines whether to override existing label on model during republish of PBIX file, service default value is true. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// /// The cancellation token. /// - public static async Task PostImportWithFileAsync(this IImportsOperations operations, Stream fileStream, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task PostImportWithFileAsync(this IImportsOperations operations, Stream fileStream, string datasetDisplayName = default(string), ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Guid? subfolderObjectId = default(Guid?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.PostImportFileWithHttpMessage(fileStream, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.PostImportFileWithHttpMessage(fileStream, datasetDisplayName, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/PowerBI.Api/Source/IImportsOperations.cs b/sdk/PowerBI.Api/Source/IImportsOperations.cs index 64d117e1..e47e4b68 100644 --- a/sdk/PowerBI.Api/Source/IImportsOperations.cs +++ b/sdk/PowerBI.Api/Source/IImportsOperations.cs @@ -114,6 +114,9 @@ public partial interface IImportsOperations /// Whether to override the existing label on a model when republishing /// a Power BI .pbix file. The service default value is `true`. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// /// The headers that will be added to request. /// @@ -129,7 +132,7 @@ public partial interface IImportsOperations /// /// Thrown when a required parameter is null /// - Task> PostImportWithHttpMessagesAsync(string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> PostImportWithHttpMessagesAsync(string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), System.Guid? subfolderObjectId = default(System.Guid?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns the specified import from **My workspace**. /// @@ -323,6 +326,9 @@ public partial interface IImportsOperations /// republishing a Power BI .pbix file. The service default value is /// `true`. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// /// The headers that will be added to request. /// @@ -338,7 +344,7 @@ public partial interface IImportsOperations /// /// Thrown when a required parameter is null /// - Task> PostImportInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + Task> PostImportInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), System.Guid? subfolderObjectId = default(System.Guid?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// /// Returns the specified import from the specified workspace. /// diff --git a/sdk/PowerBI.Api/Source/ImportsOperations.cs b/sdk/PowerBI.Api/Source/ImportsOperations.cs index d6641038..a8119bb6 100644 --- a/sdk/PowerBI.Api/Source/ImportsOperations.cs +++ b/sdk/PowerBI.Api/Source/ImportsOperations.cs @@ -251,6 +251,9 @@ public ImportsOperations(PowerBIClient client) /// Whether to override the existing label on a model when republishing a Power /// BI .pbix file. The service default value is `true`. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// /// Headers that will be added to request. /// @@ -272,7 +275,7 @@ public ImportsOperations(PowerBIClient client) /// /// A response object containing the response body and response headers. /// - public async Task> PostImportWithHttpMessagesAsync(string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> PostImportWithHttpMessagesAsync(string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), System.Guid? subfolderObjectId = default(System.Guid?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (datasetDisplayName == null) { @@ -294,6 +297,7 @@ public ImportsOperations(PowerBIClient client) tracingParameters.Add("skipReport", skipReport); tracingParameters.Add("overrideReportLabel", overrideReportLabel); tracingParameters.Add("overrideModelLabel", overrideModelLabel); + tracingParameters.Add("subfolderObjectId", subfolderObjectId); tracingParameters.Add("importInfo", importInfo); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "PostImport", tracingParameters); @@ -322,6 +326,10 @@ public ImportsOperations(PowerBIClient client) { _queryParameters.Add(string.Format("overrideModelLabel={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(overrideModelLabel, Client.SerializationSettings).Trim('"')))); } + if (subfolderObjectId != null) + { + _queryParameters.Add(string.Format("subfolderObjectId={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(subfolderObjectId, Client.SerializationSettings).Trim('"')))); + } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); @@ -964,6 +972,9 @@ public ImportsOperations(PowerBIClient client) /// Determines whether to override the existing label on a model when /// republishing a Power BI .pbix file. The service default value is `true`. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// /// Headers that will be added to request. /// @@ -985,7 +996,7 @@ public ImportsOperations(PowerBIClient client) /// /// A response object containing the response body and response headers. /// - public async Task> PostImportInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + public async Task> PostImportInGroupWithHttpMessagesAsync(System.Guid groupId, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), System.Guid? subfolderObjectId = default(System.Guid?), Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { if (datasetDisplayName == null) { @@ -1008,6 +1019,7 @@ public ImportsOperations(PowerBIClient client) tracingParameters.Add("skipReport", skipReport); tracingParameters.Add("overrideReportLabel", overrideReportLabel); tracingParameters.Add("overrideModelLabel", overrideModelLabel); + tracingParameters.Add("subfolderObjectId", subfolderObjectId); tracingParameters.Add("importInfo", importInfo); tracingParameters.Add("cancellationToken", cancellationToken); ServiceClientTracing.Enter(_invocationId, this, "PostImportInGroup", tracingParameters); @@ -1037,6 +1049,10 @@ public ImportsOperations(PowerBIClient client) { _queryParameters.Add(string.Format("overrideModelLabel={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(overrideModelLabel, Client.SerializationSettings).Trim('"')))); } + if (subfolderObjectId != null) + { + _queryParameters.Add(string.Format("subfolderObjectId={0}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(subfolderObjectId, Client.SerializationSettings).Trim('"')))); + } if (_queryParameters.Count > 0) { _url += "?" + string.Join("&", _queryParameters); diff --git a/sdk/PowerBI.Api/Source/ImportsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/ImportsOperationsExtensions.cs index ba4de442..3b282b84 100644 --- a/sdk/PowerBI.Api/Source/ImportsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/ImportsOperationsExtensions.cs @@ -132,9 +132,12 @@ public static Imports GetImports(this IImportsOperations operations) /// Whether to override the existing label on a model when republishing a Power /// BI .pbix file. The service default value is `true`. /// - public static Import PostImport(this IImportsOperations operations, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?)) + /// + /// The subfolder ID to import the file to subfolder. + /// + public static Import PostImport(this IImportsOperations operations, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), System.Guid? subfolderObjectId = default(System.Guid?)) { - return operations.PostImportAsync(datasetDisplayName, importInfo, nameConflict, skipReport, overrideReportLabel, overrideModelLabel).GetAwaiter().GetResult(); + return operations.PostImportAsync(datasetDisplayName, importInfo, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId).GetAwaiter().GetResult(); } /// @@ -212,12 +215,15 @@ public static Imports GetImports(this IImportsOperations operations) /// Whether to override the existing label on a model when republishing a Power /// BI .pbix file. The service default value is `true`. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// /// The cancellation token. /// - public static async Task PostImportAsync(this IImportsOperations operations, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task PostImportAsync(this IImportsOperations operations, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), System.Guid? subfolderObjectId = default(System.Guid?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.PostImportWithHttpMessagesAsync(datasetDisplayName, importInfo, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.PostImportWithHttpMessagesAsync(datasetDisplayName, importInfo, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } @@ -505,9 +511,12 @@ public static Imports GetImportsInGroup(this IImportsOperations operations, Syst /// Determines whether to override the existing label on a model when /// republishing a Power BI .pbix file. The service default value is `true`. /// - public static Import PostImportInGroup(this IImportsOperations operations, System.Guid groupId, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?)) + /// + /// The subfolder ID to import the file to subfolder. + /// + public static Import PostImportInGroup(this IImportsOperations operations, System.Guid groupId, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), System.Guid? subfolderObjectId = default(System.Guid?)) { - return operations.PostImportInGroupAsync(groupId, datasetDisplayName, importInfo, nameConflict, skipReport, overrideReportLabel, overrideModelLabel).GetAwaiter().GetResult(); + return operations.PostImportInGroupAsync(groupId, datasetDisplayName, importInfo, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId).GetAwaiter().GetResult(); } /// @@ -596,12 +605,15 @@ public static Imports GetImportsInGroup(this IImportsOperations operations, Syst /// Determines whether to override the existing label on a model when /// republishing a Power BI .pbix file. The service default value is `true`. /// + /// + /// The subfolder ID to import the file to subfolder. + /// /// /// The cancellation token. /// - public static async Task PostImportInGroupAsync(this IImportsOperations operations, System.Guid groupId, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), CancellationToken cancellationToken = default(CancellationToken)) + public static async Task PostImportInGroupAsync(this IImportsOperations operations, System.Guid groupId, string datasetDisplayName, ImportInfo importInfo, ImportConflictHandlerMode? nameConflict = default(ImportConflictHandlerMode?), bool? skipReport = default(bool?), bool? overrideReportLabel = default(bool?), bool? overrideModelLabel = default(bool?), System.Guid? subfolderObjectId = default(System.Guid?), CancellationToken cancellationToken = default(CancellationToken)) { - using (var _result = await operations.PostImportInGroupWithHttpMessagesAsync(groupId, datasetDisplayName, importInfo, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, null, cancellationToken).ConfigureAwait(false)) + using (var _result = await operations.PostImportInGroupWithHttpMessagesAsync(groupId, datasetDisplayName, importInfo, nameConflict, skipReport, overrideReportLabel, overrideModelLabel, subfolderObjectId, null, cancellationToken).ConfigureAwait(false)) { return _result.Body; } diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index d12267bf..2ca96a35 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -2881,6 +2881,14 @@ "description": "Whether to override the existing label on a model when republishing a Power BI .pbix file. The service default value is `true`.", "type": "boolean" }, + { + "name": "subfolderObjectId", + "in": "query", + "required": false, + "description": "The subfolder ID to import the file to subfolder.", + "type": "string", + "format": "uuid" + }, { "name": "importInfo", "in": "body", @@ -6960,6 +6968,14 @@ "description": "Determines whether to override the existing label on a model when republishing a Power BI .pbix file. The service default value is `true`.", "type": "boolean" }, + { + "name": "subfolderObjectId", + "in": "query", + "required": false, + "description": "The subfolder ID to import the file to subfolder.", + "type": "string", + "format": "uuid" + }, { "name": "importInfo", "in": "body", From 67ee5a3a7fb0524cd93ba3bf2e5fe8c8aaf15950 Mon Sep 17 00:00:00 2001 From: Alon Yeshurun Date: Tue, 30 Apr 2024 17:24:26 +0000 Subject: [PATCH 29/35] Merged PR 553935: Updated YAMLs to remove ob_sdl_codeSignValidation_excludes Related work items: #1387258 --- .pipelines/OneBranch.Buddy.yml | 1 - .pipelines/OneBranch.Official.yml | 1 - .pipelines/OneBranch.PR.yml | 1 - 3 files changed, 3 deletions(-) diff --git a/.pipelines/OneBranch.Buddy.yml b/.pipelines/OneBranch.Buddy.yml index c18b325f..0dd67f07 100644 --- a/.pipelines/OneBranch.Buddy.yml +++ b/.pipelines/OneBranch.Buddy.yml @@ -54,7 +54,6 @@ extends: ob_sdl_binskim_break: true # https://aka.ms/obpipelines/sdl ob_artifactBaseName: 'drop' ob_sdl_cg_failOnAlert: false - ob_sdl_codeSignValidation_excludes: 'regex|.+(?:exe|dll)$;-|*.nd.dll;-|.gdn\**' steps: - task: onebranch.pipeline.version@1 diff --git a/.pipelines/OneBranch.Official.yml b/.pipelines/OneBranch.Official.yml index 7af1976c..08224ea7 100644 --- a/.pipelines/OneBranch.Official.yml +++ b/.pipelines/OneBranch.Official.yml @@ -67,7 +67,6 @@ extends: ob_sdl_binskim_break: true ob_artifactBaseName: 'drop' ob_sdl_cg_failOnAlert: false - ob_sdl_codeSignValidation_excludes: 'regex|.+(?:exe|dll)$;-|*.nd.dll;-|.gdn\**' steps: - task: onebranch.pipeline.version@1 diff --git a/.pipelines/OneBranch.PR.yml b/.pipelines/OneBranch.PR.yml index 5e6e0439..0a82089b 100644 --- a/.pipelines/OneBranch.PR.yml +++ b/.pipelines/OneBranch.PR.yml @@ -54,7 +54,6 @@ extends: ob_sdl_binskim_break: true # https://aka.ms/obpipelines/sdl ob_artifactBaseName: 'drop' ob_sdl_cg_failOnAlert: false - ob_sdl_codeSignValidation_excludes: 'regex|.+(?:exe|dll)$;-|*.nd.dll;-|.gdn\**' steps: - task: onebranch.pipeline.version@1 From 92576e24e1696e9f42c263c7a8f9a40253185d71 Mon Sep 17 00:00:00 2001 From: Benjamin Bi Date: Thu, 2 May 2024 05:49:58 +0000 Subject: [PATCH 30/35] Merged PR 554848: Updated OneBranch.Official.yml to 4.18.0 Updated OneBranch.Official.yml to 4.18.0 Related work items: #1389853 --- .pipelines/OneBranch.Official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/OneBranch.Official.yml b/.pipelines/OneBranch.Official.yml index 08224ea7..a2b55400 100644 --- a/.pipelines/OneBranch.Official.yml +++ b/.pipelines/OneBranch.Official.yml @@ -28,7 +28,7 @@ variables: ${{ if eq(variables['Build.DefinitionName'], 'PowerBI-CSharp-Official') }}: obpTemplate: v2/OneBranch.Official.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates obpMajor: 4 - obpMinor: 18 + obpMinor: 19 ${{ else }}: obpTemplate: v2/OneBranch.NonOfficial.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates obpMajor: 0 From 0eff964a84acab3f7981f52ad12bb22c720a8bf5 Mon Sep 17 00:00:00 2001 From: Daniel Xiao Date: Fri, 31 May 2024 17:51:49 +0000 Subject: [PATCH 31/35] Merged PR 566417: Update IsRefreshable bool text for datasets Context: Public docs for explaining the isRefreshable boolean for datasets is unclear for the case of DQ/Import/Live Connection. We would like to update the description to explain the returned value for these cases. ![image.png](https://dev.azure.com/powerbi/4c7b5adb-c2d0-4f18-b23c-edc4ac30f4e1/_apis/git/repositories/4f4b7330-5c73-4eb2-b9cb-d2f4c16debf7/pullRequests/566417/attachments/image.png) ![image (2).png](https://dev.azure.com/powerbi/4c7b5adb-c2d0-4f18-b23c-edc4ac30f4e1/_apis/git/repositories/4f4b7330-5c73-4eb2-b9cb-d2f4c16debf7/pullRequests/566417/attachments/image%20%282%29.png) Updated text provided by @ --- sdk/PowerBI.Api/Source/Models/AdminDataset.cs | 20 ++++++++++++------- sdk/PowerBI.Api/Source/Models/Dataset.cs | 20 ++++++++++++------- .../Source/Models/DatasetMiscProperties.cs | 20 ++++++++++++------- sdk/swaggers/swagger.json | 2 +- 4 files changed, 40 insertions(+), 22 deletions(-) diff --git a/sdk/PowerBI.Api/Source/Models/AdminDataset.cs b/sdk/PowerBI.Api/Source/Models/AdminDataset.cs index ea307c2d..f3771e17 100644 --- a/sdk/PowerBI.Api/Source/Models/AdminDataset.cs +++ b/sdk/PowerBI.Api/Source/Models/AdminDataset.cs @@ -67,10 +67,13 @@ public AdminDataset() /// API with the `getArtifactUsers` parameter. /// Whether the dataset allows adding /// new rows - /// Whether the dataset is refreshable or - /// not. A Power BI refreshable dataset is a dataset that has been - /// refreshed at least once, or for which a valid refresh schedule - /// exists. + /// This field returns `true` when the + /// dataset is either recently refreshed or is configured for automatic + /// refresh, with the connection mode specifically set to 'Import'. The + /// value will return `false` for other connection modes, such as + /// 'DirectQuery' and 'LiveConnection', regardless of whether the + /// dataset is manually refreshed or is set up for automatic + /// refresh. /// Whether the dataset can be /// shared with external users to be consumed in their own /// tenant @@ -218,9 +221,12 @@ public AdminDataset() public bool? AddRowsAPIEnabled { get; set; } /// - /// Gets or sets whether the dataset is refreshable or not. A Power BI - /// refreshable dataset is a dataset that has been refreshed at least - /// once, or for which a valid refresh schedule exists. + /// Gets or sets this field returns `true` when the dataset is either + /// recently refreshed or is configured for automatic refresh, with the + /// connection mode specifically set to 'Import'. The value will return + /// `false` for other connection modes, such as 'DirectQuery' and + /// 'LiveConnection', regardless of whether the dataset is manually + /// refreshed or is set up for automatic refresh. /// [JsonProperty(PropertyName = "IsRefreshable")] public bool? IsRefreshable { get; set; } diff --git a/sdk/PowerBI.Api/Source/Models/Dataset.cs b/sdk/PowerBI.Api/Source/Models/Dataset.cs index 714601fa..169d4b5d 100644 --- a/sdk/PowerBI.Api/Source/Models/Dataset.cs +++ b/sdk/PowerBI.Api/Source/Models/Dataset.cs @@ -66,10 +66,13 @@ public Dataset() /// API with the `getArtifactUsers` parameter. /// Whether the dataset allows adding /// new rows - /// Whether the dataset is refreshable or - /// not. A Power BI refreshable dataset is a dataset that has been - /// refreshed at least once, or for which a valid refresh schedule - /// exists. + /// This field returns `true` when the + /// dataset is either recently refreshed or is configured for automatic + /// refresh, with the connection mode specifically set to 'Import'. The + /// value will return `false` for other connection modes, such as + /// 'DirectQuery' and 'LiveConnection', regardless of whether the + /// dataset is manually refreshed or is set up for automatic + /// refresh. /// Whether the dataset can be /// shared with external users to be consumed in their own /// tenant @@ -214,9 +217,12 @@ public Dataset() public bool? AddRowsAPIEnabled { get; set; } /// - /// Gets or sets whether the dataset is refreshable or not. A Power BI - /// refreshable dataset is a dataset that has been refreshed at least - /// once, or for which a valid refresh schedule exists. + /// Gets or sets this field returns `true` when the dataset is either + /// recently refreshed or is configured for automatic refresh, with the + /// connection mode specifically set to 'Import'. The value will return + /// `false` for other connection modes, such as 'DirectQuery' and + /// 'LiveConnection', regardless of whether the dataset is manually + /// refreshed or is set up for automatic refresh. /// [JsonProperty(PropertyName = "IsRefreshable")] public bool? IsRefreshable { get; set; } diff --git a/sdk/PowerBI.Api/Source/Models/DatasetMiscProperties.cs b/sdk/PowerBI.Api/Source/Models/DatasetMiscProperties.cs index cacda0e5..9e420255 100644 --- a/sdk/PowerBI.Api/Source/Models/DatasetMiscProperties.cs +++ b/sdk/PowerBI.Api/Source/Models/DatasetMiscProperties.cs @@ -28,10 +28,13 @@ public DatasetMiscProperties() /// /// Whether the dataset allows adding /// new rows - /// Whether the dataset is refreshable or - /// not. A Power BI refreshable dataset is a dataset that has been - /// refreshed at least once, or for which a valid refresh schedule - /// exists. + /// This field returns `true` when the + /// dataset is either recently refreshed or is configured for automatic + /// refresh, with the connection mode specifically set to 'Import'. The + /// value will return `false` for other connection modes, such as + /// 'DirectQuery' and 'LiveConnection', regardless of whether the + /// dataset is manually refreshed or is set up for automatic + /// refresh. /// Whether the dataset can be /// shared with external users to be consumed in their own /// tenant @@ -55,9 +58,12 @@ public DatasetMiscProperties() public bool? AddRowsAPIEnabled { get; set; } /// - /// Gets or sets whether the dataset is refreshable or not. A Power BI - /// refreshable dataset is a dataset that has been refreshed at least - /// once, or for which a valid refresh schedule exists. + /// Gets or sets this field returns `true` when the dataset is either + /// recently refreshed or is configured for automatic refresh, with the + /// connection mode specifically set to 'Import'. The value will return + /// `false` for other connection modes, such as 'DirectQuery' and + /// 'LiveConnection', regardless of whether the dataset is manually + /// refreshed or is set up for automatic refresh. /// [JsonProperty(PropertyName = "IsRefreshable")] public bool? IsRefreshable { get; set; } diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 2ca96a35..66b3c450 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -22581,7 +22581,7 @@ }, "IsRefreshable": { "type": "boolean", - "description": "Whether the dataset is refreshable or not. A Power BI refreshable dataset is a dataset that has been refreshed at least once, or for which a valid refresh schedule exists." + "description": "This field returns `true` when the dataset is either recently refreshed or is configured for automatic refresh, with the connection mode specifically set to 'Import'. The value will return `false` for other connection modes, such as 'DirectQuery' and 'LiveConnection', regardless of whether the dataset is manually refreshed or is set up for automatic refresh." }, "IsInPlaceSharingEnabled": { "type": "boolean", From 366d1418f988dca90798abba7a630b2d3d2dad9e Mon Sep 17 00:00:00 2001 From: Amos Hersch Date: Sun, 2 Jun 2024 08:03:59 +0000 Subject: [PATCH 32/35] Merged PR 567866: Get modified workspace - fix capital letter issue Get modified workspace - fix capital letter issue. The API returns "id" and not "Id" --- sdk/PowerBI.Api/Source/Models/ModifiedWorkspace.cs | 2 +- sdk/swaggers/swagger.json | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sdk/PowerBI.Api/Source/Models/ModifiedWorkspace.cs b/sdk/PowerBI.Api/Source/Models/ModifiedWorkspace.cs index 6df54598..33d01545 100644 --- a/sdk/PowerBI.Api/Source/Models/ModifiedWorkspace.cs +++ b/sdk/PowerBI.Api/Source/Models/ModifiedWorkspace.cs @@ -40,7 +40,7 @@ public ModifiedWorkspace(System.Guid id) /// /// Gets or sets the workspace object ID /// - [JsonProperty(PropertyName = "Id")] + [JsonProperty(PropertyName = "id")] public System.Guid Id { get; set; } /// diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 66b3c450..0bfbe6d2 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -14538,10 +14538,10 @@ "200": { "body": [ { - "Id": "3740504d-1f93-42f9-8e9d-c8ba9b787a3b" + "id": "3740504d-1f93-42f9-8e9d-c8ba9b787a3b" }, { - "Id": "19cb346c-9839-4e19-81e6-76364d0b836f" + "id": "19cb346c-9839-4e19-81e6-76364d0b836f" } ] } @@ -22230,11 +22230,11 @@ }, "ModifiedWorkspace": { "required": [ - "Id" + "id" ], "description": "A modified workspace", "properties": { - "Id": { + "id": { "type": "string", "format": "uuid", "description": "The workspace object ID" From 8cacb1cc44aa3d65e9952eced9c2ce2db7071f13 Mon Sep 17 00:00:00 2001 From: Parkavi Sundaresan Date: Tue, 4 Jun 2024 06:57:53 +0000 Subject: [PATCH 33/35] Merged PR 564928: Swagger Update for RDL BindToGateway Swagger Update for RDL BindToGateway --- .../V2/ReportsOperationsExtensions.cs | 98 ++++++ sdk/PowerBI.Api/Source/IReportsOperations.cs | 85 +++++ .../Source/Models/RdlBindDetail.cs | 72 ++++ .../Source/Models/RdlBindToGatewayRequest.cs | 85 +++++ sdk/PowerBI.Api/Source/ReportsOperations.cs | 309 ++++++++++++++++++ .../Source/ReportsOperationsExtensions.cs | 152 +++++++++ sdk/swaggers/swagger.json | 170 ++++++++++ 7 files changed, 971 insertions(+) create mode 100644 sdk/PowerBI.Api/Extensions/V2/ReportsOperationsExtensions.cs create mode 100644 sdk/PowerBI.Api/Source/Models/RdlBindDetail.cs create mode 100644 sdk/PowerBI.Api/Source/Models/RdlBindToGatewayRequest.cs diff --git a/sdk/PowerBI.Api/Extensions/V2/ReportsOperationsExtensions.cs b/sdk/PowerBI.Api/Extensions/V2/ReportsOperationsExtensions.cs new file mode 100644 index 00000000..564008f5 --- /dev/null +++ b/sdk/PowerBI.Api/Extensions/V2/ReportsOperationsExtensions.cs @@ -0,0 +1,98 @@ +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.PowerBI.Api +{ + using Models; + using System.IO; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Extension methods for ReportsOperations. + /// + public static partial class ReportsOperationsExtensions + { + /// + /// Binds the specified data source of the paginated report from the specified + /// workspace to the specified gateway, optionally with a given data source ID. + /// If you don't supply a specific data source ID, the data source will be + /// bound to the first matching data source in the gateway. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. + /// + /// ## Required Delegated Scopes + /// + /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The report ID + /// + /// + /// The bind to gateway request payload. + /// + public static void BindToGateway(this IReportsOperations operations, System.Guid groupId, System.Guid reportId, RdlBindToGatewayRequest rdlBindToGatewayRequest) + { + operations.BindToGatewayInGroupAsync(groupId, reportId, rdlBindToGatewayRequest).GetAwaiter().GetResult(); + } + + /// + /// Binds the specified data source of the paginated report from the specified + /// workspace to the specified gateway, optionally with a given data source ID. + /// If you don't supply a specific data source ID, the data source will be + /// bound to the first matching data source in the gateway. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. + /// + /// ## Required Delegated Scopes + /// + /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The report ID + /// + /// + /// The bind to gateway request payload. + /// + /// + /// The cancellation token. + /// + public static async Task BindToGatewayAsync(this IReportsOperations operations, System.Guid groupId, System.Guid reportId, RdlBindToGatewayRequest rdlBindToGatewayRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BindToGatewayInGroupWithHttpMessagesAsync(groupId, reportId, rdlBindToGatewayRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + } +} diff --git a/sdk/PowerBI.Api/Source/IReportsOperations.cs b/sdk/PowerBI.Api/Source/IReportsOperations.cs index cd8eacc1..bf4b5aa9 100644 --- a/sdk/PowerBI.Api/Source/IReportsOperations.cs +++ b/sdk/PowerBI.Api/Source/IReportsOperations.cs @@ -538,6 +538,47 @@ public partial interface IReportsOperations /// Task> GetFileOfExportToFileWithHttpMessagesAsync(System.Guid reportId, string exportId, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Binds the specified data source of the paginated report from **My + /// workspace** to the specified gateway, optionally with a given data + /// source ID. If you don't supply a specific data source ID, the data + /// source will be bound to the first matching data source in the + /// gateway. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. + /// + /// ## Required Delegated Scopes + /// + /// Report.ReadWrite.All or Report.Read.All + /// + /// ## Limitations + /// + /// Only supports on-premises data gateway + /// <br><br> + /// + /// + /// The report ID + /// + /// + /// The bind to gateway request payload. + /// + /// + /// 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 BindToGatewayWithHttpMessagesAsync(System.Guid reportId, RdlBindToGatewayRequest rdlBindToGatewayRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Returns a list of reports from the specified workspace. /// /// @@ -1314,6 +1355,50 @@ public partial interface IReportsOperations /// Task> GenerateTokenInGroupWithHttpMessagesAsync(System.Guid groupId, System.Guid reportId, GenerateTokenRequest requestParameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); /// + /// Binds the specified data source of the paginated report from the + /// specified workspace to the specified gateway, optionally with a + /// given data source ID. If you don't supply a specific data source + /// ID, the data source will be bound to the first matching data source + /// in the gateway. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. + /// + /// ## Required Delegated Scopes + /// + /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The report ID + /// + /// + /// The bind to gateway request payload. + /// + /// + /// 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 BindToGatewayInGroupWithHttpMessagesAsync(System.Guid groupId, System.Guid reportId, RdlBindToGatewayRequest rdlBindToGatewayRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// /// Returns a list of reports from the specified workspace. /// /// diff --git a/sdk/PowerBI.Api/Source/Models/RdlBindDetail.cs b/sdk/PowerBI.Api/Source/Models/RdlBindDetail.cs new file mode 100644 index 00000000..462226f7 --- /dev/null +++ b/sdk/PowerBI.Api/Source/Models/RdlBindDetail.cs @@ -0,0 +1,72 @@ +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.PowerBI.Api.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// BindDetail for each data source in a paginated report + /// + public partial class RdlBindDetail + { + /// + /// Initializes a new instance of the RdlBindDetail class. + /// + public RdlBindDetail() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RdlBindDetail class. + /// + /// Name of the data source in the + /// paginated report + /// The unique identifier for the data + /// source in the gateway + public RdlBindDetail(string dataSourceName, System.Guid? dataSourceObjectId = default(System.Guid?)) + { + DataSourceName = dataSourceName; + DataSourceObjectId = dataSourceObjectId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets name of the data source in the paginated report + /// + [JsonProperty(PropertyName = "dataSourceName")] + public string DataSourceName { get; set; } + + /// + /// Gets or sets the unique identifier for the data source in the + /// gateway + /// + [JsonProperty(PropertyName = "dataSourceObjectId")] + public System.Guid? DataSourceObjectId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (DataSourceName == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "DataSourceName"); + } + } + } +} diff --git a/sdk/PowerBI.Api/Source/Models/RdlBindToGatewayRequest.cs b/sdk/PowerBI.Api/Source/Models/RdlBindToGatewayRequest.cs new file mode 100644 index 00000000..88b8763c --- /dev/null +++ b/sdk/PowerBI.Api/Source/Models/RdlBindToGatewayRequest.cs @@ -0,0 +1,85 @@ +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.PowerBI.Api.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// Paginated report bind data source to gateway request + /// + public partial class RdlBindToGatewayRequest + { + /// + /// Initializes a new instance of the RdlBindToGatewayRequest class. + /// + public RdlBindToGatewayRequest() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the RdlBindToGatewayRequest class. + /// + /// The gateway ID. When using a gateway + /// cluster, the gateway ID refers to the primary (first) gateway in + /// the cluster and is similar to the gateway cluster ID. + /// List of bind details + public RdlBindToGatewayRequest(System.Guid gatewayObjectId, IList bindDetails) + { + GatewayObjectId = gatewayObjectId; + BindDetails = bindDetails; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the gateway ID. When using a gateway cluster, the + /// gateway ID refers to the primary (first) gateway in the cluster and + /// is similar to the gateway cluster ID. + /// + [JsonProperty(PropertyName = "gatewayObjectId")] + public System.Guid GatewayObjectId { get; set; } + + /// + /// Gets or sets list of bind details + /// + [JsonProperty(PropertyName = "bindDetails")] + public IList BindDetails { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (BindDetails == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BindDetails"); + } + if (BindDetails != null) + { + foreach (var element in BindDetails) + { + if (element != null) + { + element.Validate(); + } + } + } + } + } +} diff --git a/sdk/PowerBI.Api/Source/ReportsOperations.cs b/sdk/PowerBI.Api/Source/ReportsOperations.cs index ab0f6250..4513c509 100644 --- a/sdk/PowerBI.Api/Source/ReportsOperations.cs +++ b/sdk/PowerBI.Api/Source/ReportsOperations.cs @@ -2174,6 +2174,158 @@ public ReportsOperations(PowerBIClient client) return _result; } + /// + /// Binds the specified data source of the paginated report from **My + /// workspace** to the specified gateway, optionally with a given data source + /// ID. If you don't supply a specific data source ID, the data source will be + /// bound to the first matching data source in the gateway. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. + /// + /// ## Required Delegated Scopes + /// + /// Report.ReadWrite.All or Report.Read.All + /// + /// ## Limitations + /// + /// Only supports on-premises data gateway + /// <br><br> + /// + /// + /// The report ID + /// + /// + /// The bind to gateway request payload. + /// + /// + /// 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 BindToGatewayWithHttpMessagesAsync(System.Guid reportId, RdlBindToGatewayRequest rdlBindToGatewayRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (rdlBindToGatewayRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "rdlBindToGatewayRequest"); + } + if (rdlBindToGatewayRequest != null) + { + rdlBindToGatewayRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("reportId", reportId); + tracingParameters.Add("rdlBindToGatewayRequest", rdlBindToGatewayRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BindToGateway", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/reports/{reportId}/Default.BindToGateway").ToString(); + _url = _url.Replace("{reportId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(reportId, Client.SerializationSettings).Trim('"'))); + // 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 (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(rdlBindToGatewayRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(rdlBindToGatewayRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Returns a list of reports from the specified workspace. /// @@ -4840,6 +4992,163 @@ public ReportsOperations(PowerBIClient client) return _result; } + /// + /// Binds the specified data source of the paginated report from the specified + /// workspace to the specified gateway, optionally with a given data source ID. + /// If you don't supply a specific data source ID, the data source will be + /// bound to the first matching data source in the gateway. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. + /// + /// ## Required Delegated Scopes + /// + /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The workspace ID + /// + /// + /// The report ID + /// + /// + /// The bind to gateway request payload. + /// + /// + /// 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 BindToGatewayInGroupWithHttpMessagesAsync(System.Guid groupId, System.Guid reportId, RdlBindToGatewayRequest rdlBindToGatewayRequest, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (rdlBindToGatewayRequest == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "rdlBindToGatewayRequest"); + } + if (rdlBindToGatewayRequest != null) + { + rdlBindToGatewayRequest.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("groupId", groupId); + tracingParameters.Add("reportId", reportId); + tracingParameters.Add("rdlBindToGatewayRequest", rdlBindToGatewayRequest); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "BindToGatewayInGroup", tracingParameters); + } + // Construct URL + var _baseUrl = Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "v1.0/myorg/groups/{groupId}/reports/{reportId}/Default.BindToGateway").ToString(); + _url = _url.Replace("{groupId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(groupId, Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{reportId}", System.Uri.EscapeDataString(Rest.Serialization.SafeJsonConvert.SerializeObject(reportId, Client.SerializationSettings).Trim('"'))); + // 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 (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(rdlBindToGatewayRequest != null) + { + _requestContent = Rest.Serialization.SafeJsonConvert.SerializeObject(rdlBindToGatewayRequest, 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 HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + if (_httpResponse.Content != null) { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + } + else { + _responseContent = string.Empty; + } + 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 HttpOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + /// /// Returns a list of reports from the specified workspace. /// diff --git a/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs index a10b2680..3a056558 100644 --- a/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs @@ -933,6 +933,79 @@ public static Stream GetFileOfExportToFile(this IReportsOperations operations, S return _result.Body; } + /// + /// Binds the specified data source of the paginated report from **My + /// workspace** to the specified gateway, optionally with a given data source + /// ID. If you don't supply a specific data source ID, the data source will be + /// bound to the first matching data source in the gateway. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. + /// + /// ## Required Delegated Scopes + /// + /// Report.ReadWrite.All or Report.Read.All + /// + /// ## Limitations + /// + /// Only supports on-premises data gateway + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The report ID + /// + /// + /// The bind to gateway request payload. + /// + public static void BindToGateway(this IReportsOperations operations, System.Guid reportId, RdlBindToGatewayRequest rdlBindToGatewayRequest) + { + operations.BindToGatewayAsync(reportId, rdlBindToGatewayRequest).GetAwaiter().GetResult(); + } + + /// + /// Binds the specified data source of the paginated report from **My + /// workspace** to the specified gateway, optionally with a given data source + /// ID. If you don't supply a specific data source ID, the data source will be + /// bound to the first matching data source in the gateway. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. + /// + /// ## Required Delegated Scopes + /// + /// Report.ReadWrite.All or Report.Read.All + /// + /// ## Limitations + /// + /// Only supports on-premises data gateway + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The report ID + /// + /// + /// The bind to gateway request payload. + /// + /// + /// The cancellation token. + /// + public static async Task BindToGatewayAsync(this IReportsOperations operations, System.Guid reportId, RdlBindToGatewayRequest rdlBindToGatewayRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BindToGatewayWithHttpMessagesAsync(reportId, rdlBindToGatewayRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Returns a list of reports from the specified workspace. /// @@ -2342,6 +2415,85 @@ public static EmbedToken GenerateTokenInGroup(this IReportsOperations operations } } + /// + /// Binds the specified data source of the paginated report from the specified + /// workspace to the specified gateway, optionally with a given data source ID. + /// If you don't supply a specific data source ID, the data source will be + /// bound to the first matching data source in the gateway. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. + /// + /// ## Required Delegated Scopes + /// + /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The report ID + /// + /// + /// The bind to gateway request payload. + /// + public static void BindToGatewayInGroup(this IReportsOperations operations, System.Guid groupId, System.Guid reportId, RdlBindToGatewayRequest rdlBindToGatewayRequest) + { + operations.BindToGatewayInGroupAsync(groupId, reportId, rdlBindToGatewayRequest).GetAwaiter().GetResult(); + } + + /// + /// Binds the specified data source of the paginated report from the specified + /// workspace to the specified gateway, optionally with a given data source ID. + /// If you don't supply a specific data source ID, the data source will be + /// bound to the first matching data source in the gateway. + /// + /// + /// + /// ## Permissions + /// + /// This API call can be called by a service principal profile. + /// + /// ## Required Delegated Scopes + /// + /// Workspace.Read.All or Workspace.ReadWrite.All + /// + /// ## Limitations + /// + /// Only supports the on-premises data gateway + /// <br><br> + /// + /// + /// The operations group for this extension method. + /// + /// + /// The workspace ID + /// + /// + /// The report ID + /// + /// + /// The bind to gateway request payload. + /// + /// + /// The cancellation token. + /// + public static async Task BindToGatewayInGroupAsync(this IReportsOperations operations, System.Guid groupId, System.Guid reportId, RdlBindToGatewayRequest rdlBindToGatewayRequest, CancellationToken cancellationToken = default(CancellationToken)) + { + (await operations.BindToGatewayInGroupWithHttpMessagesAsync(groupId, reportId, rdlBindToGatewayRequest, null, cancellationToken).ConfigureAwait(false)).Dispose(); + } + /// /// Returns a list of reports from the specified workspace. /// diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index 0bfbe6d2..c31fdc77 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -3807,6 +3807,68 @@ "deprecated": false } }, + "/v1.0/myorg/reports/{reportId}/Default.BindToGateway": { + "post": { + "tags": [ + "Reports" + ], + "summary": "Binds the specified data source of the paginated report from **My workspace** to the specified gateway, optionally with a given data source ID. If you don't supply a specific data source ID, the data source will be bound to the first matching data source in the gateway.", + "description": "\n## Permissions\n\n This API call can be called by a service principal profile. \n\n## Required Delegated Scopes\n\nReport.ReadWrite.All or Report.Read.All\n\n## Limitations\n\nOnly supports on-premises data gateway\n

", + "operationId": "Reports_BindToGateway", + "consumes": [ + "application/json" + ], + "produces": [], + "parameters": [ + { + "name": "reportId", + "in": "path", + "description": "The report ID", + "type": "string", + "format": "uuid", + "required": true + }, + { + "name": "rdlBindToGatewayRequest", + "in": "body", + "description": "The bind to gateway request payload.", + "schema": { + "$ref": "#/definitions/RdlBindToGatewayRequest" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "OK" + } + }, + "x-ms-examples": { + "Example": { + "parameters": { + "reportId": "cfafbeb1-8037-4d0c-896e-a46fb27ff229", + "rdlBindToGatewayRequest": { + "gatewayObjectId": "1f69e798-5852-4fdd-ab01-33bb14b6e934", + "bindDetails": [ + { + "dataSourceName": "DataSource1", + "dataSourceObjectId": "dc2f2dac-e5e2-4c37-af76-2a0bc10f16cb" + }, + { + "dataSourceName": "DataSource2", + "dataSourceObjectId": "3bfe5d33-ab7d-4d24-b0b5-e2bb8eb01cf5" + } + ] + } + }, + "responses": { + "200": {} + } + } + }, + "deprecated": false + } + }, "/v1.0/myorg/dashboards": { "get": { "tags": [ @@ -9140,6 +9202,77 @@ "deprecated": false } }, + "/v1.0/myorg/groups/{groupId}/reports/{reportId}/Default.BindToGateway": { + "post": { + "tags": [ + "Reports" + ], + "summary": "Binds the specified data source of the paginated report from the specified workspace to the specified gateway, optionally with a given data source ID. If you don't supply a specific data source ID, the data source will be bound to the first matching data source in the gateway.", + "description": "\n## Permissions\n\n This API call can be called by a service principal profile. \n\n## Required Delegated Scopes\n\nWorkspace.Read.All or Workspace.ReadWrite.All\n\n## Limitations\n\nOnly supports the on-premises data gateway\n

", + "operationId": "Reports_BindToGatewayInGroup", + "consumes": [ + "application/json" + ], + "produces": [], + "parameters": [ + { + "name": "groupId", + "in": "path", + "description": "The workspace ID", + "type": "string", + "format": "uuid", + "required": true + }, + { + "name": "reportId", + "in": "path", + "description": "The report ID", + "type": "string", + "format": "uuid", + "required": true + }, + { + "name": "rdlBindToGatewayRequest", + "in": "body", + "description": "The bind to gateway request payload.", + "schema": { + "$ref": "#/definitions/RdlBindToGatewayRequest" + }, + "required": true + } + ], + "responses": { + "200": { + "description": "OK" + } + }, + "x-ms-examples": { + "Example": { + "parameters": { + "groupId": "f089354e-8366-4e18-aea3-4cb4a3a50b48", + "reportId": "cfafbeb1-8037-4d0c-896e-a46fb27ff229", + "rdlBindToGatewayRequest": { + "gatewayObjectId": "1f69e798-5852-4fdd-ab01-33bb14b6e934", + "bindDetails": [ + { + "dataSourceName": "DataSource1", + "dataSourceObjectId": "dc2f2dac-e5e2-4c37-af76-2a0bc10f16cb" + }, + { + "dataSourceName": "DataSource2", + "dataSourceObjectId": "3bfe5d33-ab7d-4d24-b0b5-e2bb8eb01cf5" + } + ] + } + }, + "responses": { + "200": {} + } + } + }, + "deprecated": false + } + }, "/v1.0/myorg/apps": { "get": { "tags": [ @@ -28695,6 +28828,43 @@ } } }, + "RdlBindToGatewayRequest": { + "required": [ + "gatewayObjectId", + "bindDetails" + ], + "description": "Paginated report bind data source to gateway request", + "properties": { + "gatewayObjectId": { + "type": "string", + "format": "uuid", + "description": "The gateway ID. When using a gateway cluster, the gateway ID refers to the primary (first) gateway in the cluster and is similar to the gateway cluster ID." + }, + "bindDetails": { + "description": "List of bind details", + "type": "array", + "items": { + "$ref": "#/definitions/RdlBindDetail", + "description": "BindDetail for each data source in the paginated report" + } + } + } + }, + "RdlBindDetail": { + "description": "BindDetail for each data source in a paginated report", + "required": ["dataSourceName"], + "properties": { + "dataSourceName": { + "description": "Name of the data source in the paginated report", + "type": "string" + }, + "dataSourceObjectId": { + "description": "The unique identifier for the data source in the gateway", + "type": "string", + "format": "uuid" + } + } + }, "DataflowTransactions": { "description": "Odata response wrapper for dataflow transactions", "properties": { From 5677faf0ba6be99378037145689e336f08a72d11 Mon Sep 17 00:00:00 2001 From: Kesem Sharabi Date: Tue, 4 Jun 2024 16:56:12 +0000 Subject: [PATCH 34/35] Merged PR 568045: Export fix Export fix --- sdk/PowerBI.Api/Source/IReportsOperations.cs | 13 +++++++---- sdk/PowerBI.Api/Source/ReportsOperations.cs | 11 +++++++--- .../Source/ReportsOperationsExtensions.cs | 22 ++++++++++++++----- sdk/swaggers/swagger.json | 2 +- 4 files changed, 34 insertions(+), 14 deletions(-) diff --git a/sdk/PowerBI.Api/Source/IReportsOperations.cs b/sdk/PowerBI.Api/Source/IReportsOperations.cs index bf4b5aa9..a80034c2 100644 --- a/sdk/PowerBI.Api/Source/IReportsOperations.cs +++ b/sdk/PowerBI.Api/Source/IReportsOperations.cs @@ -772,10 +772,15 @@ public partial interface IReportsOperations /// /// ## Limitations /// - /// For .pbix reports, exporting a report with a [Power BI service live - /// connection](/power-bi/desktop-report-lifecycle-datasets) isn't - /// supported after calling [Rebind - /// Report](/rest/api/power-bi/reports/rebind-report). + /// * For .pbix reports, exporting a report is subject to the same + /// limitation as [downloading a report .pbix + /// file](/power-bi/create-reports/service-export-to-pbix#limitations-when-downloading-a-report-pbix-file). + /// + /// * After calling [Rebind + /// Report](/rest/api/power-bi/reports/rebind-report), exporting a + /// report with a [Power BI service live + /// connection](/power-bi/connect-data/desktop-report-lifecycle-datasets) + /// isn't supported. /// <br><br> ///
/// diff --git a/sdk/PowerBI.Api/Source/ReportsOperations.cs b/sdk/PowerBI.Api/Source/ReportsOperations.cs index 4513c509..b11291b5 100644 --- a/sdk/PowerBI.Api/Source/ReportsOperations.cs +++ b/sdk/PowerBI.Api/Source/ReportsOperations.cs @@ -2971,9 +2971,14 @@ public ReportsOperations(PowerBIClient client) /// /// ## Limitations /// - /// For .pbix reports, exporting a report with a [Power BI service live - /// connection](/power-bi/desktop-report-lifecycle-datasets) isn't supported - /// after calling [Rebind Report](/rest/api/power-bi/reports/rebind-report). + /// * For .pbix reports, exporting a report is subject to the same limitation + /// as [downloading a report .pbix + /// file](/power-bi/create-reports/service-export-to-pbix#limitations-when-downloading-a-report-pbix-file). + /// + /// * After calling [Rebind Report](/rest/api/power-bi/reports/rebind-report), + /// exporting a report with a [Power BI service live + /// connection](/power-bi/connect-data/desktop-report-lifecycle-datasets) isn't + /// supported. /// <br><br> ///
/// diff --git a/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs b/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs index 3a056558..17954e97 100644 --- a/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs +++ b/sdk/PowerBI.Api/Source/ReportsOperationsExtensions.cs @@ -1335,9 +1335,14 @@ public static Report CloneReportInGroup(this IReportsOperations operations, Syst /// /// ## Limitations /// - /// For .pbix reports, exporting a report with a [Power BI service live - /// connection](/power-bi/desktop-report-lifecycle-datasets) isn't supported - /// after calling [Rebind Report](/rest/api/power-bi/reports/rebind-report). + /// * For .pbix reports, exporting a report is subject to the same limitation + /// as [downloading a report .pbix + /// file](/power-bi/create-reports/service-export-to-pbix#limitations-when-downloading-a-report-pbix-file). + /// + /// * After calling [Rebind Report](/rest/api/power-bi/reports/rebind-report), + /// exporting a report with a [Power BI service live + /// connection](/power-bi/connect-data/desktop-report-lifecycle-datasets) isn't + /// supported. /// <br><br> /// /// @@ -1388,9 +1393,14 @@ public static Stream ExportReportInGroup(this IReportsOperations operations, Sys /// /// ## Limitations /// - /// For .pbix reports, exporting a report with a [Power BI service live - /// connection](/power-bi/desktop-report-lifecycle-datasets) isn't supported - /// after calling [Rebind Report](/rest/api/power-bi/reports/rebind-report). + /// * For .pbix reports, exporting a report is subject to the same limitation + /// as [downloading a report .pbix + /// file](/power-bi/create-reports/service-export-to-pbix#limitations-when-downloading-a-report-pbix-file). + /// + /// * After calling [Rebind Report](/rest/api/power-bi/reports/rebind-report), + /// exporting a report with a [Power BI service live + /// connection](/power-bi/connect-data/desktop-report-lifecycle-datasets) isn't + /// supported. /// <br><br> /// /// diff --git a/sdk/swaggers/swagger.json b/sdk/swaggers/swagger.json index c31fdc77..6c3132f6 100644 --- a/sdk/swaggers/swagger.json +++ b/sdk/swaggers/swagger.json @@ -7494,7 +7494,7 @@ "Reports" ], "summary": "Exports the specified report from the specified workspace to a Power BI .pbix or .rdl file.", - "description": "\n- For .pbix reports - \n You can set the `preferClientRouting` URL query parameter to `true` as a [workaround](/power-bi/developer/embedded/troubleshoot-rest-api#fix-timeout-exceptions-when-using-import-and-export-apis) for timeout issues.\n- Large files are downloaded to a temporary blob. Their URL is returned in the response and stored in the locally downloaded Power BI .pbix file.\n- For more information on requirements and limitations, see [Download a report from the Power BI service to Power BI Desktop](/power-bi/create-reports/service-export-to-pbix).\n\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n> [!NOTE]\n> Try-it feature is not supported for this API.\n See [Export Power BI Report](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/Export-PowerBIReport.ps1) Powershell script for an example of how to use this API.\n\n## Required Scope\n\nReport.ReadWrite.All or both Report.Read.All and Dataset.Read.All\n\n## Limitations\n\nFor .pbix reports, exporting a report with a [Power BI service live connection](/power-bi/desktop-report-lifecycle-datasets) isn't supported after calling [Rebind Report](/rest/api/power-bi/reports/rebind-report).\n

", + "description": "\n- For .pbix reports - \n You can set the `preferClientRouting` URL query parameter to `true` as a [workaround](/power-bi/developer/embedded/troubleshoot-rest-api#fix-timeout-exceptions-when-using-import-and-export-apis) for timeout issues.\n- Large files are downloaded to a temporary blob. Their URL is returned in the response and stored in the locally downloaded Power BI .pbix file.\n- For more information on requirements and limitations, see [Download a report from the Power BI service to Power BI Desktop](/power-bi/create-reports/service-export-to-pbix).\n\n## Permissions\n\nThis API call can be called by a service principal profile. For more information see: [Service principal profiles in Power BI Embedded](/power-bi/developer/embedded/embed-multi-tenancy).\n\n> [!NOTE]\n> Try-it feature is not supported for this API.\n See [Export Power BI Report](https://github.com/microsoft/PowerBI-Developer-Samples/blob/master/PowerShell%20Scripts/Export-PowerBIReport.ps1) Powershell script for an example of how to use this API.\n\n## Required Scope\n\nReport.ReadWrite.All or both Report.Read.All and Dataset.Read.All\n\n## Limitations\n\n* For .pbix reports, exporting a report is subject to the same limitation as [downloading a report .pbix file](/power-bi/create-reports/service-export-to-pbix#limitations-when-downloading-a-report-pbix-file).\n\n* After calling [Rebind Report](/rest/api/power-bi/reports/rebind-report), exporting a report with a [Power BI service live connection](/power-bi/connect-data/desktop-report-lifecycle-datasets) isn't supported.\n

", "operationId": "Reports_ExportReportInGroup", "consumes": [], "produces": [ From 3c828eff0866b7d8c3ee0fe8667815c2c11c7ac5 Mon Sep 17 00:00:00 2001 From: Brad Syputa Date: Wed, 12 Jun 2024 18:39:10 +0000 Subject: [PATCH 35/35] Merged PR 572073: Update OneBranch.Official.yml to 4.20.0 Update OneBranch.Official.yml to 4.20.0 The 1 commit is for RdlBindToGateway we are trying to release and the other three look to be OK to release, but reached out to owners to make sure. Related work items: #1421535 --- .pipelines/OneBranch.Official.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pipelines/OneBranch.Official.yml b/.pipelines/OneBranch.Official.yml index a2b55400..94a00b9a 100644 --- a/.pipelines/OneBranch.Official.yml +++ b/.pipelines/OneBranch.Official.yml @@ -28,7 +28,7 @@ variables: ${{ if eq(variables['Build.DefinitionName'], 'PowerBI-CSharp-Official') }}: obpTemplate: v2/OneBranch.Official.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates obpMajor: 4 - obpMinor: 19 + obpMinor: 20 ${{ else }}: obpTemplate: v2/OneBranch.NonOfficial.CrossPlat.yml@templates # https://aka.ms/obpipelines/templates obpMajor: 0