예제 #1
0
        /// <summary>
        /// Restarts a replica in a pool.
        /// Documentation https://developers.google.com/replicapool/v1beta1/reference/replicas/restart
        /// 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 Replicapool service.</param>
        /// <param name="projectName">The project ID for this request.</param>
        /// <param name="zone">The zone where the replica lives.</param>
        /// <param name="poolName">The replica pool name for this request.</param>
        /// <param name="replicaName">The name of the replica for this request.</param>
        /// <returns>ReplicaResponse</returns>
        public static Replica Restart(ReplicapoolService service, string projectName, string zone, string poolName, string replicaName)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (projectName == null)
                {
                    throw new ArgumentNullException(projectName);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (poolName == null)
                {
                    throw new ArgumentNullException(poolName);
                }
                if (replicaName == null)
                {
                    throw new ArgumentNullException(replicaName);
                }

                // Make the request.
                return(service.Replicas.Restart(projectName, zone, poolName, replicaName).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Replicas.Restart failed.", ex);
            }
        }
예제 #2
0
        /// <summary>
        /// Retrieves the list of operation resources contained within the specified zone.
        /// Documentation https://developers.google.com/replicapool/v1beta2/reference/zoneOperations/list
        /// 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 Replicapool service.</param>
        /// <param name="project">Name of the project scoping this request.</param>
        /// <param name="zone">Name of the zone scoping this request.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>OperationListResponse</returns>
        public static OperationList List(ReplicapoolService service, string project, string zone, ZoneOperationsListOptionalParms 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);
                }

                // Building the initial request.
                var request = service.ZoneOperations.List(project, zone);

                // Applying optional parameters to the request.
                request = (ZoneOperationsResource.ListRequest)SampleHelpers.ApplyOptionalParms(request, optional);

                // Requesting data.
                return(request.Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request ZoneOperations.List failed.", ex);
            }
        }
예제 #3
0
        /// <summary>
        /// Retrieves the specified zone-specific operation resource.
        /// Documentation https://developers.google.com/replicapool/v1beta2/reference/zoneOperations/get
        /// 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 Replicapool service.</param>
        /// <param name="project">Name of the project scoping this request.</param>
        /// <param name="zone">Name of the zone scoping this request.</param>
        /// <param name="operation">Name of the operation resource to return.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Get(ReplicapoolService service, string project, string zone, string operation)
        {
            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 (operation == null)
                {
                    throw new ArgumentNullException(operation);
                }

                // Make the request.
                return(service.ZoneOperations.Get(project, zone, operation).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request ZoneOperations.Get failed.", ex);
            }
        }
        /// <summary>
        /// Removes the specified instances from the managed instance group, and from any target pools of which they were members, without deleting the instances.
        /// Documentation https://developers.google.com/replicapool/v1beta2/reference/instanceGroupManagers/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 Replicapool service.</param>
        /// <param name="project">The Google Developers Console project name.</param>
        /// <param name="zone">The name of the zone in which the instance group manager resides.</param>
        /// <param name="instanceGroupManager">The name of the instance group manager.</param>
        /// <param name="body">A valid Replicapool v1beta2 body.</param>
        /// <returns>OperationResponse</returns>
        public static Operation AbandonInstances(ReplicapoolService service, string project, string zone, string instanceGroupManager, InstanceGroupManagersAbandonInstancesRequest 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 (instanceGroupManager == null)
                {
                    throw new ArgumentNullException(instanceGroupManager);
                }

                // Make the request.
                return(service.InstanceGroupManagers.AbandonInstances(body, project, zone, instanceGroupManager).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request InstanceGroupManagers.AbandonInstances failed.", ex);
            }
        }
        /// <summary>
        /// Resizes the managed instance group up or down. If resized up, new instances are created using the current instance template. If resized down, instances are removed in the order outlined in Resizing a managed instance group.
        /// Documentation https://developers.google.com/replicapool/v1beta2/reference/instanceGroupManagers/resize
        /// 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 Replicapool service.</param>
        /// <param name="project">The Google Developers Console project name.</param>
        /// <param name="zone">The name of the zone in which the instance group manager resides.</param>
        /// <param name="instanceGroupManager">The name of the instance group manager.</param>
        /// <param name="size">Number of instances that should exist in this Instance Group Manager.</param>
        /// <returns>OperationResponse</returns>
        public static Operation Resize(ReplicapoolService service, string project, string zone, string instanceGroupManager, int?size)
        {
            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);
                }
                if (size == null)
                {
                    throw new ArgumentNullException(size);
                }

                // Make the request.
                return(service.InstanceGroupManagers.Resize(project, zone, instanceGroupManager, size).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request InstanceGroupManagers.Resize failed.", ex);
            }
        }
예제 #6
0
        /// <summary>
        /// Deletes a replica pool.
        /// Documentation https://developers.google.com/replicapool/v1beta1/reference/pools/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 Replicapool service.</param>
        /// <param name="projectName">The project ID for this replica pool.</param>
        /// <param name="zone">The zone for this replica pool.</param>
        /// <param name="poolName">The name of the replica pool for this request.</param>
        /// <param name="body">A valid Replicapool v1beta1 body.</param>
        public static void Delete(ReplicapoolService service, string projectName, string zone, string poolName, PoolsDeleteRequest body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (projectName == null)
                {
                    throw new ArgumentNullException(projectName);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (poolName == null)
                {
                    throw new ArgumentNullException(poolName);
                }

                // Make the request.
                service.Pools.Delete(body, projectName, zone, poolName).Execute();
            }
            catch (Exception ex)
            {
                throw new Exception("Request Pools.Delete failed.", ex);
            }
        }
예제 #7
0
        /// <summary>
        /// Inserts a new replica pool.
        /// Documentation https://developers.google.com/replicapool/v1beta1/reference/pools/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 Replicapool service.</param>
        /// <param name="projectName">The project ID for this replica pool.</param>
        /// <param name="zone">The zone for this replica pool.</param>
        /// <param name="body">A valid Replicapool v1beta1 body.</param>
        /// <returns>PoolResponse</returns>
        public static Pool Insert(ReplicapoolService service, string projectName, string zone, Pool body)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (body == null)
                {
                    throw new ArgumentNullException("body");
                }
                if (projectName == null)
                {
                    throw new ArgumentNullException(projectName);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }

                // Make the request.
                return(service.Pools.Insert(body, projectName, zone).Execute());
            }
            catch (Exception ex)
            {
                throw new Exception("Request Pools.Insert failed.", ex);
            }
        }
예제 #8
0
        /// <summary>
        /// Resize a pool. This is an asynchronous operation, and multiple overlapping resize requests can be made. Replica Pools will use the information from the last resize request.
        /// Documentation https://developers.google.com/replicapool/v1beta1/reference/pools/resize
        /// 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 Replicapool service.</param>
        /// <param name="projectName">The project ID for this replica pool.</param>
        /// <param name="zone">The zone for this replica pool.</param>
        /// <param name="poolName">The name of the replica pool for this request.</param>
        /// <param name="optional">Optional paramaters.</param>
        /// <returns>PoolResponse</returns>
        public static Pool Resize(ReplicapoolService service, string projectName, string zone, string poolName, PoolsResizeOptionalParms optional = null)
        {
            try
            {
                // Initial validation.
                if (service == null)
                {
                    throw new ArgumentNullException("service");
                }
                if (projectName == null)
                {
                    throw new ArgumentNullException(projectName);
                }
                if (zone == null)
                {
                    throw new ArgumentNullException(zone);
                }
                if (poolName == null)
                {
                    throw new ArgumentNullException(poolName);
                }

                // Building the initial request.
                var request = service.Pools.Resize(projectName, zone, poolName);

                // Applying optional parameters to the request.
                request = (PoolsResource.ResizeRequest)SampleHelpers.ApplyOptionalParms(request, optional);

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