/// <summary>
        /// Changes a backup target pool's configurations.
        /// Documentation https://developers.google.com/compute/beta/reference/targetPools/setBackup
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated compute service.</param>
        /// <param name="project">Project ID for this request.</param>
        /// <param name="region">Name of the region scoping this request.</param>
        /// <param name="targetPool">Name of the TargetPool resource to set a backup pool for.</param>
        /// <param name="body">A valid compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>OperationResponse</returns>
        public static Operation SetBackup(computeService service, string project, string region, string targetPool, TargetReference body, TargetPoolsSetBackupOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (targetPool == null)
                {
                    throw new ArgumentNullException(targetPool);
                }

                // Building the initial request.
                var request = service.TargetPools.SetBackup(body, project, region, targetPool);

                // Applying optional parameters to the request.
                request = (TargetPoolsResource.SetBackupRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TargetPools.SetBackup failed.", ex);
            }
        }
        /// <summary>
        /// Lists the instances in the specified instance group and displays information about the named ports. Depending on the specified options, this method can list all instances or only the instances that are running.
        /// Documentation https://developers.google.com/compute/beta/reference/regionInstanceGroups/listInstances
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated compute service.</param>
        /// <param name="project">Project ID for this request.</param>
        /// <param name="region">Name of the region scoping this request.</param>
        /// <param name="instanceGroup">Name of the regional instance group for which we want to list the instances.</param>
        /// <param name="body">A valid compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>RegionInstanceGroupsListInstancesResponse</returns>
        public static RegionInstanceGroupsListInstances ListInstances(computeService service, string project, string region, string instanceGroup, RegionInstanceGroupsListInstancesRequest body, RegionInstanceGroupsListInstancesOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (instanceGroup == null)
                {
                    throw new ArgumentNullException(instanceGroup);
                }

                // Building the initial request.
                var request = service.RegionInstanceGroups.ListInstances(body, project, region, instanceGroup);

                // Applying optional parameters to the request.
                request = (RegionInstanceGroupsResource.ListInstancesRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request RegionInstanceGroups.ListInstances failed.", ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a snapshot of a specified persistent disk.
        /// Documentation https://developers.google.com/compute/beta/reference/disks/createSnapshot
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated compute service.</param>
        /// <param name="project">Project ID for this request.</param>
        /// <param name="zone">The name of the zone for this request.</param>
        /// <param name="disk">Name of the persistent disk to snapshot.</param>
        /// <param name="body">A valid compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>OperationResponse</returns>
        public static Operation CreateSnapshot(computeService service, string project, string zone, string disk, Snapshot body, DisksCreateSnapshotOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (disk == null)
                {
                    throw new ArgumentNullException(disk);
                }

                // Building the initial request.
                var request = service.Disks.CreateSnapshot(body, project, zone, disk);

                // Applying optional parameters to the request.
                request = (DisksResource.CreateSnapshotRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Disks.CreateSnapshot failed.", ex);
            }
        }
        /// <summary>
        /// Updates an autoscaler in the specified project using the data included in the request.
        /// Documentation https://developers.google.com/compute/beta/reference/regionAutoscalers/update
        /// Generation Note: This does not always build corectly.  Google needs to standardise things I need to figuer out which ones are wrong.
        /// </summary>
        /// <param name="service">Authenticated compute service.</param>
        /// <param name="project">Project ID for this request.</param>
        /// <param name="region">Name of the region scoping this request.</param>
        /// <param name="body">A valid compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>OperationResponse</returns>
        public static Operation Update(computeService service, string project, string region, Autoscaler body, RegionAutoscalersUpdateOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (region == null)
                {
                    throw new ArgumentNullException(region);
                }

                // Building the initial request.
                var request = service.RegionAutoscalers.Update(body, project, region);

                // Applying optional parameters to the request.
                request = (RegionAutoscalersResource.UpdateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request RegionAutoscalers.Update failed.", ex);
            }
        }