コード例 #1
0
        /// <summary>
        /// Creates a persistent disk in the specified project using the data in the request. You can create a disk with a sourceImage, a sourceSnapshot, or create an empty 500 GB data disk by omitting all properties. You can also create a disk that is larger than the default size by specifying the sizeGb property.
        /// Documentation https://developers.google.com/compute/beta/reference/disks/insert
        /// 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="body">A valid compute beta body.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>OperationResponse</returns>
        public static Operation Insert(computeService service, string project, string zone, Disk body, DisksInsertOptionalParms 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);
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Disks.Insert failed.", ex);
            }
        }
        /// <summary>
        /// Lists the instances in the managed instance group and instances that are scheduled to be created. The list includes any current actions that the group has scheduled for its instances.
        /// Documentation https://developers.google.com/compute/beta/reference/regionInstanceGroupManagers/listManagedInstances
        /// 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="instanceGroupManager">The name of the managed instance group.</param>
        /// <param name="optional">Optional paramaters.</param>        /// <returns>RegionInstanceGroupManagersListInstancesResponseResponse</returns>
        public static RegionInstanceGroupManagersListInstancesResponse ListManagedInstances(computeService service, string project, string region, string instanceGroupManager, RegionInstanceGroupManagersListManagedInstancesOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (region == null)
                {
                    throw new ArgumentNullException(region);
                }
                if (instanceGroupManager == null)
                {
                    throw new ArgumentNullException(instanceGroupManager);
                }

                // Building the initial request.
                var request = service.RegionInstanceGroupManagers.ListManagedInstances(project, region, instanceGroupManager);

                // Applying optional parameters to the request.
                request = (RegionInstanceGroupManagersResource.ListManagedInstancesRequest)SampleHelpers.ApplyOptionalParms(request, optional);

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