/// <summary> /// Creates a HttpsHealthCheck resource in the specified project using the data included in the request. /// Documentation https://developers.google.com/compute/alpha/reference/httpsHealthChecks/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="body">A valid compute alpha body.</param> /// <returns>OperationResponse</returns> public static Operation Insert(computeService service, string project, HttpsHealthCheck 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); } // Make the request. return(service.HttpsHealthChecks.Insert(body, project).Execute()); } catch (Exception ex) { throw new Exception("Request HttpsHealthChecks.Insert failed.", ex); } }
/// <summary> /// Creates a HttpsHealthCheck resource in the specified project using the data included in the request. /// Documentation https://developers.google.com/compute/beta/reference/httpsHealthChecks/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="body">A valid Compute beta body.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>OperationResponse</returns> public static Operation Insert(ComputeService service, string project, HttpsHealthCheck body, HttpsHealthChecksInsertOptionalParms 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); } // Building the initial request. var request = service.HttpsHealthChecks.Insert(body, project); // Applying optional parameters to the request. request = (HttpsHealthChecksResource.InsertRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request HttpsHealthChecks.Insert failed.", ex); } }
protected override void ProcessRecord() { if (Https || HttpsObject != null) { HttpsHealthCheck body = HttpsObject ?? new HttpsHealthCheck { Name = Name, Description = Description, Host = HostHeader, Port = Port, RequestPath = RequestPath, CheckIntervalSec = (int?)CheckInterval?.TotalSeconds, TimeoutSec = (int?)Timeout?.TotalSeconds, HealthyThreshold = HealthyThreshold, UnhealthyThreshold = UnhealthyThreshold }; HttpsHealthChecksResource.InsertRequest request = Service.HttpsHealthChecks.Insert(body, Project); Operation operation = request.Execute(); AddGlobalOperation(Project, operation, () => { WriteObject(Service.HttpsHealthChecks.Get(Project, body.Name).Execute()); }); } else { HttpHealthCheck body = HttpObject ?? new HttpHealthCheck { Name = Name, Description = Description, Host = HostHeader, Port = Port, RequestPath = RequestPath, CheckIntervalSec = (int?)CheckInterval?.TotalSeconds, TimeoutSec = (int?)Timeout?.TotalSeconds, HealthyThreshold = HealthyThreshold, UnhealthyThreshold = UnhealthyThreshold }; HttpHealthChecksResource.InsertRequest request = Service.HttpHealthChecks.Insert(body, Project); Operation operation = request.Execute(); AddGlobalOperation(Project, operation, () => { WriteObject(Service.HttpHealthChecks.Get(Project, body.Name).Execute()); }); } }