示例#1
0
        /// <summary>
        /// Wait for the NodePool creation operation to complete.
        /// Use write progress to display the progress in the meantime.
        /// </summary>
        private NodePool WaitForNodePoolCreation(Operation operation)
        {
            string activity = $"Creating NodePool '{NodePool.Name}' in cluster '{ClusterName}'" +
                              $" in zone '{Zone}' of project '{Project}'.";
            string status = "Creating NodePool";

            WaitForClusterOperation(operation, Project, Zone, activity, status);

            // Returns the NodePool after it is created.
            ProjectsResource.ZonesResource.ClustersResource.NodePoolsResource.GetRequest getRequest =
                Service.Projects.Zones.Clusters.NodePools.Get(Project, Zone, ClusterName, NodePool.Name);
            return(getRequest.Execute());
        }
示例#2
0
        /// <summary>
        /// Returns node pools that have the names in nodePoolNames array in cluster 'clusterName'
        /// of zone 'zone' in project 'project'.
        /// </summary>
        private IEnumerable <NodePool> GetNodePoolsByName(string project, string zone,
                                                          string clusterName, string[] nodePoolNames)
        {
            foreach (string poolName in NodePoolName)
            {
                NodePool result = null;
                try
                {
                    ProjectsResource.ZonesResource.ClustersResource.NodePoolsResource.GetRequest getRequest =
                        Service.Projects.Zones.Clusters.NodePools.Get(Project, Zone, ClusterName, poolName);
                    result = getRequest.Execute();
                }
                catch (GoogleApiException apiEx) when(apiEx.HttpStatusCode == HttpStatusCode.NotFound)
                {
                    WriteResourceMissingError(
                        exceptionMessage: $"Nodepool '{poolName}' cannot be found in cluster '{clusterName}'"
                        + $" in zone '{zone}' of project '{Project}'.",
                        errorId: "NodePoolNotFound",
                        targetObject: poolName);
                }

                if (result != null)
                {
                    yield return(result);
                }
            }
        }