예제 #1
0
        /// <summary>Snippet for TestIamPermissionsAsync</summary>
        public async Task TestIamPermissionsAsync()
        {
            // Snippet: TestIamPermissionsAsync(string, string, string, TestPermissionsRequest, CallSettings)
            // Additional: TestIamPermissionsAsync(string, string, string, TestPermissionsRequest, CancellationToken)
            // Create client
            DisksClient disksClient = await DisksClient.CreateAsync();

            // Initialize request argument(s)
            string project  = "";
            string zone     = "";
            string resource = "";
            TestPermissionsRequest testPermissionsRequestResource = new TestPermissionsRequest();
            // Make the request
            TestPermissionsResponse response = await disksClient.TestIamPermissionsAsync(project, zone, resource, testPermissionsRequestResource);

            // End snippet
        }
예제 #2
0
 /// <summary>Snippet for TestIamPermissions</summary>
 public void TestIamPermissionsRequestObject()
 {
     // Snippet: TestIamPermissions(TestIamPermissionsDiskRequest, CallSettings)
     // Create client
     DisksClient disksClient = DisksClient.Create();
     // Initialize request argument(s)
     TestIamPermissionsDiskRequest request = new TestIamPermissionsDiskRequest
     {
         Zone     = "",
         Resource = "",
         Project  = "",
         TestPermissionsRequestResource = new TestPermissionsRequest(),
     };
     // Make the request
     TestPermissionsResponse response = disksClient.TestIamPermissions(request);
     // End snippet
 }
 /// <summary>Snippet for TestIamPermissions</summary>
 public void TestIamPermissionsRequestObject()
 {
     // Snippet: TestIamPermissions(TestIamPermissionsVpnGatewayRequest, CallSettings)
     // Create client
     VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.Create();
     // Initialize request argument(s)
     TestIamPermissionsVpnGatewayRequest request = new TestIamPermissionsVpnGatewayRequest
     {
         Region   = "",
         Resource = "",
         Project  = "",
         TestPermissionsRequestResource = new TestPermissionsRequest(),
     };
     // Make the request
     TestPermissionsResponse response = vpnGatewaysClient.TestIamPermissions(request);
     // End snippet
 }
예제 #4
0
 /// <summary>Snippet for TestIamPermissions</summary>
 public void TestIamPermissionsRequestObject()
 {
     // Snippet: TestIamPermissions(TestIamPermissionsPacketMirroringRequest, CallSettings)
     // Create client
     PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.Create();
     // Initialize request argument(s)
     TestIamPermissionsPacketMirroringRequest request = new TestIamPermissionsPacketMirroringRequest
     {
         Region = "",
         TestPermissionsRequestResource = new TestPermissionsRequest(),
         Resource = "",
         Project  = "",
     };
     // Make the request
     TestPermissionsResponse response = packetMirroringsClient.TestIamPermissions(request);
     // End snippet
 }
        /// <summary>Snippet for TestIamPermissionsAsync</summary>
        public async Task TestIamPermissionsRequestObjectAsync()
        {
            // Snippet: TestIamPermissionsAsync(TestIamPermissionsImageRequest, CallSettings)
            // Additional: TestIamPermissionsAsync(TestIamPermissionsImageRequest, CancellationToken)
            // Create client
            ImagesClient imagesClient = await ImagesClient.CreateAsync();

            // Initialize request argument(s)
            TestIamPermissionsImageRequest request = new TestIamPermissionsImageRequest
            {
                Resource = "",
                Project  = "",
                TestPermissionsRequestResource = new TestPermissionsRequest(),
            };
            // Make the request
            TestPermissionsResponse response = await imagesClient.TestIamPermissionsAsync(request);

            // End snippet
        }
예제 #6
0
        public void TestIamPermissions()
        {
            moq::Mock <LicenseCodes.LicenseCodesClient> mockGrpcClient = new moq::Mock <LicenseCodes.LicenseCodesClient>(moq::MockBehavior.Strict);
            TestIamPermissionsLicenseCodeRequest        request        = new TestIamPermissionsLicenseCodeRequest
            {
                TestPermissionsRequestResource = new TestPermissionsRequest(),
                Resource = "resource164eab96",
                Project  = "projectaa6ff846",
            };
            TestPermissionsResponse expectedResponse = new TestPermissionsResponse
            {
                Permissions =
                {
                    "permissions535a2741",
                },
            };

            mockGrpcClient.Setup(x => x.TestIamPermissions(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            LicenseCodesClient      client   = new LicenseCodesClientImpl(mockGrpcClient.Object, null);
            TestPermissionsResponse response = client.TestIamPermissions(request.Project, request.Resource, request.TestPermissionsRequestResource);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }