Skip to content

Commit

Permalink
fix!: remove AnalyzeIamPolicy and ExportIamPolicyAnalysis RPCs
Browse files Browse the repository at this point in the history
BREAKING CHANGE: These RPCs do not currently work on the backend, so they should not be added to the client libraries.

PiperOrigin-RevId: 330786980

Source-Author: Google APIs <noreply@google.com>
Source-Date: Wed Sep 9 13:35:02 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: ef03f63f2f2d3b2dd936e46595c0f746cb10c43c
Source-Link: googleapis/googleapis@ef03f63
  • Loading branch information
yoshi-automation authored and jskeet committed Sep 14, 2020
1 parent 7480149 commit c9ca107
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 5,514 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -870,107 +870,5 @@ await response.AsRawResponses().ForEachAsync((SearchAllIamPoliciesResponse page)
string nextPageToken = singlePage.NextPageToken;
// End snippet
}

/// <summary>Snippet for AnalyzeIamPolicy</summary>
public void AnalyzeIamPolicyRequestObject()
{
// Snippet: AnalyzeIamPolicy(AnalyzeIamPolicyRequest, CallSettings)
// Create client
AssetServiceClient assetServiceClient = AssetServiceClient.Create();
// Initialize request argument(s)
AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest
{
AnalysisQuery = new IamPolicyAnalysisQuery(),
ExecutionTimeout = new Duration(),
};
// Make the request
AnalyzeIamPolicyResponse response = assetServiceClient.AnalyzeIamPolicy(request);
// End snippet
}

/// <summary>Snippet for AnalyzeIamPolicyAsync</summary>
public async Task AnalyzeIamPolicyRequestObjectAsync()
{
// Snippet: AnalyzeIamPolicyAsync(AnalyzeIamPolicyRequest, CallSettings)
// Additional: AnalyzeIamPolicyAsync(AnalyzeIamPolicyRequest, CancellationToken)
// Create client
AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();
// Initialize request argument(s)
AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest
{
AnalysisQuery = new IamPolicyAnalysisQuery(),
ExecutionTimeout = new Duration(),
};
// Make the request
AnalyzeIamPolicyResponse response = await assetServiceClient.AnalyzeIamPolicyAsync(request);
// End snippet
}

/// <summary>Snippet for ExportIamPolicyAnalysis</summary>
public void ExportIamPolicyAnalysisRequestObject()
{
// Snippet: ExportIamPolicyAnalysis(ExportIamPolicyAnalysisRequest, CallSettings)
// Create client
AssetServiceClient assetServiceClient = AssetServiceClient.Create();
// Initialize request argument(s)
ExportIamPolicyAnalysisRequest request = new ExportIamPolicyAnalysisRequest
{
AnalysisQuery = new IamPolicyAnalysisQuery(),
OutputConfig = new IamPolicyAnalysisOutputConfig(),
};
// Make the request
Operation<ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest> response = assetServiceClient.ExportIamPolicyAnalysis(request);

// Poll until the returned long-running operation is complete
Operation<ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
ExportIamPolicyAnalysisResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest> retrievedResponse = assetServiceClient.PollOnceExportIamPolicyAnalysis(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportIamPolicyAnalysisResponse retrievedResult = retrievedResponse.Result;
}
// End snippet
}

/// <summary>Snippet for ExportIamPolicyAnalysisAsync</summary>
public async Task ExportIamPolicyAnalysisRequestObjectAsync()
{
// Snippet: ExportIamPolicyAnalysisAsync(ExportIamPolicyAnalysisRequest, CallSettings)
// Additional: ExportIamPolicyAnalysisAsync(ExportIamPolicyAnalysisRequest, CancellationToken)
// Create client
AssetServiceClient assetServiceClient = await AssetServiceClient.CreateAsync();
// Initialize request argument(s)
ExportIamPolicyAnalysisRequest request = new ExportIamPolicyAnalysisRequest
{
AnalysisQuery = new IamPolicyAnalysisQuery(),
OutputConfig = new IamPolicyAnalysisOutputConfig(),
};
// Make the request
Operation<ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest> response = await assetServiceClient.ExportIamPolicyAnalysisAsync(request);

// Poll until the returned long-running operation is complete
Operation<ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
ExportIamPolicyAnalysisResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<ExportIamPolicyAnalysisResponse, ExportIamPolicyAnalysisRequest> retrievedResponse = await assetServiceClient.PollOnceExportIamPolicyAnalysisAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
// If it has completed, then access the result
ExportIamPolicyAnalysisResponse retrievedResult = retrievedResponse.Result;
}
// End snippet
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -708,59 +708,5 @@ public void DeleteFeedResourceNames()
await client.DeleteFeedAsync(request.FeedName, st::CancellationToken.None);
mockGrpcClient.VerifyAll();
}

[xunit::FactAttribute]
public void AnalyzeIamPolicyRequestObject()
{
moq::Mock<AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock<AssetService.AssetServiceClient>(moq::MockBehavior.Strict);
mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock<lro::Operations.OperationsClient>().Object);
AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest
{
AnalysisQuery = new IamPolicyAnalysisQuery(),
ExecutionTimeout = new wkt::Duration(),
};
AnalyzeIamPolicyResponse expectedResponse = new AnalyzeIamPolicyResponse
{
MainAnalysis = new AnalyzeIamPolicyResponse.Types.IamPolicyAnalysis(),
ServiceAccountImpersonationAnalysis =
{
new AnalyzeIamPolicyResponse.Types.IamPolicyAnalysis(),
},
FullyExplored = false,
};
mockGrpcClient.Setup(x => x.AnalyzeIamPolicy(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(expectedResponse);
AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null);
AnalyzeIamPolicyResponse response = client.AnalyzeIamPolicy(request);
xunit::Assert.Same(expectedResponse, response);
mockGrpcClient.VerifyAll();
}

[xunit::FactAttribute]
public async stt::Task AnalyzeIamPolicyRequestObjectAsync()
{
moq::Mock<AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock<AssetService.AssetServiceClient>(moq::MockBehavior.Strict);
mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock<lro::Operations.OperationsClient>().Object);
AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest
{
AnalysisQuery = new IamPolicyAnalysisQuery(),
ExecutionTimeout = new wkt::Duration(),
};
AnalyzeIamPolicyResponse expectedResponse = new AnalyzeIamPolicyResponse
{
MainAnalysis = new AnalyzeIamPolicyResponse.Types.IamPolicyAnalysis(),
ServiceAccountImpersonationAnalysis =
{
new AnalyzeIamPolicyResponse.Types.IamPolicyAnalysis(),
},
FullyExplored = false,
};
mockGrpcClient.Setup(x => x.AnalyzeIamPolicyAsync(request, moq::It.IsAny<grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall<AnalyzeIamPolicyResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null);
AnalyzeIamPolicyResponse responseCallSettings = await client.AnalyzeIamPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));
xunit::Assert.Same(expectedResponse, responseCallSettings);
AnalyzeIamPolicyResponse responseCancellationToken = await client.AnalyzeIamPolicyAsync(request, st::CancellationToken.None);
xunit::Assert.Same(expectedResponse, responseCancellationToken);
mockGrpcClient.VerifyAll();
}
}
}
Loading

0 comments on commit c9ca107

Please sign in to comment.