/// <summary>
        /// Creates an instance group in the specified project using the parameters that are included in the request.
        /// Documentation https://developers.google.com/compute/v1/reference/instanceGroups/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 where you want to create the instance group.</param>
        /// <param name="body">A valid Compute v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Insert(ComputeService service, string project, string zone, InstanceGroup body, InstanceGroupsInsertOptionalParms 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.InstanceGroups.Insert(body, project, zone);

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request InstanceGroups.Insert failed.", ex);
            }
        }
Example #2
0
        /// <summary>
        /// Lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action.
        /// Documentation https://developers.google.com/compute/v1/reference/instanceGroupManagers/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="zone">The name of the zone where the managed instance group is located.</param>
        /// <param name="instanceGroupManager">The name of the managed instance group.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>InstanceGroupManagersListManagedInstancesResponseResponse</returns>
        public static InstanceGroupManagersListManagedInstancesResponse ListManagedInstances(ComputeService service, string project, string zone, string instanceGroupManager, InstanceGroupManagersListManagedInstancesOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (project == null)
                {
                    throw new ArgumentNullException(project);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (instanceGroupManager == null)
                {
                    throw new ArgumentNullException(instanceGroupManager);
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request InstanceGroupManagers.ListManagedInstances failed.", ex);
            }
        }
        /// <summary>
        /// Deletes the specified target VPN gateway.
        /// Documentation https://developers.google.com/compute/v1/reference/targetVpnGateways/delete
        /// 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 for this request.</param>
        /// <param name="targetVpnGateway">Name of the target VPN gateway to delete.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Delete(ComputeService service, string project, string region, string targetVpnGateway, TargetVpnGatewaysDeleteOptionalParms 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 (targetVpnGateway == null)
                {
                    throw new ArgumentNullException(targetVpnGateway);
                }

                // Building the initial request.
                var request = service.TargetVpnGateways.Delete(project, region, targetVpnGateway);

                // Applying optional parameters to the request.
                request = (TargetVpnGatewaysResource.DeleteRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request TargetVpnGateways.Delete failed.", ex);
            }
        }
        /// <summary>
        /// Updates a HttpsHealthCheck resource in the specified project using the data included in the request.
        /// Documentation https://developers.google.com/compute/v1/reference/httpsHealthChecks/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="httpsHealthCheck">Name of the HttpsHealthCheck resource to update.</param>
        /// <param name="body">A valid Compute v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Update(ComputeService service, string project, string httpsHealthCheck, HttpsHealthCheck body, HttpsHealthChecksUpdateOptionalParms 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 (httpsHealthCheck == null)
                {
                    throw new ArgumentNullException(httpsHealthCheck);
                }

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

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

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request HttpsHealthChecks.Update failed.", ex);
            }
        }
Example #5
0
        /// <summary>
        /// Sets the deprecation status of an image.If an empty request body is given, clears the deprecation status instead.
        /// Documentation https://developers.google.com/compute/v1/reference/images/deprecate
        /// 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="image">Image name.</param>
        /// <param name="body">A valid Compute v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Deprecate(ComputeService service, string project, string image, DeprecationStatus body, ImagesDeprecateOptionalParms 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 (image == null)
                {
                    throw new ArgumentNullException(image);
                }

                // Building the initial request.
                var request = service.Images.Deprecate(body, project, image);

                // Applying optional parameters to the request.
                request = (ImagesResource.DeprecateRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Images.Deprecate failed.", ex);
            }
        }
        /// <summary>
        /// Patches the specified UrlMap resource with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.
        /// Documentation https://developers.google.com/compute/v1/reference/urlMaps/patch
        /// 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="urlMap">Name of the UrlMap resource to patch.</param>
        /// <param name="body">A valid Compute v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Patch(ComputeService service, string project, string urlMap, UrlMap body, UrlMapsPatchOptionalParms 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 (urlMap == null)
                {
                    throw new ArgumentNullException(urlMap);
                }

                // Building the initial request.
                var request = service.UrlMaps.Patch(body, project, urlMap);

                // Applying optional parameters to the request.
                request = (UrlMapsResource.PatchRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request UrlMaps.Patch failed.", ex);
            }
        }
Example #7
0
        /// <summary>
        /// Schedules a group action to remove the specified instances from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method.If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted.You can specify a maximum of 1000 instances with this method per request.
        /// Documentation https://developers.google.com/compute/v1/reference/regionInstanceGroupManagers/abandonInstances
        /// 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">Name of the managed instance group.</param>
        /// <param name="body">A valid Compute v1 body.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationResponse</returns>
        public static Operation AbandonInstances(ComputeService service, string project, string region, string instanceGroupManager, RegionInstanceGroupManagersAbandonInstancesRequest body, RegionInstanceGroupManagersAbandonInstancesOptionalParms 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 (instanceGroupManager == null)
                {
                    throw new ArgumentNullException(instanceGroupManager);
                }

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

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

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