Skip to content

Commit

Permalink
feat: Added the Backup resource and Backup resource GetIamPolicy/SetI…
Browse files Browse the repository at this point in the history
…amPolicy to V1 feat: Added the RestoreService method to V1

Promoted additional Dataproc Metastore metadata management methods to V1

PiperOrigin-RevId: 391108398

Source-Author: Google APIs <noreply@google.com>
Source-Date: Mon Aug 16 12:21:45 2021 -0700
Source-Repo: googleapis/googleapis
Source-Sha: b6901e755abebb55b1907eb1c073ab95d5c5c749
Source-Link: googleapis/googleapis@b6901e7
  • Loading branch information
yoshi-automation authored and jskeet committed Aug 17, 2021
1 parent 26753cf commit 95dd8f3
Show file tree
Hide file tree
Showing 8 changed files with 6,975 additions and 1,313 deletions.

Large diffs are not rendered by default.

Expand Up @@ -297,6 +297,7 @@ public void GetMetadataImportRequestObject()
UpdateTime = new wkt::Timestamp(),
State = MetadataImport.Types.State.Updating,
DatabaseDump = new MetadataImport.Types.DatabaseDump(),
EndTime = new wkt::Timestamp(),
};
mockGrpcClient.Setup(x => x.GetMetadataImport(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
DataprocMetastoreClient client = new DataprocMetastoreClientImpl(mockGrpcClient.Object, null);
Expand All @@ -322,6 +323,7 @@ public void GetMetadataImportRequestObject()
UpdateTime = new wkt::Timestamp(),
State = MetadataImport.Types.State.Updating,
DatabaseDump = new MetadataImport.Types.DatabaseDump(),
EndTime = new wkt::Timestamp(),
};
mockGrpcClient.Setup(x => x.GetMetadataImportAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<MetadataImport>(stt::Task.FromResult(expectedResponse), null, null, null, null));
DataprocMetastoreClient client = new DataprocMetastoreClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -349,6 +351,7 @@ public void GetMetadataImport()
UpdateTime = new wkt::Timestamp(),
State = MetadataImport.Types.State.Updating,
DatabaseDump = new MetadataImport.Types.DatabaseDump(),
EndTime = new wkt::Timestamp(),
};
mockGrpcClient.Setup(x => x.GetMetadataImport(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
DataprocMetastoreClient client = new DataprocMetastoreClientImpl(mockGrpcClient.Object, null);
Expand All @@ -374,6 +377,7 @@ public void GetMetadataImport()
UpdateTime = new wkt::Timestamp(),
State = MetadataImport.Types.State.Updating,
DatabaseDump = new MetadataImport.Types.DatabaseDump(),
EndTime = new wkt::Timestamp(),
};
mockGrpcClient.Setup(x => x.GetMetadataImportAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<MetadataImport>(stt::Task.FromResult(expectedResponse), null, null, null, null));
DataprocMetastoreClient client = new DataprocMetastoreClientImpl(mockGrpcClient.Object, null);
Expand Down Expand Up @@ -401,6 +405,7 @@ public void GetMetadataImportResourceNames()
UpdateTime = new wkt::Timestamp(),
State = MetadataImport.Types.State.Updating,
DatabaseDump = new MetadataImport.Types.DatabaseDump(),
EndTime = new wkt::Timestamp(),
};
mockGrpcClient.Setup(x => x.GetMetadataImport(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
DataprocMetastoreClient client = new DataprocMetastoreClientImpl(mockGrpcClient.Object, null);
Expand All @@ -426,6 +431,7 @@ public void GetMetadataImportResourceNames()
UpdateTime = new wkt::Timestamp(),
State = MetadataImport.Types.State.Updating,
DatabaseDump = new MetadataImport.Types.DatabaseDump(),
EndTime = new wkt::Timestamp(),
};
mockGrpcClient.Setup(x => x.GetMetadataImportAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<MetadataImport>(stt::Task.FromResult(expectedResponse), null, null, null, null));
DataprocMetastoreClient client = new DataprocMetastoreClientImpl(mockGrpcClient.Object, null);
Expand All @@ -435,5 +441,185 @@ public void GetMetadataImportResourceNames()
xunit::Assert.Same(expectedResponse, responseCancellationToken);
mockGrpcClient.VerifyAll();
}

[xunit::FactAttribute]
public void GetBackupRequestObject()
{
moq::Mock<DataprocMetastore.DataprocMetastoreClient> mockGrpcClient = new moq::Mock<DataprocMetastore.DataprocMetastoreClient>(moq::MockBehavior.Strict);
mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock<lro::Operations.OperationsClient>().Object);
GetBackupRequest request = new GetBackupRequest
{
BackupName = BackupName.FromProjectLocationServiceBackup("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]"),
};
Backup expectedResponse = new Backup
{
BackupName = BackupName.FromProjectLocationServiceBackup("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]"),
CreateTime = new wkt::Timestamp(),
EndTime = new wkt::Timestamp(),
State = Backup.Types.State.Unspecified,
ServiceRevision = new Service(),
Description = "description2cf9da67",
RestoringServices =
{
"restoring_servicese2c88107",
},
};
mockGrpcClient.Setup(x => x.GetBackup(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
DataprocMetastoreClient client = new DataprocMetastoreClientImpl(mockGrpcClient.Object, null);
Backup response = client.GetBackup(request);
xunit::Assert.Same(expectedResponse, response);
mockGrpcClient.VerifyAll();
}

[xunit::FactAttribute]
public async stt::Task GetBackupRequestObjectAsync()
{
moq::Mock<DataprocMetastore.DataprocMetastoreClient> mockGrpcClient = new moq::Mock<DataprocMetastore.DataprocMetastoreClient>(moq::MockBehavior.Strict);
mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock<lro::Operations.OperationsClient>().Object);
GetBackupRequest request = new GetBackupRequest
{
BackupName = BackupName.FromProjectLocationServiceBackup("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]"),
};
Backup expectedResponse = new Backup
{
BackupName = BackupName.FromProjectLocationServiceBackup("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]"),
CreateTime = new wkt::Timestamp(),
EndTime = new wkt::Timestamp(),
State = Backup.Types.State.Unspecified,
ServiceRevision = new Service(),
Description = "description2cf9da67",
RestoringServices =
{
"restoring_servicese2c88107",
},
};
mockGrpcClient.Setup(x => x.GetBackupAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Backup>(stt::Task.FromResult(expectedResponse), null, null, null, null));
DataprocMetastoreClient client = new DataprocMetastoreClientImpl(mockGrpcClient.Object, null);
Backup responseCallSettings = await client.GetBackupAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));
xunit::Assert.Same(expectedResponse, responseCallSettings);
Backup responseCancellationToken = await client.GetBackupAsync(request, st::CancellationToken.None);
xunit::Assert.Same(expectedResponse, responseCancellationToken);
mockGrpcClient.VerifyAll();
}

[xunit::FactAttribute]
public void GetBackup()
{
moq::Mock<DataprocMetastore.DataprocMetastoreClient> mockGrpcClient = new moq::Mock<DataprocMetastore.DataprocMetastoreClient>(moq::MockBehavior.Strict);
mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock<lro::Operations.OperationsClient>().Object);
GetBackupRequest request = new GetBackupRequest
{
BackupName = BackupName.FromProjectLocationServiceBackup("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]"),
};
Backup expectedResponse = new Backup
{
BackupName = BackupName.FromProjectLocationServiceBackup("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]"),
CreateTime = new wkt::Timestamp(),
EndTime = new wkt::Timestamp(),
State = Backup.Types.State.Unspecified,
ServiceRevision = new Service(),
Description = "description2cf9da67",
RestoringServices =
{
"restoring_servicese2c88107",
},
};
mockGrpcClient.Setup(x => x.GetBackup(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
DataprocMetastoreClient client = new DataprocMetastoreClientImpl(mockGrpcClient.Object, null);
Backup response = client.GetBackup(request.Name);
xunit::Assert.Same(expectedResponse, response);
mockGrpcClient.VerifyAll();
}

[xunit::FactAttribute]
public async stt::Task GetBackupAsync()
{
moq::Mock<DataprocMetastore.DataprocMetastoreClient> mockGrpcClient = new moq::Mock<DataprocMetastore.DataprocMetastoreClient>(moq::MockBehavior.Strict);
mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock<lro::Operations.OperationsClient>().Object);
GetBackupRequest request = new GetBackupRequest
{
BackupName = BackupName.FromProjectLocationServiceBackup("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]"),
};
Backup expectedResponse = new Backup
{
BackupName = BackupName.FromProjectLocationServiceBackup("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]"),
CreateTime = new wkt::Timestamp(),
EndTime = new wkt::Timestamp(),
State = Backup.Types.State.Unspecified,
ServiceRevision = new Service(),
Description = "description2cf9da67",
RestoringServices =
{
"restoring_servicese2c88107",
},
};
mockGrpcClient.Setup(x => x.GetBackupAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Backup>(stt::Task.FromResult(expectedResponse), null, null, null, null));
DataprocMetastoreClient client = new DataprocMetastoreClientImpl(mockGrpcClient.Object, null);
Backup responseCallSettings = await client.GetBackupAsync(request.Name, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));
xunit::Assert.Same(expectedResponse, responseCallSettings);
Backup responseCancellationToken = await client.GetBackupAsync(request.Name, st::CancellationToken.None);
xunit::Assert.Same(expectedResponse, responseCancellationToken);
mockGrpcClient.VerifyAll();
}

[xunit::FactAttribute]
public void GetBackupResourceNames()
{
moq::Mock<DataprocMetastore.DataprocMetastoreClient> mockGrpcClient = new moq::Mock<DataprocMetastore.DataprocMetastoreClient>(moq::MockBehavior.Strict);
mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock<lro::Operations.OperationsClient>().Object);
GetBackupRequest request = new GetBackupRequest
{
BackupName = BackupName.FromProjectLocationServiceBackup("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]"),
};
Backup expectedResponse = new Backup
{
BackupName = BackupName.FromProjectLocationServiceBackup("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]"),
CreateTime = new wkt::Timestamp(),
EndTime = new wkt::Timestamp(),
State = Backup.Types.State.Unspecified,
ServiceRevision = new Service(),
Description = "description2cf9da67",
RestoringServices =
{
"restoring_servicese2c88107",
},
};
mockGrpcClient.Setup(x => x.GetBackup(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
DataprocMetastoreClient client = new DataprocMetastoreClientImpl(mockGrpcClient.Object, null);
Backup response = client.GetBackup(request.BackupName);
xunit::Assert.Same(expectedResponse, response);
mockGrpcClient.VerifyAll();
}

[xunit::FactAttribute]
public async stt::Task GetBackupResourceNamesAsync()
{
moq::Mock<DataprocMetastore.DataprocMetastoreClient> mockGrpcClient = new moq::Mock<DataprocMetastore.DataprocMetastoreClient>(moq::MockBehavior.Strict);
mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock<lro::Operations.OperationsClient>().Object);
GetBackupRequest request = new GetBackupRequest
{
BackupName = BackupName.FromProjectLocationServiceBackup("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]"),
};
Backup expectedResponse = new Backup
{
BackupName = BackupName.FromProjectLocationServiceBackup("[PROJECT]", "[LOCATION]", "[SERVICE]", "[BACKUP]"),
CreateTime = new wkt::Timestamp(),
EndTime = new wkt::Timestamp(),
State = Backup.Types.State.Unspecified,
ServiceRevision = new Service(),
Description = "description2cf9da67",
RestoringServices =
{
"restoring_servicese2c88107",
},
};
mockGrpcClient.Setup(x => x.GetBackupAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<Backup>(stt::Task.FromResult(expectedResponse), null, null, null, null));
DataprocMetastoreClient client = new DataprocMetastoreClientImpl(mockGrpcClient.Object, null);
Backup responseCallSettings = await client.GetBackupAsync(request.BackupName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));
xunit::Assert.Same(expectedResponse, responseCallSettings);
Backup responseCancellationToken = await client.GetBackupAsync(request.BackupName, st::CancellationToken.None);
xunit::Assert.Same(expectedResponse, responseCancellationToken);
mockGrpcClient.VerifyAll();
}
}
}

0 comments on commit 95dd8f3

Please sign in to comment.