public async Task SetIamPolicyAsync() { // Snippet: SetIamPolicyAsync(string,Policy,CallSettings) // Additional: SetIamPolicyAsync(string,Policy,CancellationToken) // Create client PublisherClient publisherClient = PublisherClient.Create(); // Initialize request argument(s) string formattedResource = PublisherClient.FormatTopicName("[PROJECT]", "[TOPIC]"); Policy policy = new Policy(); // Make the request Policy response = await publisherClient.SetIamPolicyAsync(formattedResource, policy); // End snippet }
public async Task SetIamPolicyAsync_RequestObject() { // Snippet: SetIamPolicyAsync(SetIamPolicyRequest,CallSettings) // Create client PublisherClient publisherClient = await PublisherClient.CreateAsync(); // Initialize request argument(s) SetIamPolicyRequest request = new SetIamPolicyRequest { Resource = new TopicName("[PROJECT]", "[TOPIC]").ToString(), Policy = new Policy(), }; // Make the request Policy response = await publisherClient.SetIamPolicyAsync(request); // End snippet }