Skip to content

Commit

Permalink
Automated DCL import.
Browse files Browse the repository at this point in the history
  - b4ff0f731422d115408a59c575c2adb74d38c061 Automatic import from cloud_mmv2_dcl_20230117_1446_RC00 by DCL Team <[email protected]>

GitOrigin-RevId: b4ff0f731422d115408a59c575c2adb74d38c061
  • Loading branch information
DCL Team authored and copybara-github committed Jan 17, 2023
1 parent 2ec0ebd commit 873af49
Show file tree
Hide file tree
Showing 279 changed files with 41,592 additions and 32,296 deletions.
12 changes: 3 additions & 9 deletions python/proto/vmware/alpha/cluster.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,9 @@ message VmwareAlphaCluster {
VmwareAlphaClusterStateEnum state = 4;
bool management = 5;
string uid = 6;
map<string, VmwareAlphaClusterNodeTypeConfigs> node_type_configs = 7;
string project = 8;
string location = 9;
string private_cloud = 10;
}

message VmwareAlphaClusterNodeTypeConfigs {
int64 node_count = 1;
int64 custom_core_count = 2;
string project = 7;
string location = 8;
string private_cloud = 9;
}

message ApplyVmwareAlphaClusterRequest {
Expand Down
6 changes: 0 additions & 6 deletions python/proto/vmware/alpha/private_cloud.proto
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ message VmwareAlphaPrivateCloudNetworkConfig {

message VmwareAlphaPrivateCloudManagementCluster {
string cluster_id = 1;
map<string, VmwareAlphaPrivateCloudManagementClusterNodeTypeConfigs> node_type_configs = 2;
}

message VmwareAlphaPrivateCloudManagementClusterNodeTypeConfigs {
int64 node_count = 1;
int64 custom_core_count = 2;
}

message VmwareAlphaPrivateCloudHcx {
Expand Down
55 changes: 0 additions & 55 deletions python/services/vmware/alpha/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ def __init__(
state: str = None,
management: bool = None,
uid: str = None,
node_type_configs: dict = None,
project: str = None,
location: str = None,
private_cloud: str = None,
Expand All @@ -36,7 +35,6 @@ def __init__(

channel.initialize()
self.name = name
self.node_type_configs = node_type_configs
self.project = project
self.location = location
self.private_cloud = private_cloud
Expand All @@ -48,11 +46,6 @@ def apply(self):
if Primitive.to_proto(self.name):
request.resource.name = Primitive.to_proto(self.name)

if Primitive.to_proto(self.node_type_configs):
request.resource.node_type_configs = Primitive.to_proto(
self.node_type_configs
)

if Primitive.to_proto(self.project):
request.resource.project = Primitive.to_proto(self.project)

Expand All @@ -71,7 +64,6 @@ def apply(self):
self.state = ClusterStateEnum.from_proto(response.state)
self.management = Primitive.from_proto(response.management)
self.uid = Primitive.from_proto(response.uid)
self.node_type_configs = Primitive.from_proto(response.node_type_configs)
self.project = Primitive.from_proto(response.project)
self.location = Primitive.from_proto(response.location)
self.private_cloud = Primitive.from_proto(response.private_cloud)
Expand All @@ -83,11 +75,6 @@ def delete(self):
if Primitive.to_proto(self.name):
request.resource.name = Primitive.to_proto(self.name)

if Primitive.to_proto(self.node_type_configs):
request.resource.node_type_configs = Primitive.to_proto(
self.node_type_configs
)

if Primitive.to_proto(self.project):
request.resource.project = Primitive.to_proto(self.project)

Expand Down Expand Up @@ -116,8 +103,6 @@ def to_proto(self):
resource = cluster_pb2.VmwareAlphaCluster()
if Primitive.to_proto(self.name):
resource.name = Primitive.to_proto(self.name)
if Primitive.to_proto(self.node_type_configs):
resource.node_type_configs = Primitive.to_proto(self.node_type_configs)
if Primitive.to_proto(self.project):
resource.project = Primitive.to_proto(self.project)
if Primitive.to_proto(self.location):
Expand All @@ -127,46 +112,6 @@ def to_proto(self):
return resource


class ClusterNodeTypeConfigs(object):
def __init__(self, node_count: int = None, custom_core_count: int = None):
self.node_count = node_count
self.custom_core_count = custom_core_count

@classmethod
def to_proto(self, resource):
if not resource:
return None

res = cluster_pb2.VmwareAlphaClusterNodeTypeConfigs()
if Primitive.to_proto(resource.node_count):
res.node_count = Primitive.to_proto(resource.node_count)
if Primitive.to_proto(resource.custom_core_count):
res.custom_core_count = Primitive.to_proto(resource.custom_core_count)
return res

@classmethod
def from_proto(self, resource):
if not resource:
return None

return ClusterNodeTypeConfigs(
node_count=Primitive.from_proto(resource.node_count),
custom_core_count=Primitive.from_proto(resource.custom_core_count),
)


class ClusterNodeTypeConfigsArray(object):
@classmethod
def to_proto(self, resources):
if not resources:
return resources
return [ClusterNodeTypeConfigs.to_proto(i) for i in resources]

@classmethod
def from_proto(self, resources):
return [ClusterNodeTypeConfigs.from_proto(i) for i in resources]


class ClusterStateEnum(object):
@classmethod
def to_proto(self, resource):
Expand Down
28 changes: 0 additions & 28 deletions python/services/vmware/alpha/cluster_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,6 @@ func ProtoToVmwareAlphaClusterStateEnum(e alphapb.VmwareAlphaClusterStateEnum) *
return nil
}

// ProtoToClusterNodeTypeConfigs converts a ClusterNodeTypeConfigs object from its proto representation.
func ProtoToVmwareAlphaClusterNodeTypeConfigs(p *alphapb.VmwareAlphaClusterNodeTypeConfigs) *alpha.ClusterNodeTypeConfigs {
if p == nil {
return nil
}
obj := &alpha.ClusterNodeTypeConfigs{
NodeCount: dcl.Int64OrNil(p.GetNodeCount()),
CustomCoreCount: dcl.Int64OrNil(p.GetCustomCoreCount()),
}
return obj
}

// ProtoToCluster converts a Cluster resource from its proto representation.
func ProtoToCluster(p *alphapb.VmwareAlphaCluster) *alpha.Cluster {
obj := &alpha.Cluster{
Expand Down Expand Up @@ -75,17 +63,6 @@ func VmwareAlphaClusterStateEnumToProto(e *alpha.ClusterStateEnum) alphapb.Vmwar
return alphapb.VmwareAlphaClusterStateEnum(0)
}

// ClusterNodeTypeConfigsToProto converts a ClusterNodeTypeConfigs object to its proto representation.
func VmwareAlphaClusterNodeTypeConfigsToProto(o *alpha.ClusterNodeTypeConfigs) *alphapb.VmwareAlphaClusterNodeTypeConfigs {
if o == nil {
return nil
}
p := &alphapb.VmwareAlphaClusterNodeTypeConfigs{}
p.SetNodeCount(dcl.ValueOrEmptyInt64(o.NodeCount))
p.SetCustomCoreCount(dcl.ValueOrEmptyInt64(o.CustomCoreCount))
return p
}

// ClusterToProto converts a Cluster resource to its proto representation.
func ClusterToProto(resource *alpha.Cluster) *alphapb.VmwareAlphaCluster {
p := &alphapb.VmwareAlphaCluster{}
Expand All @@ -98,11 +75,6 @@ func ClusterToProto(resource *alpha.Cluster) *alphapb.VmwareAlphaCluster {
p.SetProject(dcl.ValueOrEmptyString(resource.Project))
p.SetLocation(dcl.ValueOrEmptyString(resource.Location))
p.SetPrivateCloud(dcl.ValueOrEmptyString(resource.PrivateCloud))
mNodeTypeConfigs := make(map[string]*alphapb.VmwareAlphaClusterNodeTypeConfigs, len(resource.NodeTypeConfigs))
for k, r := range resource.NodeTypeConfigs {
mNodeTypeConfigs[k] = VmwareAlphaClusterNodeTypeConfigsToProto(&r)
}
p.SetNodeTypeConfigs(mNodeTypeConfigs)

return p
}
Expand Down
53 changes: 1 addition & 52 deletions python/services/vmware/alpha/private_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,8 @@ def from_proto(self, resources):


class PrivateCloudManagementCluster(object):
def __init__(self, cluster_id: str = None, node_type_configs: dict = None):
def __init__(self, cluster_id: str = None):
self.cluster_id = cluster_id
self.node_type_configs = node_type_configs

@classmethod
def to_proto(self, resource):
Expand All @@ -247,8 +246,6 @@ def to_proto(self, resource):
res = private_cloud_pb2.VmwareAlphaPrivateCloudManagementCluster()
if Primitive.to_proto(resource.cluster_id):
res.cluster_id = Primitive.to_proto(resource.cluster_id)
if Primitive.to_proto(resource.node_type_configs):
res.node_type_configs = Primitive.to_proto(resource.node_type_configs)
return res

@classmethod
Expand All @@ -258,7 +255,6 @@ def from_proto(self, resource):

return PrivateCloudManagementCluster(
cluster_id=Primitive.from_proto(resource.cluster_id),
node_type_configs=Primitive.from_proto(resource.node_type_configs),
)


Expand All @@ -274,53 +270,6 @@ def from_proto(self, resources):
return [PrivateCloudManagementCluster.from_proto(i) for i in resources]


class PrivateCloudManagementClusterNodeTypeConfigs(object):
def __init__(self, node_count: int = None, custom_core_count: int = None):
self.node_count = node_count
self.custom_core_count = custom_core_count

@classmethod
def to_proto(self, resource):
if not resource:
return None

res = (
private_cloud_pb2.VmwareAlphaPrivateCloudManagementClusterNodeTypeConfigs()
)
if Primitive.to_proto(resource.node_count):
res.node_count = Primitive.to_proto(resource.node_count)
if Primitive.to_proto(resource.custom_core_count):
res.custom_core_count = Primitive.to_proto(resource.custom_core_count)
return res

@classmethod
def from_proto(self, resource):
if not resource:
return None

return PrivateCloudManagementClusterNodeTypeConfigs(
node_count=Primitive.from_proto(resource.node_count),
custom_core_count=Primitive.from_proto(resource.custom_core_count),
)


class PrivateCloudManagementClusterNodeTypeConfigsArray(object):
@classmethod
def to_proto(self, resources):
if not resources:
return resources
return [
PrivateCloudManagementClusterNodeTypeConfigs.to_proto(i) for i in resources
]

@classmethod
def from_proto(self, resources):
return [
PrivateCloudManagementClusterNodeTypeConfigs.from_proto(i)
for i in resources
]


class PrivateCloudHcx(object):
def __init__(
self,
Expand Down
28 changes: 0 additions & 28 deletions python/services/vmware/alpha/private_cloud_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,6 @@ func ProtoToVmwareAlphaPrivateCloudManagementCluster(p *alphapb.VmwareAlphaPriva
return obj
}

// ProtoToPrivateCloudManagementClusterNodeTypeConfigs converts a PrivateCloudManagementClusterNodeTypeConfigs object from its proto representation.
func ProtoToVmwareAlphaPrivateCloudManagementClusterNodeTypeConfigs(p *alphapb.VmwareAlphaPrivateCloudManagementClusterNodeTypeConfigs) *alpha.PrivateCloudManagementClusterNodeTypeConfigs {
if p == nil {
return nil
}
obj := &alpha.PrivateCloudManagementClusterNodeTypeConfigs{
NodeCount: dcl.Int64OrNil(p.GetNodeCount()),
CustomCoreCount: dcl.Int64OrNil(p.GetCustomCoreCount()),
}
return obj
}

// ProtoToPrivateCloudHcx converts a PrivateCloudHcx object from its proto representation.
func ProtoToVmwareAlphaPrivateCloudHcx(p *alphapb.VmwareAlphaPrivateCloudHcx) *alpha.PrivateCloudHcx {
if p == nil {
Expand Down Expand Up @@ -237,22 +225,6 @@ func VmwareAlphaPrivateCloudManagementClusterToProto(o *alpha.PrivateCloudManage
}
p := &alphapb.VmwareAlphaPrivateCloudManagementCluster{}
p.SetClusterId(dcl.ValueOrEmptyString(o.ClusterId))
mNodeTypeConfigs := make(map[string]*alphapb.VmwareAlphaPrivateCloudManagementClusterNodeTypeConfigs, len(o.NodeTypeConfigs))
for k, r := range o.NodeTypeConfigs {
mNodeTypeConfigs[k] = VmwareAlphaPrivateCloudManagementClusterNodeTypeConfigsToProto(&r)
}
p.SetNodeTypeConfigs(mNodeTypeConfigs)
return p
}

// PrivateCloudManagementClusterNodeTypeConfigsToProto converts a PrivateCloudManagementClusterNodeTypeConfigs object to its proto representation.
func VmwareAlphaPrivateCloudManagementClusterNodeTypeConfigsToProto(o *alpha.PrivateCloudManagementClusterNodeTypeConfigs) *alphapb.VmwareAlphaPrivateCloudManagementClusterNodeTypeConfigs {
if o == nil {
return nil
}
p := &alphapb.VmwareAlphaPrivateCloudManagementClusterNodeTypeConfigs{}
p.SetNodeCount(dcl.ValueOrEmptyInt64(o.NodeCount))
p.SetCustomCoreCount(dcl.ValueOrEmptyInt64(o.CustomCoreCount))
return p
}

Expand Down
Loading

0 comments on commit 873af49

Please sign in to comment.