Exemple #1
0
 /// <summary>Snippet for SetLabels</summary>
 public void SetLabels()
 {
     // Snippet: SetLabels(string, string, string, ZoneSetLabelsRequest, CallSettings)
     // Create client
     DisksClient disksClient = DisksClient.Create();
     // Initialize request argument(s)
     string project  = "";
     string zone     = "";
     string resource = "";
     ZoneSetLabelsRequest zoneSetLabelsRequestResource = new ZoneSetLabelsRequest();
     // Make the request
     Operation response = disksClient.SetLabels(project, zone, resource, zoneSetLabelsRequestResource);
     // End snippet
 }
Exemple #2
0
        /// <summary>Snippet for SetLabelsAsync</summary>
        public async Task SetLabelsAsync()
        {
            // Snippet: SetLabelsAsync(string, string, string, ZoneSetLabelsRequest, CallSettings)
            // Additional: SetLabelsAsync(string, string, string, ZoneSetLabelsRequest, CancellationToken)
            // Create client
            DisksClient disksClient = await DisksClient.CreateAsync();

            // Initialize request argument(s)
            string project  = "";
            string zone     = "";
            string resource = "";
            ZoneSetLabelsRequest zoneSetLabelsRequestResource = new ZoneSetLabelsRequest();
            // Make the request
            Operation response = await disksClient.SetLabelsAsync(project, zone, resource, zoneSetLabelsRequestResource);

            // End snippet
        }
        /// <summary>
        /// Sets the labels on a disk. To learn more about labels, read the Labeling or Tagging Resources documentation.
        /// Documentation https://developers.google.com/compute/alpha/reference/disks/setLabels
        /// 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="resource">Name of the resource for this request.</param>
        /// <param name="body">A valid compute alpha body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation SetLabels(computeService service, string project, string zone, string resource, ZoneSetLabelsRequest body)
        {
            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 (resource == null)
                {
                    throw new ArgumentNullException(resource);
                }

                // Make the request.
                return(service.Disks.SetLabels(body, project, zone, resource).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Disks.SetLabels failed.", ex);
            }
        }
Exemple #4
0
        /// <summary>
        /// Sets the labels on a disk. To learn more about labels, read the Labeling Resources documentation.
        /// Documentation https://developers.google.com/compute/beta/reference/disks/setLabels
        /// 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="resource">Name of the resource 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 SetLabels(ComputeService service, string project, string zone, string resource, ZoneSetLabelsRequest body, DisksSetLabelsOptionalParms 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 (resource == null)
                {
                    throw new ArgumentNullException(resource);
                }

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

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

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