public void TestIamPermissions()
 {
     // Snippet: TestIamPermissions(string,IEnumerable<string>,CallSettings)
     // Create client
     PublisherClient publisherClient = PublisherClient.Create();
     // Initialize request argument(s)
     string formattedResource         = new TopicName("[PROJECT]", "[TOPIC]").ToString();
     IEnumerable <string> permissions = new List <string>();
     // Make the request
     TestIamPermissionsResponse response = publisherClient.TestIamPermissions(formattedResource, permissions);
     // End snippet
 }
 public void TestIamPermissions_RequestObject()
 {
     // Snippet: TestIamPermissions(TestIamPermissionsRequest,CallSettings)
     // Create client
     PublisherClient publisherClient = PublisherClient.Create();
     // Initialize request argument(s)
     TestIamPermissionsRequest request = new TestIamPermissionsRequest
     {
         Resource    = new TopicName("[PROJECT]", "[TOPIC]").ToString(),
         Permissions = { },
     };
     // Make the request
     TestIamPermissionsResponse response = publisherClient.TestIamPermissions(request);
     // End snippet
 }
Exemple #3
0
        public TestIamPermissionsResponse TestSubscriptionIamPermissionsResponse(
            string subscriptionId, PublisherClient publisher)
        {
            // [START pubsub_test_subscription_permissons]
            List <string> permissions = new List <string>();

            permissions.Add("pubsub.subscriptions.get");
            permissions.Add("pubsub.subscriptions.update");
            TestIamPermissionsRequest request = new TestIamPermissionsRequest
            {
                Resource    = new TopicName(_projectId, subscriptionId).ToString(),
                Permissions = { permissions }
            };
            TestIamPermissionsResponse response = publisher.TestIamPermissions(request);

            return(response);
            // [END pubsub_test_subscription_permissons]
        }