コード例 #1
0
 /// <summary>Snippet for GetIamPolicy</summary>
 public void GetIamPolicy_RequestObject()
 {
     // Snippet: GetIamPolicy(GetIamPolicyRequest,CallSettings)
     // Create client
     DatabaseAdminClient databaseAdminClient = DatabaseAdminClient.Create();
     // Initialize request argument(s)
     GetIamPolicyRequest request = new GetIamPolicyRequest
     {
         Resource = new DatabaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]").ToString(),
     };
     // Make the request
     Policy response = databaseAdminClient.GetIamPolicy(request);
     // End snippet
 }
 /// <summary>Snippet for GetIamPolicy</summary>
 public void GetIamPolicy_RequestObject()
 {
     // Snippet: GetIamPolicy(GetIamPolicyRequest,CallSettings)
     // Create client
     BigtableTableAdminClient bigtableTableAdminClient = BigtableTableAdminClient.Create();
     // Initialize request argument(s)
     GetIamPolicyRequest request = new GetIamPolicyRequest
     {
         Resource = new Google.Cloud.Bigtable.Common.V2.TableName("[PROJECT]", "[INSTANCE]", "[TABLE]").ToString(),
     };
     // Make the request
     Policy response = bigtableTableAdminClient.GetIamPolicy(request);
     // End snippet
 }
コード例 #3
0
 /// <summary>Snippet for GetIamPolicy</summary>
 public void GetIamPolicy_RequestObject()
 {
     // Snippet: GetIamPolicy(GetIamPolicyRequest,CallSettings)
     // Create client
     PublisherClient publisherClient = PublisherClient.Create();
     // Initialize request argument(s)
     GetIamPolicyRequest request = new GetIamPolicyRequest
     {
         Resource = new TopicName("[PROJECT]", "[TOPIC]").ToString(),
     };
     // Make the request
     Policy response = publisherClient.GetIamPolicy(request);
     // End snippet
 }
コード例 #4
0
 public void GetIamPolicy_RequestObject()
 {
     // Snippet: GetIamPolicy(GetIamPolicyRequest,CallSettings)
     // Create client
     SubscriberClient subscriberClient = SubscriberClient.Create();
     // Initialize request argument(s)
     GetIamPolicyRequest request = new GetIamPolicyRequest
     {
         Resource = new SubscriptionName("[PROJECT]", "[SUBSCRIPTION]").ToString(),
     };
     // Make the request
     Policy response = subscriberClient.GetIamPolicy(request);
     // End snippet
 }
        /// <summary>Snippet for GetIamPolicyAsync</summary>
        /// <remarks>
        /// This snippet has been automatically generated for illustrative purposes only.
        /// It may require modifications to work in your environment.
        /// </remarks>
        public async Task GetIamPolicyRequestObjectAsync()
        {
            // Create client
            PolicyTagManagerClient policyTagManagerClient = await PolicyTagManagerClient.CreateAsync();

            // Initialize request argument(s)
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
                Options = new GetPolicyOptions(),
            };
            // Make the request
            Policy response = await policyTagManagerClient.GetIamPolicyAsync(request);
        }
コード例 #6
0
 /// <summary>Snippet for GetIamPolicy</summary>
 public void GetIamPolicy_RequestObject()
 {
     // Snippet: GetIamPolicy(GetIamPolicyRequest,CallSettings)
     // Create client
     ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.Create();
     // Initialize request argument(s)
     GetIamPolicyRequest request = new GetIamPolicyRequest
     {
         ResourceAsIamResourceNameOneof = IamResourceNameOneof.From(new NoteName("[PROJECT]", "[NOTE]")),
     };
     // Make the request
     Policy response = containerAnalysisV1Beta1Client.GetIamPolicy(request);
     // End snippet
 }
コード例 #7
0
 /// <summary>Snippet for GetIamPolicy</summary>
 public void GetIamPolicyRequestObject()
 {
     // Snippet: GetIamPolicy(GetIamPolicyRequest, CallSettings)
     // Create client
     ContainerAnalysisClient containerAnalysisClient = ContainerAnalysisClient.Create();
     // Initialize request argument(s)
     GetIamPolicyRequest request = new GetIamPolicyRequest
     {
         ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
         Options = new GetPolicyOptions(),
     };
     // Make the request
     Policy response = containerAnalysisClient.GetIamPolicy(request);
     // End snippet
 }
コード例 #8
0
 /// <summary>Snippet for GetIamPolicy</summary>
 public void GetIamPolicyRequestObject()
 {
     // Snippet: GetIamPolicy(GetIamPolicyRequest, CallSettings)
     // Create client
     IdentityAwareProxyAdminServiceClient identityAwareProxyAdminServiceClient = IdentityAwareProxyAdminServiceClient.Create();
     // Initialize request argument(s)
     GetIamPolicyRequest request = new GetIamPolicyRequest
     {
         ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
         Options = new GetPolicyOptions(),
     };
     // Make the request
     Policy response = identityAwareProxyAdminServiceClient.GetIamPolicy(request);
     // End snippet
 }
コード例 #9
0
        public async Task GetIamPolicyAsync_RequestObject()
        {
            // Snippet: GetIamPolicyAsync(GetIamPolicyRequest,CallSettings)
            // Create client
            InstanceAdminClient instanceAdminClient = await InstanceAdminClient.CreateAsync();

            // Initialize request argument(s)
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                Resource = new InstanceName("[PROJECT]", "[INSTANCE]").ToString(),
            };
            // Make the request
            Policy response = await instanceAdminClient.GetIamPolicyAsync(request);

            // End snippet
        }
コード例 #10
0
        /// <summary>Snippet for GetIamPolicyAsync</summary>
        public async Task GetIamPolicyAsync_RequestObject()
        {
            // Snippet: GetIamPolicyAsync(GetIamPolicyRequest,CallSettings)
            // Create client
            PublisherServiceApiClient publisherServiceApiClient = await PublisherServiceApiClient.CreateAsync();

            // Initialize request argument(s)
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                Resource = new TopicName("[PROJECT]", "[TOPIC]").ToString(),
            };
            // Make the request
            Policy response = await publisherServiceApiClient.GetIamPolicyAsync(request);

            // End snippet
        }
コード例 #11
0
        /// <summary>Snippet for GetIamPolicyAsync</summary>
        public async Task GetIamPolicyAsync_RequestObject()
        {
            // Snippet: GetIamPolicyAsync(GetIamPolicyRequest,CallSettings)
            // Additional: GetIamPolicyAsync(GetIamPolicyRequest,CancellationToken)
            // Create client
            ContainerAnalysisClient containerAnalysisClient = await ContainerAnalysisClient.CreateAsync();

            // Initialize request argument(s)
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                ResourceAsResourceName = IamResourceNameOneof.From(new NoteName("[PROJECT]", "[NOTE]")),
            };
            // Make the request
            Policy response = await containerAnalysisClient.GetIamPolicyAsync(request);

            // End snippet
        }
        /// <summary>Snippet for GetIamPolicyAsync</summary>
        public async Task GetIamPolicyAsync_RequestObject()
        {
            // Snippet: GetIamPolicyAsync(GetIamPolicyRequest,CallSettings)
            // Additional: GetIamPolicyAsync(GetIamPolicyRequest,CancellationToken)
            // Create client
            BigtableTableAdminClient bigtableTableAdminClient = await BigtableTableAdminClient.CreateAsync();

            // Initialize request argument(s)
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                Resource = new Google.Cloud.Bigtable.Common.V2.TableName("[PROJECT]", "[INSTANCE]", "[TABLE]").ToString(),
            };
            // Make the request
            Policy response = await bigtableTableAdminClient.GetIamPolicyAsync(request);

            // End snippet
        }
コード例 #13
0
        /// <summary>Snippet for GetIamPolicyAsync</summary>
        public async Task GetIamPolicyAsync_RequestObject()
        {
            // Snippet: GetIamPolicyAsync(GetIamPolicyRequest,CallSettings)
            // Additional: GetIamPolicyAsync(GetIamPolicyRequest,CancellationToken)
            // Create client
            DatabaseAdminClient databaseAdminClient = await DatabaseAdminClient.CreateAsync();

            // Initialize request argument(s)
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                Resource = new DatabaseName("[PROJECT]", "[INSTANCE]", "[DATABASE]").ToString(),
            };
            // Make the request
            Policy response = await databaseAdminClient.GetIamPolicyAsync(request);

            // End snippet
        }
コード例 #14
0
        /// <summary>Snippet for GetIamPolicyAsync</summary>
        public async Task GetIamPolicyRequestObjectAsync()
        {
            // Snippet: GetIamPolicyAsync(GetIamPolicyRequest, CallSettings)
            // Additional: GetIamPolicyAsync(GetIamPolicyRequest, CancellationToken)
            // Create client
            IdentityAwareProxyAdminServiceClient identityAwareProxyAdminServiceClient = await IdentityAwareProxyAdminServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"),
                Options = new GetPolicyOptions(),
            };
            // Make the request
            Policy response = await identityAwareProxyAdminServiceClient.GetIamPolicyAsync(request);

            // End snippet
        }
コード例 #15
0
        /// <summary>Snippet for GetIamPolicyAsync</summary>
        public async Task GetIamPolicyAsync_RequestObject()
        {
            // Snippet: GetIamPolicyAsync(GetIamPolicyRequest, CallSettings)
            // Additional: GetIamPolicyAsync(GetIamPolicyRequest, CancellationToken)
            // Create client
            ContainerAnalysisClient containerAnalysisClient = await ContainerAnalysisClient.CreateAsync();

            // Initialize request argument(s)
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                ResourceAsResourceName = new UnknownResourceName("a/wildcard/resource"),
                Options = new GetPolicyOptions(),
            };
            // Make the request
            Policy response = await containerAnalysisClient.GetIamPolicyAsync(request);

            // End snippet
        }
コード例 #16
0
        public async Task GetIamPolicyAsync2()
        {
            Mock <BigtableTableAdmin.BigtableTableAdminClient> mockGrpcClient = new Mock <BigtableTableAdmin.BigtableTableAdminClient>(MockBehavior.Strict);
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                Resource = new Google.Cloud.Bigtable.Common.V2.TableName("[PROJECT]", "[INSTANCE]", "[TABLE]").ToString(),
            };
            Policy expectedResponse = new Policy
            {
                Version = 351608024,
                Etag    = ByteString.CopyFromUtf8("etag3123477"),
            };

            mockGrpcClient.Setup(x => x.GetIamPolicyAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Policy>(Task.FromResult(expectedResponse), null, null, null, null));
            BigtableTableAdminClient client = new BigtableTableAdminClientImpl(mockGrpcClient.Object, null);
            Policy response = await client.GetIamPolicyAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #17
0
        public void GetIamPolicy2()
        {
            Mock <ContainerAnalysis.ContainerAnalysisClient> mockGrpcClient = new Mock <ContainerAnalysis.ContainerAnalysisClient>(MockBehavior.Strict);
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                ResourceAsResourceName = IamResourceNameOneof.From(new NoteName("[PROJECT]", "[NOTE]")),
            };
            Policy expectedResponse = new Policy
            {
                Version = 351608024,
                Etag    = ByteString.CopyFromUtf8("21"),
            };

            mockGrpcClient.Setup(x => x.GetIamPolicy(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ContainerAnalysisClient client = new ContainerAnalysisClientImpl(mockGrpcClient.Object, null);
            Policy response = client.GetIamPolicy(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #18
0
        public async Task GetIamPolicyAsync2()
        {
            Mock <ContainerAnalysisV1Beta1.ContainerAnalysisV1Beta1Client> mockGrpcClient = new Mock <ContainerAnalysisV1Beta1.ContainerAnalysisV1Beta1Client>(MockBehavior.Strict);
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                ResourceAsIamResourceNameOneof = IamResourceNameOneof.From(new NoteName("[PROJECT]", "[NOTE]")),
            };
            Policy expectedResponse = new Policy
            {
                Version = 351608024,
                Etag    = ByteString.CopyFromUtf8("21"),
            };

            mockGrpcClient.Setup(x => x.GetIamPolicyAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Policy>(Task.FromResult(expectedResponse), null, null, null, null));
            ContainerAnalysisV1Beta1Client client = new ContainerAnalysisV1Beta1ClientImpl(mockGrpcClient.Object, null);
            Policy response = await client.GetIamPolicyAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #19
0
        public void GetIamPolicyRequestObject()
        {
            moq::Mock <IAMPolicy.IAMPolicyClient> mockGrpcClient = new moq::Mock <IAMPolicy.IAMPolicyClient>(moq::MockBehavior.Strict);
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                ResourceAsResourceName = new gax::UnparsedResourceName("a/wildcard/resource"),
                Options = new GetPolicyOptions(),
            };
            Policy expectedResponse = new Policy
            {
                Version  = 271578922,
                Etag     = proto::ByteString.CopyFromUtf8("etage8ad7218"),
                Bindings = { new Binding(), },
            };

            mockGrpcClient.Setup(x => x.GetIamPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            IAMPolicyClient client   = new IAMPolicyClientImpl(mockGrpcClient.Object, null);
            Policy          response = client.GetIamPolicy(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #20
0
        public void GetIamPolicy()
        {
            Mock <BigtableTableAdmin.BigtableTableAdminClient> mockGrpcClient = new Mock <BigtableTableAdmin.BigtableTableAdminClient>(MockBehavior.Strict);
            GetIamPolicyRequest expectedRequest = new GetIamPolicyRequest
            {
                Resource = new Google.Cloud.Bigtable.Common.V2.TableName("[PROJECT]", "[INSTANCE]", "[TABLE]").ToString(),
            };
            Policy expectedResponse = new Policy
            {
                Version = 351608024,
                Etag    = ByteString.CopyFromUtf8("etag3123477"),
            };

            mockGrpcClient.Setup(x => x.GetIamPolicy(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            BigtableTableAdminClient client = new BigtableTableAdminClientImpl(mockGrpcClient.Object, null);
            string formattedResource        = new Google.Cloud.Bigtable.Common.V2.TableName("[PROJECT]", "[INSTANCE]", "[TABLE]").ToString();
            Policy response = client.GetIamPolicy(formattedResource);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #21
0
        public async Task GetIamPolicyAsync2()
        {
            Mock <InstanceAdmin.InstanceAdminClient> mockGrpcClient = new Mock <InstanceAdmin.InstanceAdminClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                Resource = new InstanceName("[PROJECT]", "[INSTANCE]").ToString(),
            };
            Policy expectedResponse = new Policy
            {
                Version = 351608024,
                Etag    = ByteString.CopyFromUtf8("21"),
            };

            mockGrpcClient.Setup(x => x.GetIamPolicyAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Policy>(Task.FromResult(expectedResponse), null, null, null, null));
            InstanceAdminClient client = new InstanceAdminClientImpl(mockGrpcClient.Object, null);
            Policy response            = await client.GetIamPolicyAsync(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #22
0
        public void GetIamPolicy2()
        {
            Mock <InstanceAdmin.InstanceAdminClient> mockGrpcClient = new Mock <InstanceAdmin.InstanceAdminClient>(MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClient())
            .Returns(new Mock <Operations.OperationsClient>().Object);
            GetIamPolicyRequest request = new GetIamPolicyRequest
            {
                Resource = new Google.Cloud.Spanner.Common.V1.InstanceName("[PROJECT]", "[INSTANCE]").ToString(),
            };
            Policy expectedResponse = new Policy
            {
                Version = 351608024,
                Etag    = ByteString.CopyFromUtf8("21"),
            };

            mockGrpcClient.Setup(x => x.GetIamPolicy(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            InstanceAdminClient client = new InstanceAdminClientImpl(mockGrpcClient.Object, null);
            Policy response            = client.GetIamPolicy(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #23
0
 internal void ModifyRequest(GetIamPolicyRequest request)
 {
 }
コード例 #24
0
 partial void Modify_GetIamPolicyRequest(ref GetIamPolicyRequest request, ref CallSettings settings) =>
 ApplyResourcePrefixHeader(ref settings, request.Resource);
コード例 #25
0
        /// <summary>
        /// Returns the IAM access control policy for the specified Project.Permission is denied if the policy or the resource does not exist.
        /// Documentation https://developers.google.com/cloudresourcemanager/v1beta1/reference/projects/getIamPolicy
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated Cloudresourcemanager service.</param>
        /// <param name="resource">REQUIRED: The resource for which the policy is being requested.See the operation documentation for the appropriate value for this field.</param>
        /// <param name="body">A valid Cloudresourcemanager v1beta1 body.</param>
        /// <returns>PolicyResponse</returns>
        public static Policy GetIamPolicy(CloudresourcemanagerService service, string resource, GetIamPolicyRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (resource == null)
                {
                    throw new ArgumentNullException(resource);
                }

                // Make the request.
                return(service.Projects.GetIamPolicy(body, resource).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Projects.GetIamPolicy failed.", ex);
            }
        }