Skip to content

Commit

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

GitOrigin-RevId: 6c28fec
  • Loading branch information
DCL Team authored and copybara-github committed May 2, 2022
1 parent 46d3dfd commit a010ffc
Show file tree
Hide file tree
Showing 19 changed files with 1,060 additions and 16 deletions.
10 changes: 8 additions & 2 deletions python/proto/containeraws/alpha/node_pool.proto
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ message ContainerawsAlphaNodePoolConfig {
ContainerawsAlphaNodePoolConfigConfigEncryption config_encryption = 7;
ContainerawsAlphaNodePoolConfigSshConfig ssh_config = 8;
repeated string security_group_ids = 9;
ContainerawsAlphaNodePoolConfigInstancePlacement instance_placement = 10;
string image_type = 11;
ContainerawsAlphaNodePoolConfigProxyConfig proxy_config = 10;
ContainerawsAlphaNodePoolConfigInstancePlacement instance_placement = 11;
string image_type = 12;
}

message ContainerawsAlphaNodePoolConfigRootVolume {
Expand All @@ -109,6 +110,11 @@ message ContainerawsAlphaNodePoolConfigSshConfig {
string ec2_key_pair = 1;
}

message ContainerawsAlphaNodePoolConfigProxyConfig {
string secret_arn = 1;
string secret_version = 2;
}

message ContainerawsAlphaNodePoolConfigInstancePlacement {
ContainerawsAlphaNodePoolConfigInstancePlacementTenancyEnum tenancy = 1;
}
Expand Down
10 changes: 8 additions & 2 deletions python/proto/containeraws/beta/node_pool.proto
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ message ContainerawsBetaNodePoolConfig {
ContainerawsBetaNodePoolConfigConfigEncryption config_encryption = 7;
ContainerawsBetaNodePoolConfigSshConfig ssh_config = 8;
repeated string security_group_ids = 9;
ContainerawsBetaNodePoolConfigInstancePlacement instance_placement = 10;
string image_type = 11;
ContainerawsBetaNodePoolConfigProxyConfig proxy_config = 10;
ContainerawsBetaNodePoolConfigInstancePlacement instance_placement = 11;
string image_type = 12;
}

message ContainerawsBetaNodePoolConfigRootVolume {
Expand All @@ -109,6 +110,11 @@ message ContainerawsBetaNodePoolConfigSshConfig {
string ec2_key_pair = 1;
}

message ContainerawsBetaNodePoolConfigProxyConfig {
string secret_arn = 1;
string secret_version = 2;
}

message ContainerawsBetaNodePoolConfigInstancePlacement {
ContainerawsBetaNodePoolConfigInstancePlacementTenancyEnum tenancy = 1;
}
Expand Down
49 changes: 49 additions & 0 deletions python/services/containeraws/alpha/node_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ def __init__(
config_encryption: dict = None,
ssh_config: dict = None,
security_group_ids: list = None,
proxy_config: dict = None,
instance_placement: dict = None,
image_type: str = None,
):
Expand All @@ -236,6 +237,7 @@ def __init__(
self.config_encryption = config_encryption
self.ssh_config = ssh_config
self.security_group_ids = security_group_ids
self.proxy_config = proxy_config
self.instance_placement = instance_placement
self.image_type = image_type

Expand Down Expand Up @@ -277,6 +279,12 @@ def to_proto(self, resource):
res.security_group_ids.extend(
Primitive.to_proto(resource.security_group_ids)
)
if NodePoolConfigProxyConfig.to_proto(resource.proxy_config):
res.proxy_config.CopyFrom(
NodePoolConfigProxyConfig.to_proto(resource.proxy_config)
)
else:
res.ClearField("proxy_config")
if NodePoolConfigInstancePlacement.to_proto(resource.instance_placement):
res.instance_placement.CopyFrom(
NodePoolConfigInstancePlacement.to_proto(resource.instance_placement)
Expand Down Expand Up @@ -304,6 +312,7 @@ def from_proto(self, resource):
),
ssh_config=NodePoolConfigSshConfig.from_proto(resource.ssh_config),
security_group_ids=Primitive.from_proto(resource.security_group_ids),
proxy_config=NodePoolConfigProxyConfig.from_proto(resource.proxy_config),
instance_placement=NodePoolConfigInstancePlacement.from_proto(
resource.instance_placement
),
Expand Down Expand Up @@ -497,6 +506,46 @@ def from_proto(self, resources):
return [NodePoolConfigSshConfig.from_proto(i) for i in resources]


class NodePoolConfigProxyConfig(object):
def __init__(self, secret_arn: str = None, secret_version: str = None):
self.secret_arn = secret_arn
self.secret_version = secret_version

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

res = node_pool_pb2.ContainerawsAlphaNodePoolConfigProxyConfig()
if Primitive.to_proto(resource.secret_arn):
res.secret_arn = Primitive.to_proto(resource.secret_arn)
if Primitive.to_proto(resource.secret_version):
res.secret_version = Primitive.to_proto(resource.secret_version)
return res

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

return NodePoolConfigProxyConfig(
secret_arn=Primitive.from_proto(resource.secret_arn),
secret_version=Primitive.from_proto(resource.secret_version),
)


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

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


class NodePoolConfigInstancePlacement(object):
def __init__(self, tenancy: str = None):
self.tenancy = tenancy
Expand Down
25 changes: 25 additions & 0 deletions python/services/containeraws/alpha/node_pool_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func ProtoToContainerawsAlphaNodePoolConfig(p *alphapb.ContainerawsAlphaNodePool
IamInstanceProfile: dcl.StringOrNil(p.GetIamInstanceProfile()),
ConfigEncryption: ProtoToContainerawsAlphaNodePoolConfigConfigEncryption(p.GetConfigEncryption()),
SshConfig: ProtoToContainerawsAlphaNodePoolConfigSshConfig(p.GetSshConfig()),
ProxyConfig: ProtoToContainerawsAlphaNodePoolConfigProxyConfig(p.GetProxyConfig()),
InstancePlacement: ProtoToContainerawsAlphaNodePoolConfigInstancePlacement(p.GetInstancePlacement()),
ImageType: dcl.StringOrNil(p.GetImageType()),
}
Expand Down Expand Up @@ -144,6 +145,18 @@ func ProtoToContainerawsAlphaNodePoolConfigSshConfig(p *alphapb.ContainerawsAlph
return obj
}

// ProtoToNodePoolConfigProxyConfig converts a NodePoolConfigProxyConfig object from its proto representation.
func ProtoToContainerawsAlphaNodePoolConfigProxyConfig(p *alphapb.ContainerawsAlphaNodePoolConfigProxyConfig) *alpha.NodePoolConfigProxyConfig {
if p == nil {
return nil
}
obj := &alpha.NodePoolConfigProxyConfig{
SecretArn: dcl.StringOrNil(p.GetSecretArn()),
SecretVersion: dcl.StringOrNil(p.GetSecretVersion()),
}
return obj
}

// ProtoToNodePoolConfigInstancePlacement converts a NodePoolConfigInstancePlacement object from its proto representation.
func ProtoToContainerawsAlphaNodePoolConfigInstancePlacement(p *alphapb.ContainerawsAlphaNodePoolConfigInstancePlacement) *alpha.NodePoolConfigInstancePlacement {
if p == nil {
Expand Down Expand Up @@ -255,6 +268,7 @@ func ContainerawsAlphaNodePoolConfigToProto(o *alpha.NodePoolConfig) *alphapb.Co
p.SetIamInstanceProfile(dcl.ValueOrEmptyString(o.IamInstanceProfile))
p.SetConfigEncryption(ContainerawsAlphaNodePoolConfigConfigEncryptionToProto(o.ConfigEncryption))
p.SetSshConfig(ContainerawsAlphaNodePoolConfigSshConfigToProto(o.SshConfig))
p.SetProxyConfig(ContainerawsAlphaNodePoolConfigProxyConfigToProto(o.ProxyConfig))
p.SetInstancePlacement(ContainerawsAlphaNodePoolConfigInstancePlacementToProto(o.InstancePlacement))
p.SetImageType(dcl.ValueOrEmptyString(o.ImageType))
sTaints := make([]*alphapb.ContainerawsAlphaNodePoolConfigTaints, len(o.Taints))
Expand Down Expand Up @@ -325,6 +339,17 @@ func ContainerawsAlphaNodePoolConfigSshConfigToProto(o *alpha.NodePoolConfigSshC
return p
}

// NodePoolConfigProxyConfigToProto converts a NodePoolConfigProxyConfig object to its proto representation.
func ContainerawsAlphaNodePoolConfigProxyConfigToProto(o *alpha.NodePoolConfigProxyConfig) *alphapb.ContainerawsAlphaNodePoolConfigProxyConfig {
if o == nil {
return nil
}
p := &alphapb.ContainerawsAlphaNodePoolConfigProxyConfig{}
p.SetSecretArn(dcl.ValueOrEmptyString(o.SecretArn))
p.SetSecretVersion(dcl.ValueOrEmptyString(o.SecretVersion))
return p
}

// NodePoolConfigInstancePlacementToProto converts a NodePoolConfigInstancePlacement object to its proto representation.
func ContainerawsAlphaNodePoolConfigInstancePlacementToProto(o *alpha.NodePoolConfigInstancePlacement) *alphapb.ContainerawsAlphaNodePoolConfigInstancePlacement {
if o == nil {
Expand Down
49 changes: 49 additions & 0 deletions python/services/containeraws/beta/node_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ def __init__(
config_encryption: dict = None,
ssh_config: dict = None,
security_group_ids: list = None,
proxy_config: dict = None,
instance_placement: dict = None,
image_type: str = None,
):
Expand All @@ -230,6 +231,7 @@ def __init__(
self.config_encryption = config_encryption
self.ssh_config = ssh_config
self.security_group_ids = security_group_ids
self.proxy_config = proxy_config
self.instance_placement = instance_placement
self.image_type = image_type

Expand Down Expand Up @@ -271,6 +273,12 @@ def to_proto(self, resource):
res.security_group_ids.extend(
Primitive.to_proto(resource.security_group_ids)
)
if NodePoolConfigProxyConfig.to_proto(resource.proxy_config):
res.proxy_config.CopyFrom(
NodePoolConfigProxyConfig.to_proto(resource.proxy_config)
)
else:
res.ClearField("proxy_config")
if NodePoolConfigInstancePlacement.to_proto(resource.instance_placement):
res.instance_placement.CopyFrom(
NodePoolConfigInstancePlacement.to_proto(resource.instance_placement)
Expand Down Expand Up @@ -298,6 +306,7 @@ def from_proto(self, resource):
),
ssh_config=NodePoolConfigSshConfig.from_proto(resource.ssh_config),
security_group_ids=Primitive.from_proto(resource.security_group_ids),
proxy_config=NodePoolConfigProxyConfig.from_proto(resource.proxy_config),
instance_placement=NodePoolConfigInstancePlacement.from_proto(
resource.instance_placement
),
Expand Down Expand Up @@ -491,6 +500,46 @@ def from_proto(self, resources):
return [NodePoolConfigSshConfig.from_proto(i) for i in resources]


class NodePoolConfigProxyConfig(object):
def __init__(self, secret_arn: str = None, secret_version: str = None):
self.secret_arn = secret_arn
self.secret_version = secret_version

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

res = node_pool_pb2.ContainerawsBetaNodePoolConfigProxyConfig()
if Primitive.to_proto(resource.secret_arn):
res.secret_arn = Primitive.to_proto(resource.secret_arn)
if Primitive.to_proto(resource.secret_version):
res.secret_version = Primitive.to_proto(resource.secret_version)
return res

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

return NodePoolConfigProxyConfig(
secret_arn=Primitive.from_proto(resource.secret_arn),
secret_version=Primitive.from_proto(resource.secret_version),
)


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

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


class NodePoolConfigInstancePlacement(object):
def __init__(self, tenancy: str = None):
self.tenancy = tenancy
Expand Down
25 changes: 25 additions & 0 deletions python/services/containeraws/beta/node_pool_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ func ProtoToContainerawsBetaNodePoolConfig(p *betapb.ContainerawsBetaNodePoolCon
IamInstanceProfile: dcl.StringOrNil(p.GetIamInstanceProfile()),
ConfigEncryption: ProtoToContainerawsBetaNodePoolConfigConfigEncryption(p.GetConfigEncryption()),
SshConfig: ProtoToContainerawsBetaNodePoolConfigSshConfig(p.GetSshConfig()),
ProxyConfig: ProtoToContainerawsBetaNodePoolConfigProxyConfig(p.GetProxyConfig()),
InstancePlacement: ProtoToContainerawsBetaNodePoolConfigInstancePlacement(p.GetInstancePlacement()),
ImageType: dcl.StringOrNil(p.GetImageType()),
}
Expand Down Expand Up @@ -144,6 +145,18 @@ func ProtoToContainerawsBetaNodePoolConfigSshConfig(p *betapb.ContainerawsBetaNo
return obj
}

// ProtoToNodePoolConfigProxyConfig converts a NodePoolConfigProxyConfig object from its proto representation.
func ProtoToContainerawsBetaNodePoolConfigProxyConfig(p *betapb.ContainerawsBetaNodePoolConfigProxyConfig) *beta.NodePoolConfigProxyConfig {
if p == nil {
return nil
}
obj := &beta.NodePoolConfigProxyConfig{
SecretArn: dcl.StringOrNil(p.GetSecretArn()),
SecretVersion: dcl.StringOrNil(p.GetSecretVersion()),
}
return obj
}

// ProtoToNodePoolConfigInstancePlacement converts a NodePoolConfigInstancePlacement object from its proto representation.
func ProtoToContainerawsBetaNodePoolConfigInstancePlacement(p *betapb.ContainerawsBetaNodePoolConfigInstancePlacement) *beta.NodePoolConfigInstancePlacement {
if p == nil {
Expand Down Expand Up @@ -255,6 +268,7 @@ func ContainerawsBetaNodePoolConfigToProto(o *beta.NodePoolConfig) *betapb.Conta
p.SetIamInstanceProfile(dcl.ValueOrEmptyString(o.IamInstanceProfile))
p.SetConfigEncryption(ContainerawsBetaNodePoolConfigConfigEncryptionToProto(o.ConfigEncryption))
p.SetSshConfig(ContainerawsBetaNodePoolConfigSshConfigToProto(o.SshConfig))
p.SetProxyConfig(ContainerawsBetaNodePoolConfigProxyConfigToProto(o.ProxyConfig))
p.SetInstancePlacement(ContainerawsBetaNodePoolConfigInstancePlacementToProto(o.InstancePlacement))
p.SetImageType(dcl.ValueOrEmptyString(o.ImageType))
sTaints := make([]*betapb.ContainerawsBetaNodePoolConfigTaints, len(o.Taints))
Expand Down Expand Up @@ -325,6 +339,17 @@ func ContainerawsBetaNodePoolConfigSshConfigToProto(o *beta.NodePoolConfigSshCon
return p
}

// NodePoolConfigProxyConfigToProto converts a NodePoolConfigProxyConfig object to its proto representation.
func ContainerawsBetaNodePoolConfigProxyConfigToProto(o *beta.NodePoolConfigProxyConfig) *betapb.ContainerawsBetaNodePoolConfigProxyConfig {
if o == nil {
return nil
}
p := &betapb.ContainerawsBetaNodePoolConfigProxyConfig{}
p.SetSecretArn(dcl.ValueOrEmptyString(o.SecretArn))
p.SetSecretVersion(dcl.ValueOrEmptyString(o.SecretVersion))
return p
}

// NodePoolConfigInstancePlacementToProto converts a NodePoolConfigInstancePlacement object to its proto representation.
func ContainerawsBetaNodePoolConfigInstancePlacementToProto(o *beta.NodePoolConfigInstancePlacement) *betapb.ContainerawsBetaNodePoolConfigInstancePlacement {
if o == nil {
Expand Down
8 changes: 6 additions & 2 deletions services/google/compute/alpha/service_attachment_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ func newUpdateServiceAttachmentPatchRequest(ctx context.Context, f *ServiceAttac
if v := f.NatSubnets; v != nil {
req["natSubnets"] = v
}
if v := f.ConsumerRejectLists; v != nil {
if v, err := dcl.SelfLinkToNameArrayExpander(f.ConsumerRejectLists); err != nil {
return nil, fmt.Errorf("error expanding ConsumerRejectLists into consumerRejectLists: %w", err)
} else if v != nil {
req["consumerRejectLists"] = v
}
if v, err := expandServiceAttachmentConsumerAcceptListsSlice(c, f.ConsumerAcceptLists, res); err != nil {
Expand Down Expand Up @@ -1327,7 +1329,9 @@ func expandServiceAttachment(c *Client, f *ServiceAttachment) (map[string]interf
if v := f.EnableProxyProtocol; dcl.ValueShouldBeSent(v) {
m["enableProxyProtocol"] = v
}
if v := f.ConsumerRejectLists; v != nil {
if v, err := dcl.SelfLinkToNameArrayExpander(f.ConsumerRejectLists); err != nil {
return nil, fmt.Errorf("error expanding ConsumerRejectLists into consumerRejectLists: %w", err)
} else if v != nil {
m["consumerRejectLists"] = v
}
if v, err := expandServiceAttachmentConsumerAcceptListsSlice(c, f.ConsumerAcceptLists, res); err != nil {
Expand Down
8 changes: 6 additions & 2 deletions services/google/compute/beta/service_attachment_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ func newUpdateServiceAttachmentPatchRequest(ctx context.Context, f *ServiceAttac
if v := f.NatSubnets; v != nil {
req["natSubnets"] = v
}
if v := f.ConsumerRejectLists; v != nil {
if v, err := dcl.SelfLinkToNameArrayExpander(f.ConsumerRejectLists); err != nil {
return nil, fmt.Errorf("error expanding ConsumerRejectLists into consumerRejectLists: %w", err)
} else if v != nil {
req["consumerRejectLists"] = v
}
if v, err := expandServiceAttachmentConsumerAcceptListsSlice(c, f.ConsumerAcceptLists, res); err != nil {
Expand Down Expand Up @@ -1327,7 +1329,9 @@ func expandServiceAttachment(c *Client, f *ServiceAttachment) (map[string]interf
if v := f.EnableProxyProtocol; dcl.ValueShouldBeSent(v) {
m["enableProxyProtocol"] = v
}
if v := f.ConsumerRejectLists; v != nil {
if v, err := dcl.SelfLinkToNameArrayExpander(f.ConsumerRejectLists); err != nil {
return nil, fmt.Errorf("error expanding ConsumerRejectLists into consumerRejectLists: %w", err)
} else if v != nil {
m["consumerRejectLists"] = v
}
if v, err := expandServiceAttachmentConsumerAcceptListsSlice(c, f.ConsumerAcceptLists, res); err != nil {
Expand Down
8 changes: 6 additions & 2 deletions services/google/compute/service_attachment_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ func newUpdateServiceAttachmentPatchRequest(ctx context.Context, f *ServiceAttac
if v := f.NatSubnets; v != nil {
req["natSubnets"] = v
}
if v := f.ConsumerRejectLists; v != nil {
if v, err := dcl.SelfLinkToNameArrayExpander(f.ConsumerRejectLists); err != nil {
return nil, fmt.Errorf("error expanding ConsumerRejectLists into consumerRejectLists: %w", err)
} else if v != nil {
req["consumerRejectLists"] = v
}
if v, err := expandServiceAttachmentConsumerAcceptListsSlice(c, f.ConsumerAcceptLists, res); err != nil {
Expand Down Expand Up @@ -1327,7 +1329,9 @@ func expandServiceAttachment(c *Client, f *ServiceAttachment) (map[string]interf
if v := f.EnableProxyProtocol; dcl.ValueShouldBeSent(v) {
m["enableProxyProtocol"] = v
}
if v := f.ConsumerRejectLists; v != nil {
if v, err := dcl.SelfLinkToNameArrayExpander(f.ConsumerRejectLists); err != nil {
return nil, fmt.Errorf("error expanding ConsumerRejectLists into consumerRejectLists: %w", err)
} else if v != nil {
m["consumerRejectLists"] = v
}
if v, err := expandServiceAttachmentConsumerAcceptListsSlice(c, f.ConsumerAcceptLists, res); err != nil {
Expand Down
Loading

0 comments on commit a010ffc

Please sign in to comment.