/// <summary>Snippet for GetAutoscalingPolicy</summary> public void GetAutoscalingPolicyResourceNames() { // Snippet: GetAutoscalingPolicy(AutoscalingPolicyName, CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) AutoscalingPolicyName name = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"); // Make the request AutoscalingPolicy response = autoscalingPolicyServiceClient.GetAutoscalingPolicy(name); // End snippet }
/// <summary>Snippet for GetAutoscalingPolicy</summary> public void GetAutoscalingPolicy() { // Snippet: GetAutoscalingPolicy(string, CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) string name = "projects/[PROJECT]/locations/[LOCATION]/autoscalingPolicies/[AUTOSCALING_POLICY]"; // Make the request AutoscalingPolicy response = autoscalingPolicyServiceClient.GetAutoscalingPolicy(name); // End snippet }
/// <summary>Snippet for UpdateAutoscalingPolicy</summary> public void UpdateAutoscalingPolicy() { // Snippet: UpdateAutoscalingPolicy(AutoscalingPolicy, CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) AutoscalingPolicy policy = new AutoscalingPolicy(); // Make the request AutoscalingPolicy response = autoscalingPolicyServiceClient.UpdateAutoscalingPolicy(policy); // End snippet }
/// <summary>Snippet for GetAutoscalingPolicy</summary> public void GetAutoscalingPolicy() { // Snippet: GetAutoscalingPolicy(string,CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) string formattedName = new AutoscalingPolicyName("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]").ToString(); // Make the request AutoscalingPolicy response = autoscalingPolicyServiceClient.GetAutoscalingPolicy(formattedName); // End snippet }
/// <summary>Snippet for CreateAutoscalingPolicy</summary> public void CreateAutoscalingPolicyResourceNames1() { // Snippet: CreateAutoscalingPolicy(LocationName, AutoscalingPolicy, CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"); AutoscalingPolicy policy = new AutoscalingPolicy(); // Make the request AutoscalingPolicy response = autoscalingPolicyServiceClient.CreateAutoscalingPolicy(parent, policy); // End snippet }
/// <summary>Snippet for CreateAutoscalingPolicy</summary> public void CreateAutoscalingPolicy() { // Snippet: CreateAutoscalingPolicy(string, AutoscalingPolicy, CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) string parent = "projects/[PROJECT]/locations/[LOCATION]"; AutoscalingPolicy policy = new AutoscalingPolicy(); // Make the request AutoscalingPolicy response = autoscalingPolicyServiceClient.CreateAutoscalingPolicy(parent, policy); // End snippet }
/// <summary>Snippet for CreateAutoscalingPolicy</summary> public void CreateAutoscalingPolicy() { // Snippet: CreateAutoscalingPolicy(string,AutoscalingPolicy,CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) string formattedParent = new RegionName("[PROJECT]", "[REGION]").ToString(); AutoscalingPolicy policy = new AutoscalingPolicy(); // Make the request AutoscalingPolicy response = autoscalingPolicyServiceClient.CreateAutoscalingPolicy(formattedParent, policy); // End snippet }
/// <summary>Snippet for GetAutoscalingPolicy</summary> public void GetAutoscalingPolicyRequestObject() { // Snippet: GetAutoscalingPolicy(GetAutoscalingPolicyRequest, CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) GetAutoscalingPolicyRequest request = new GetAutoscalingPolicyRequest { AutoscalingPolicyName = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"), }; // Make the request AutoscalingPolicy response = autoscalingPolicyServiceClient.GetAutoscalingPolicy(request); // End snippet }
/// <summary>Snippet for UpdateAutoscalingPolicy</summary> public void UpdateAutoscalingPolicyRequestObject() { // Snippet: UpdateAutoscalingPolicy(UpdateAutoscalingPolicyRequest, CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest { Policy = new AutoscalingPolicy(), }; // Make the request AutoscalingPolicy response = autoscalingPolicyServiceClient.UpdateAutoscalingPolicy(request); // End snippet }
/// <summary>Snippet for GetAutoscalingPolicy</summary> public void GetAutoscalingPolicy_RequestObject() { // Snippet: GetAutoscalingPolicy(GetAutoscalingPolicyRequest,CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) GetAutoscalingPolicyRequest request = new GetAutoscalingPolicyRequest { Name = new AutoscalingPolicyName("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]").ToString(), }; // Make the request AutoscalingPolicy response = autoscalingPolicyServiceClient.GetAutoscalingPolicy(request); // End snippet }
/// <summary>Snippet for CreateAutoscalingPolicy</summary> public void CreateAutoscalingPolicyRequestObject() { // Snippet: CreateAutoscalingPolicy(CreateAutoscalingPolicyRequest, CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) CreateAutoscalingPolicyRequest request = new CreateAutoscalingPolicyRequest { ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), Policy = new AutoscalingPolicy(), }; // Make the request AutoscalingPolicy response = autoscalingPolicyServiceClient.CreateAutoscalingPolicy(request); // End snippet }
/// <summary>Snippet for CreateAutoscalingPolicy</summary> public void CreateAutoscalingPolicy_RequestObject() { // Snippet: CreateAutoscalingPolicy(CreateAutoscalingPolicyRequest,CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) CreateAutoscalingPolicyRequest request = new CreateAutoscalingPolicyRequest { Parent = new RegionName("[PROJECT]", "[REGION]").ToString(), Policy = new AutoscalingPolicy(), }; // Make the request AutoscalingPolicy response = autoscalingPolicyServiceClient.CreateAutoscalingPolicy(request); // End snippet }
/// <summary>Snippet for ListAutoscalingPolicies</summary> public void ListAutoscalingPoliciesRequestObject() { // Snippet: ListAutoscalingPolicies(ListAutoscalingPoliciesRequest, CallSettings) // Create client AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create(); // Initialize request argument(s) ListAutoscalingPoliciesRequest request = new ListAutoscalingPoliciesRequest { ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"), }; // Make the request PagedEnumerable <ListAutoscalingPoliciesResponse, AutoscalingPolicy> response = autoscalingPolicyServiceClient.ListAutoscalingPolicies(request); // Iterate over all response items, lazily performing RPCs as required foreach (AutoscalingPolicy item in response) { // Do something with each item Console.WriteLine(item); } // Or iterate over pages (of server-defined size), performing one RPC per page foreach (ListAutoscalingPoliciesResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (AutoscalingPolicy 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 <AutoscalingPolicy> singlePage = response.ReadPage(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (AutoscalingPolicy 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 }