/// <summary>Snippet for SetIamPolicyAsync</summary> public async Task SetIamPolicyResourceNamesAsync() { // Snippet: SetIamPolicyAsync(IResourceName, CallSettings) // Additional: SetIamPolicyAsync(IResourceName, CancellationToken) // Create client OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync(); // Initialize request argument(s) IResourceName resource = new UnparsedResourceName("a/wildcard/resource"); // Make the request Policy response = await organizationsClient.SetIamPolicyAsync(resource); // End snippet }
/// <summary>Snippet for GetOrganizationAsync</summary> public async Task GetOrganizationAsync() { // Snippet: GetOrganizationAsync(string, CallSettings) // Additional: GetOrganizationAsync(string, CancellationToken) // Create client OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync(); // Initialize request argument(s) string name = "organizations/[ORGANIZATION]"; // Make the request Organization response = await organizationsClient.GetOrganizationAsync(name); // End snippet }
/// <summary>Snippet for SetIamPolicyAsync</summary> public async Task SetIamPolicyAsync() { // Snippet: SetIamPolicyAsync(string, CallSettings) // Additional: SetIamPolicyAsync(string, CancellationToken) // Create client OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync(); // Initialize request argument(s) string resource = "a/wildcard/resource"; // Make the request Policy response = await organizationsClient.SetIamPolicyAsync(resource); // End snippet }
/// <summary>Snippet for GetOrganizationAsync</summary> public async Task GetOrganizationResourceNamesAsync() { // Snippet: GetOrganizationAsync(OrganizationName, CallSettings) // Additional: GetOrganizationAsync(OrganizationName, CancellationToken) // Create client OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync(); // Initialize request argument(s) OrganizationName name = OrganizationName.FromOrganization("[ORGANIZATION]"); // Make the request Organization response = await organizationsClient.GetOrganizationAsync(name); // End snippet }
/// <summary>Snippet for TestIamPermissionsAsync</summary> public async Task TestIamPermissionsResourceNamesAsync() { // Snippet: TestIamPermissionsAsync(IResourceName, IEnumerable<string>, CallSettings) // Additional: TestIamPermissionsAsync(IResourceName, IEnumerable<string>, CancellationToken) // Create client OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync(); // Initialize request argument(s) IResourceName resource = new UnparsedResourceName("a/wildcard/resource"); IEnumerable <string> permissions = new string[] { "", }; // Make the request TestIamPermissionsResponse response = await organizationsClient.TestIamPermissionsAsync(resource, permissions); // End snippet }
/// <summary>Snippet for SearchOrganizationsAsync</summary> public async Task SearchOrganizationsRequestObjectAsync() { // Snippet: SearchOrganizationsAsync(SearchOrganizationsRequest, CallSettings) // Create client OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync(); // Initialize request argument(s) SearchOrganizationsRequest request = new SearchOrganizationsRequest { Query = "", }; // Make the request PagedAsyncEnumerable <SearchOrganizationsResponse, Organization> response = organizationsClient.SearchOrganizationsAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Organization item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((SearchOrganizationsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Organization item in page) { // Do something with each item Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Organization> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Organization item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary>Snippet for GetOrganizationAsync</summary> public async Task GetOrganizationRequestObjectAsync() { // Snippet: GetOrganizationAsync(GetOrganizationRequest, CallSettings) // Additional: GetOrganizationAsync(GetOrganizationRequest, CancellationToken) // Create client OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync(); // Initialize request argument(s) GetOrganizationRequest request = new GetOrganizationRequest { OrganizationName = OrganizationName.FromOrganization("[ORGANIZATION]"), }; // Make the request Organization response = await organizationsClient.GetOrganizationAsync(request); // End snippet }
/// <summary>Snippet for TestIamPermissionsAsync</summary> public async Task TestIamPermissionsRequestObjectAsync() { // Snippet: TestIamPermissionsAsync(TestIamPermissionsRequest, CallSettings) // Additional: TestIamPermissionsAsync(TestIamPermissionsRequest, CancellationToken) // Create client OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync(); // Initialize request argument(s) TestIamPermissionsRequest request = new TestIamPermissionsRequest { ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"), Permissions = { "", }, }; // Make the request TestIamPermissionsResponse response = await organizationsClient.TestIamPermissionsAsync(request); // End snippet }
/// <summary>Snippet for SetIamPolicyAsync</summary> public async Task SetIamPolicyRequestObjectAsync() { // Snippet: SetIamPolicyAsync(SetIamPolicyRequest, CallSettings) // Additional: SetIamPolicyAsync(SetIamPolicyRequest, CancellationToken) // Create client OrganizationsClient organizationsClient = await OrganizationsClient.CreateAsync(); // Initialize request argument(s) SetIamPolicyRequest request = new SetIamPolicyRequest { ResourceAsResourceName = new UnparsedResourceName("a/wildcard/resource"), Policy = new Policy(), }; // Make the request Policy response = await organizationsClient.SetIamPolicyAsync(request); // End snippet }