def Create(self, resource, labels=None, description=None, cluster_id=None, node_type=None, node_count=None, network_cidr=None, network=None, network_project=None): parent = resource.Parent().RelativeName() private_cloud_id = resource.Name() private_cloud = self.messages.PrivateCloud(description=description) flags.AddLabelsToMessage(labels, private_cloud) network_config = self.messages.NetworkConfig( managementCidr=network_cidr, network=network, ) if not network.startswith('project'): if not bool(network_project): network_project = resource.Parent().Parent().Name() network_config.network = 'projects/{}/global/networks/{}'.format( network_project, network) management_cluster = self.messages.ManagementCluster( clusterId=cluster_id, nodeCount=node_count, nodeTypeId=node_type) private_cloud.managementCluster = management_cluster private_cloud.networkConfig = network_config request = self.messages.VmwareengineProjectsLocationsPrivateCloudsCreateRequest( parent=parent, privateCloudId=private_cloud_id, privateCloud=private_cloud) return self.service.Create(request)
def Create(self, resource, internal_ip, labels=None): ip_address = self.messages.IpAddress(internalIp=internal_ip) flags.AddLabelsToMessage(labels, ip_address) request = self.messages.SddcProjectsLocationsClusterGroupsIpAddressesCreateRequest( ipAddress=ip_address, ipAddressId=resource.Name(), parent=resource.Parent().RelativeName()) return self.service.Create(request)
def Create(self, resource, node_count, node_type, zone, labels=None): parent = resource.Parent().RelativeName() cluster_id = resource.Name() cluster = self.messages.Cluster(nodeCount=node_count, defaultZone=zone, nodeType=node_type) flags.AddLabelsToMessage(labels, cluster) request = self.messages.SddcProjectsLocationsClusterGroupsClustersCreateRequest( parent=parent, cluster=cluster, clusterId=cluster_id, managementCluster=True) return self.service.Create(request)
def Update(self, resource, labels=None, description=None, external_ip_access=None): cluster_group = self.Get(resource) update_mask = ['labels'] if labels is not None: flags.AddLabelsToMessage(labels, cluster_group) if description is not None: cluster_group.description = description update_mask.append('description') if external_ip_access is not None: cluster_group.networkConfig.externalIpAccess = external_ip_access update_mask.append('network_config.external_ip_access') request = self.messages.SddcProjectsLocationsClusterGroupsPatchRequest( clusterGroup=cluster_group, name=resource.RelativeName(), updateMask=','.join(update_mask)) return self.service.Patch(request)
def Create(self, resource, labels=None, description=None, vpc_network=None, management_ip_range=None, workload_ip_range=None): parent = resource.Parent().RelativeName() cluster_group_id = resource.Name() cluster_group = self.messages.ClusterGroup(description=description) flags.AddLabelsToMessage(labels, cluster_group) network_config = self.messages.NetworkConfig( network=vpc_network, managementCidr=management_ip_range, workloadCidr=workload_ip_range) cluster_group.networkConfig = network_config request = self.messages.SddcProjectsLocationsClusterGroupsCreateRequest( parent=parent, clusterGroup=cluster_group, clusterGroupId=cluster_group_id) return self.service.Create(request)