Skip to content

Commit

Permalink
Merge branch 'microsoft:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
DhyanRathore authored Dec 8, 2021
2 parents 744ad7f + 1c7dd0d commit be4d2e2
Show file tree
Hide file tree
Showing 268 changed files with 15,389 additions and 5,889 deletions.
4 changes: 2 additions & 2 deletions .pipelines/pipeline.user.windows.official.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version:
name: 'sdk version'
major: 3
minor: 30
major: 4
minor: 0
system: 'Buildrevision'
exclude_commit: true
assembly_version: 'majorminoronly'
Expand Down
2 changes: 1 addition & 1 deletion scripts/pack-sdk.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ call .\init-dev-cmd.cmd
REM Set Major and Minor package version
SET MAJOR=%CDP_MAJOR_NUMBER_ONLY%
SET MINOR=%CDP_MINOR_NUMBER_ONLY%
SET PATCH=0
SET PATCH=1
if "%MAJOR%"=="" SET MAJOR=0
if "%MINOR%"=="" SET MINOR=0

Expand Down
69 changes: 67 additions & 2 deletions sdk/PowerBI.Api.Tests/ImportsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public async Task PostImportWithFileWithNameAndConflict()
}

[TestMethod]
public async Task Groups_PostImportWithFileWithNameAndConflict()
public async Task Groups_PostImportWithFileWithNameAndConflictAsync()
{
var datasetDisplayName = "TestDataset";
var nameConflict = ImportConflictHandlerMode.Overwrite;
Expand All @@ -59,6 +59,23 @@ public async Task Groups_PostImportWithFileWithNameAndConflict()
}
}

[TestMethod]
public void Groups_PostImportWithFileWithNameAndConflict()
{
var datasetDisplayName = "TestDataset";
var nameConflict = ImportConflictHandlerMode.Overwrite;
var importResponse = CreateSampleImportResponse();

using (var handler = new FakeHttpClientHandler(importResponse))
using (var client = CreatePowerBIClient(handler))
using (var stream = new MemoryStream())
{
client.Imports.PostImportWithFileInGroup(this.groupId, stream, datasetDisplayName, nameConflict);
var expectedRequesetUrl = $"https://api.powerbi.com/v1.0/myorg/groups/{this.groupId}/imports?datasetDisplayName={datasetDisplayName}&nameConflict={nameConflict}";
Assert.AreEqual(expectedRequesetUrl, handler.Request.RequestUri.ToString());
}
}

[TestMethod]
public async Task PostImportFileWithName()
{
Expand All @@ -76,7 +93,7 @@ public async Task PostImportFileWithName()
}

[TestMethod]
public async Task Groups_PostImportFileWithName()
public async Task Groups_PostImportFileWithNameAsync()
{
var datasetDisplayName = "TestDataset";
var importResponse = CreateSampleImportResponse();
Expand All @@ -91,6 +108,22 @@ public async Task Groups_PostImportFileWithName()
}
}

[TestMethod]
public void Groups_PostImportFileWithName()
{
var datasetDisplayName = "TestDataset";
var importResponse = CreateSampleImportResponse();

using (var handler = new FakeHttpClientHandler(importResponse))
using (var client = CreatePowerBIClient(handler))
using (var stream = new MemoryStream())
{
client.Imports.PostImportWithFileInGroup(this.groupId, stream, datasetDisplayName);
var expectedRequesetUrl = $"https://api.powerbi.com/v1.0/myorg/groups/{this.groupId}/imports?datasetDisplayName={datasetDisplayName}";
Assert.AreEqual(expectedRequesetUrl, handler.Request.RequestUri.ToString());
}
}

[TestMethod]
public async Task PostImportFileWithNameAndSkipReport()
{
Expand All @@ -107,6 +140,38 @@ public async Task PostImportFileWithNameAndSkipReport()
}
}

[TestMethod]
public void Group_PostImportFileWithNameAndSkipReport()
{
var datasetDisplayName = "TestDataset";
var importResponse = CreateSampleImportResponse();

using (var handler = new FakeHttpClientHandler(importResponse))
using (var client = CreatePowerBIClient(handler))
using (var stream = new MemoryStream())
{
client.Imports.PostImportWithFileInGroup(this.groupId, stream, datasetDisplayName, skipReport: true);
var expectedRequesetUrl = $"https://api.powerbi.com/v1.0/myorg/groups/{this.groupId}/imports?datasetDisplayName={datasetDisplayName}&skipReport=True";
Assert.AreEqual(expectedRequesetUrl, handler.Request.RequestUri.ToString());
}
}

[TestMethod]
public async Task Group_PostImportFileWithNameAndSkipReportAsync()
{
var datasetDisplayName = "TestDataset";
var importResponse = CreateSampleImportResponse();

using (var handler = new FakeHttpClientHandler(importResponse))
using (var client = CreatePowerBIClient(handler))
using (var stream = new MemoryStream())
{
await client.Imports.PostImportWithFileAsyncInGroup(this.groupId, stream, datasetDisplayName, skipReport: true);
var expectedRequesetUrl = $"https://api.powerbi.com/v1.0/myorg/groups/{this.groupId}/imports?datasetDisplayName={datasetDisplayName}&skipReport=True";
Assert.AreEqual(expectedRequesetUrl, handler.Request.RequestUri.ToString());
}
}

[TestMethod]
public async Task PostImportFileWithNameAndNotOverrideReport()
{
Expand Down
2 changes: 1 addition & 1 deletion sdk/PowerBI.Api.Tests/ReportTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ private IPowerBIClient CreatePowerBIClient(HttpClientHandler handler)

private static HttpResponseMessage CreateSampleReportResponse(string name = default(string))
{
var report = new Report(Guid.NewGuid(), "Report Name", "AN URL", "EMBEDURL");
var report = new Report(id: Guid.NewGuid(), name: "Report Name", webUrl: "AN URL", embedUrl: "EMBEDURL");

return new HttpResponseMessage(HttpStatusCode.OK)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ internal static string Encrypt(byte[] plainTextBytes, byte[] modulusBytes, byte[
Buffer.BlockCopy(keyMac, 0, keys, keyEnc.Length + 2, keyMac.Length);
byte[] encryptedKeys;

using (var rsa = new RSACng())
using (var rsa = RSA.Create())
{
var rsaKeyInfo = rsa.ExportParameters(false);
rsaKeyInfo.Modulus = modulusBytes;
Expand Down
4 changes: 2 additions & 2 deletions sdk/PowerBI.Api/Extensions/DashboardsOperationsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static Dashboard GetDashboard(this IDashboardsOperations operations, Guid
/// <param name='skip'>
/// Skips the first n results
/// </param>
public static Dashboards GetDashboardsAsAdmin(this IDashboardsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?))
public static AdminDashboards GetDashboardsAsAdmin(this IDashboardsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?))
{
return operations.GetDashboardsInGroupAsAdminAsync(groupId, filter, top, skip).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -182,7 +182,7 @@ public static Dashboard GetDashboard(this IDashboardsOperations operations, Guid
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Dashboards> GetDashboardsAsAdminAsync(this IDashboardsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
public static async Task<AdminDashboards> GetDashboardsAsAdminAsync(this IDashboardsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetDashboardsInGroupAsAdminWithHttpMessagesAsync(groupId, filter, top, skip, null, cancellationToken).ConfigureAwait(false))
{
Expand Down
4 changes: 2 additions & 2 deletions sdk/PowerBI.Api/Extensions/DatasetsOperationsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static Datasets GetDatasets(this IDatasetsOperations operations, Guid gro
/// <param name='expand'>
/// Expands related entities inline
/// </param>
public static Datasets GetDatasetsAsAdmin(this IDatasetsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string))
public static AdminDatasets GetDatasetsAsAdmin(this IDatasetsOperations operations, 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();
}
Expand Down Expand Up @@ -108,7 +108,7 @@ public static Datasets GetDatasets(this IDatasetsOperations operations, Guid gro
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Datasets> GetDatasetsAsAdminAsync(this IDatasetsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), string expand = default(string), CancellationToken cancellationToken = default(CancellationToken))
public static async Task<AdminDatasets> GetDatasetsAsAdminAsync(this IDatasetsOperations operations, 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))
{
Expand Down
4 changes: 2 additions & 2 deletions sdk/PowerBI.Api/Extensions/ReportsOperationsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static Reports GetReports(this IReportsOperations operations, Guid groupI
/// <param name='skip'>
/// Skips the first n results
/// </param>
public static Reports GetReportsAsAdmin(this IReportsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?))
public static AdminReports GetReportsAsAdmin(this IReportsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?))
{
return operations.GetReportsInGroupAsAdminAsync(groupId, filter, top, skip).GetAwaiter().GetResult();
}
Expand Down Expand Up @@ -103,7 +103,7 @@ public static Reports GetReports(this IReportsOperations operations, Guid groupI
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task<Reports> GetReportsAsAdminAsync(this IReportsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
public static async Task<AdminReports> GetReportsAsAdminAsync(this IReportsOperations operations, Guid groupId, string filter = default(string), int? top = default(int?), int? skip = default(int?), CancellationToken cancellationToken = default(CancellationToken))
{
using (var _result = await operations.GetReportsInGroupAsAdminWithHttpMessagesAsync(groupId, filter, top, skip, null, cancellationToken).ConfigureAwait(false))
{
Expand Down
2 changes: 1 addition & 1 deletion sdk/PowerBI.Api/Imports/ImportsOperationsExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public static partial class ImportsOperationsExtensions
/// </param>
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?))
{
return Task.Factory.StartNew(s => ((IImportsOperations)s).PostImportFileWithHttpMessage(groupId, fileStream, datasetDisplayName, nameConflict, 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), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult().Body;
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion sdk/PowerBI.Api/Source/Admin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ public Admin(PowerBIClient client)
/// ## Limitations
///
/// - Maximum 200 requests per hour.
/// - Activity logging isnt supported for Microsoft Cloud Deutschland.
/// - Activity logging isn't supported for Microsoft Cloud Deutschland.
///
/// ######
///
Expand Down
4 changes: 2 additions & 2 deletions sdk/PowerBI.Api/Source/AdminExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ public static void PatchCapacityAsAdmin(this IAdmin operations, System.Guid capa
/// ## Limitations
///
/// - Maximum 200 requests per hour.
/// - Activity logging isnt supported for Microsoft Cloud Deutschland.
/// - Activity logging isn't supported for Microsoft Cloud Deutschland.
///
/// ######
///
Expand Down Expand Up @@ -694,7 +694,7 @@ public static void PatchCapacityAsAdmin(this IAdmin operations, System.Guid capa
/// ## Limitations
///
/// - Maximum 200 requests per hour.
/// - Activity logging isnt supported for Microsoft Cloud Deutschland.
/// - Activity logging isn't supported for Microsoft Cloud Deutschland.
///
/// ######
///
Expand Down
20 changes: 10 additions & 10 deletions sdk/PowerBI.Api/Source/AppsOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public AppsOperations(PowerBIClient client)
///
/// ## Limitations
///
/// Service principal authentication is not supported.
/// Service principal authentication isn't supported.
///
/// ######
///
Expand Down Expand Up @@ -196,7 +196,7 @@ public AppsOperations(PowerBIClient client)
///
/// ## Limitations
///
/// Service principal authentication is not supported.
/// Service principal authentication isn't supported.
///
/// ######
///
Expand Down Expand Up @@ -340,7 +340,7 @@ public AppsOperations(PowerBIClient client)
///
/// ## Limitations
///
/// Service principal authentication is not supported.
/// Service principal authentication isn't supported.
///
/// ######
///
Expand Down Expand Up @@ -484,7 +484,7 @@ public AppsOperations(PowerBIClient client)
///
/// ## Limitations
///
/// Service principal authentication is not supported.
/// Service principal authentication isn't supported.
///
/// ######
///
Expand Down Expand Up @@ -633,7 +633,7 @@ public AppsOperations(PowerBIClient client)
///
/// ## Limitations
///
/// Service principal authentication is not supported.
/// Service principal authentication isn't supported.
///
/// ######
///
Expand Down Expand Up @@ -777,7 +777,7 @@ public AppsOperations(PowerBIClient client)
///
/// ## Limitations
///
/// Service principal authentication is not supported.
/// Service principal authentication isn't supported.
///
/// ######
///
Expand Down Expand Up @@ -927,7 +927,7 @@ public AppsOperations(PowerBIClient client)
///
/// ## Limitations
///
/// Service principal authentication is not supported.
/// Service principal authentication isn't supported.
///
/// ######
///
Expand Down Expand Up @@ -1071,16 +1071,16 @@ public AppsOperations(PowerBIClient client)
/// </summary>
/// <remarks>
///
/// All tile types, except *model tiles*, are supported. Supported tiles
/// include datasets and live tiles that contain an entire report page.
/// Supported tiles include datasets and live tiles that contain an entire
/// report page.
///
/// ## Required scope
///
/// Dashboard.ReadWrite.All or Dashboard.Read.All
///
/// ## Limitations
///
/// Service principal authentication is not supported.
/// Service principal authentication isn't supported.
///
/// ######
///
Expand Down
Loading

0 comments on commit be4d2e2

Please sign in to comment.