/// <summary>Snippet for GetSecuritySettingsAsync</summary> public async Task GetSecuritySettingsRequestObjectAsync() { // Snippet: GetSecuritySettingsAsync(GetSecuritySettingsRequest, CallSettings) // Additional: GetSecuritySettingsAsync(GetSecuritySettingsRequest, CancellationToken) // Create client SecuritySettingsServiceClient securitySettingsServiceClient = await SecuritySettingsServiceClient.CreateAsync(); // Initialize request argument(s) GetSecuritySettingsRequest request = new GetSecuritySettingsRequest { SecuritySettingsName = SecuritySettingsName.FromProjectLocationSecuritySettings("[PROJECT]", "[LOCATION]", "[SECURITY_SETTINGS]"), }; // Make the request SecuritySettings response = await securitySettingsServiceClient.GetSecuritySettingsAsync(request); // End snippet }
/// <summary>Snippet for ListSecuritySettings</summary> public async Task ListSecuritySettingsResourceNamesAsync() { // Snippet: ListSecuritySettingsAsync(LocationName, string, int?, CallSettings) // Create client SecuritySettingsServiceClient securitySettingsServiceClient = await SecuritySettingsServiceClient.CreateAsync(); // Initialize request argument(s) LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"); // Make the request PagedAsyncEnumerable <ListSecuritySettingsResponse, SecuritySettings> response = securitySettingsServiceClient.ListSecuritySettingsAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((SecuritySettings 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((ListSecuritySettingsResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (SecuritySettings 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 <SecuritySettings> 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 (SecuritySettings 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 CreateSecuritySettingsAsync</summary> public async Task CreateSecuritySettingsRequestObjectAsync() { // Snippet: CreateSecuritySettingsAsync(CreateSecuritySettingsRequest, CallSettings) // Additional: CreateSecuritySettingsAsync(CreateSecuritySettingsRequest, CancellationToken) // Create client SecuritySettingsServiceClient securitySettingsServiceClient = await SecuritySettingsServiceClient.CreateAsync(); // Initialize request argument(s) CreateSecuritySettingsRequest request = new CreateSecuritySettingsRequest { ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), SecuritySettings = new SecuritySettings(), }; // Make the request SecuritySettings response = await securitySettingsServiceClient.CreateSecuritySettingsAsync(request); // End snippet }
/// <summary>Snippet for UpdateSecuritySettingsAsync</summary> public async Task UpdateSecuritySettingsRequestObjectAsync() { // Snippet: UpdateSecuritySettingsAsync(UpdateSecuritySettingsRequest, CallSettings) // Additional: UpdateSecuritySettingsAsync(UpdateSecuritySettingsRequest, CancellationToken) // Create client SecuritySettingsServiceClient securitySettingsServiceClient = await SecuritySettingsServiceClient.CreateAsync(); // Initialize request argument(s) UpdateSecuritySettingsRequest request = new UpdateSecuritySettingsRequest { SecuritySettings = new SecuritySettings(), UpdateMask = new FieldMask(), }; // Make the request SecuritySettings response = await securitySettingsServiceClient.UpdateSecuritySettingsAsync(request); // End snippet }