Esempio n. 1
0
 /// <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
 }
Esempio n. 2
0
 /// <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
 }
Esempio n. 4
0
 /// <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 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
 }
Esempio n. 6
0
 /// <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
 }
Esempio n. 7
0
 /// <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
 }
Esempio n. 8
0
 /// <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 DeleteAutoscalingPolicyAsync</summary>
        public async Task DeleteAutoscalingPolicyAsync()
        {
            // Snippet: DeleteAutoscalingPolicyAsync(string,CallSettings)
            // Additional: DeleteAutoscalingPolicyAsync(string,CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            string formattedName = new AutoscalingPolicyName("[PROJECT]", "[REGION]", "[AUTOSCALING_POLICY]").ToString();
            // Make the request
            await autoscalingPolicyServiceClient.DeleteAutoscalingPolicyAsync(formattedName);

            // 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
 }
Esempio n. 11
0
        /// <summary>Snippet for UpdateAutoscalingPolicyAsync</summary>
        public async Task UpdateAutoscalingPolicyAsync()
        {
            // Snippet: UpdateAutoscalingPolicyAsync(AutoscalingPolicy, CallSettings)
            // Additional: UpdateAutoscalingPolicyAsync(AutoscalingPolicy, CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            AutoscalingPolicy policy = new AutoscalingPolicy();
            // Make the request
            AutoscalingPolicy response = await autoscalingPolicyServiceClient.UpdateAutoscalingPolicyAsync(policy);

            // End snippet
        }
Esempio n. 12
0
 /// <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
 }
Esempio n. 13
0
        /// <summary>Snippet for DeleteAutoscalingPolicyAsync</summary>
        public async Task DeleteAutoscalingPolicyResourceNamesAsync()
        {
            // Snippet: DeleteAutoscalingPolicyAsync(AutoscalingPolicyName, CallSettings)
            // Additional: DeleteAutoscalingPolicyAsync(AutoscalingPolicyName, CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            AutoscalingPolicyName name = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]");
            // Make the request
            await autoscalingPolicyServiceClient.DeleteAutoscalingPolicyAsync(name);

            // End snippet
        }
Esempio n. 14
0
        /// <summary>Snippet for DeleteAutoscalingPolicyAsync</summary>
        public async Task DeleteAutoscalingPolicyAsync()
        {
            // Snippet: DeleteAutoscalingPolicyAsync(string, CallSettings)
            // Additional: DeleteAutoscalingPolicyAsync(string, CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            string name = "projects/[PROJECT]/locations/[LOCATION]/autoscalingPolicies/[AUTOSCALING_POLICY]";
            // Make the request
            await autoscalingPolicyServiceClient.DeleteAutoscalingPolicyAsync(name);

            // End snippet
        }
Esempio n. 15
0
        /// <summary>Snippet for CreateAutoscalingPolicyAsync</summary>
        public async Task CreateAutoscalingPolicyAsync()
        {
            // Snippet: CreateAutoscalingPolicyAsync(string, AutoscalingPolicy, CallSettings)
            // Additional: CreateAutoscalingPolicyAsync(string, AutoscalingPolicy, CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            string            parent = "projects/[PROJECT]/locations/[LOCATION]";
            AutoscalingPolicy policy = new AutoscalingPolicy();
            // Make the request
            AutoscalingPolicy response = await autoscalingPolicyServiceClient.CreateAutoscalingPolicyAsync(parent, policy);

            // End snippet
        }
        /// <summary>Snippet for CreateAutoscalingPolicyAsync</summary>
        public async Task CreateAutoscalingPolicyAsync()
        {
            // Snippet: CreateAutoscalingPolicyAsync(string,AutoscalingPolicy,CallSettings)
            // Additional: CreateAutoscalingPolicyAsync(string,AutoscalingPolicy,CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            string            formattedParent = new RegionName("[PROJECT]", "[REGION]").ToString();
            AutoscalingPolicy policy          = new AutoscalingPolicy();
            // Make the request
            AutoscalingPolicy response = await autoscalingPolicyServiceClient.CreateAutoscalingPolicyAsync(formattedParent, policy);

            // End snippet
        }
Esempio n. 17
0
 /// <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
 }
Esempio n. 19
0
        /// <summary>Snippet for CreateAutoscalingPolicyAsync</summary>
        public async Task CreateAutoscalingPolicyResourceNames2Async()
        {
            // Snippet: CreateAutoscalingPolicyAsync(RegionName, AutoscalingPolicy, CallSettings)
            // Additional: CreateAutoscalingPolicyAsync(RegionName, AutoscalingPolicy, CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            RegionName        parent = RegionName.FromProjectRegion("[PROJECT]", "[REGION]");
            AutoscalingPolicy policy = new AutoscalingPolicy();
            // Make the request
            AutoscalingPolicy response = await autoscalingPolicyServiceClient.CreateAutoscalingPolicyAsync(parent, policy);

            // End snippet
        }
Esempio n. 20
0
        /// <summary>Snippet for ListAutoscalingPolicies</summary>
        public async Task ListAutoscalingPoliciesRequestObjectAsync()
        {
            // Snippet: ListAutoscalingPoliciesAsync(ListAutoscalingPoliciesRequest, CallSettings)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            ListAutoscalingPoliciesRequest request = new ListAutoscalingPoliciesRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
            };
            // Make the request
            PagedAsyncEnumerable <ListAutoscalingPoliciesResponse, AutoscalingPolicy> response = autoscalingPolicyServiceClient.ListAutoscalingPoliciesAsync(request);

            // Iterate over all response items, lazily performing RPCs as required
            await response.ForEachAsync((AutoscalingPolicy 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((ListAutoscalingPoliciesResponse page) =>
            {
                // 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 = 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 (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
        }
        /// <summary>Snippet for UpdateAutoscalingPolicyAsync</summary>
        public async Task UpdateAutoscalingPolicyAsync_RequestObject()
        {
            // Snippet: UpdateAutoscalingPolicyAsync(UpdateAutoscalingPolicyRequest,CallSettings)
            // Additional: UpdateAutoscalingPolicyAsync(UpdateAutoscalingPolicyRequest,CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            UpdateAutoscalingPolicyRequest request = new UpdateAutoscalingPolicyRequest
            {
                Policy = new AutoscalingPolicy(),
            };
            // Make the request
            AutoscalingPolicy response = await autoscalingPolicyServiceClient.UpdateAutoscalingPolicyAsync(request);

            // End snippet
        }
        /// <summary>Snippet for ListAutoscalingPolicies</summary>
        public void ListAutoscalingPolicies_RequestObject()
        {
            // Snippet: ListAutoscalingPolicies(ListAutoscalingPoliciesRequest,CallSettings)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = AutoscalingPolicyServiceClient.Create();
            // Initialize request argument(s)
            ListAutoscalingPoliciesRequest request = new ListAutoscalingPoliciesRequest
            {
                Parent = new RegionName("[PROJECT]", "[REGION]").ToString(),
            };
            // 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)
                {
                    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)
            {
                Console.WriteLine(item);
            }
            // Store the pageToken, for when the next page is required.
            string nextPageToken = singlePage.NextPageToken;
            // End snippet
        }
Esempio n. 23
0
        /// <summary>Snippet for GetAutoscalingPolicyAsync</summary>
        public async Task GetAutoscalingPolicyRequestObjectAsync()
        {
            // Snippet: GetAutoscalingPolicyAsync(GetAutoscalingPolicyRequest, CallSettings)
            // Additional: GetAutoscalingPolicyAsync(GetAutoscalingPolicyRequest, CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetAutoscalingPolicyRequest request = new GetAutoscalingPolicyRequest
            {
                AutoscalingPolicyName = AutoscalingPolicyName.FromProjectLocationAutoscalingPolicy("[PROJECT]", "[LOCATION]", "[AUTOSCALING_POLICY]"),
            };
            // Make the request
            AutoscalingPolicy response = await autoscalingPolicyServiceClient.GetAutoscalingPolicyAsync(request);

            // End snippet
        }
Esempio n. 24
0
        /// <summary>Snippet for CreateAutoscalingPolicyAsync</summary>
        public async Task CreateAutoscalingPolicyRequestObjectAsync()
        {
            // Snippet: CreateAutoscalingPolicyAsync(CreateAutoscalingPolicyRequest, CallSettings)
            // Additional: CreateAutoscalingPolicyAsync(CreateAutoscalingPolicyRequest, CancellationToken)
            // Create client
            AutoscalingPolicyServiceClient autoscalingPolicyServiceClient = await AutoscalingPolicyServiceClient.CreateAsync();

            // Initialize request argument(s)
            CreateAutoscalingPolicyRequest request = new CreateAutoscalingPolicyRequest
            {
                ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
                Policy = new AutoscalingPolicy(),
            };
            // Make the request
            AutoscalingPolicy response = await autoscalingPolicyServiceClient.CreateAutoscalingPolicyAsync(request);

            // End snippet
        }