Skip to content

Commit

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

GitOrigin-RevId: 0bbbcc3c35ee7204977e51ea825f97f9aa2a21f3
  • Loading branch information
DCL Team authored and copybara-github committed Aug 26, 2022
1 parent 2af01ac commit b91ad81
Show file tree
Hide file tree
Showing 29 changed files with 1,994 additions and 9 deletions.
7 changes: 7 additions & 0 deletions python/proto/dataproc/alpha/workflow_template.proto
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ message DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConf
map<string, string> metadata = 9;
DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigReservationAffinity reservation_affinity = 10;
DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigNodeGroupAffinity node_group_affinity = 11;
DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig shielded_instance_config = 12;
}

message DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigReservationAffinity {
Expand All @@ -144,6 +145,12 @@ message DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConf
string node_group = 1;
}

message DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig {
bool enable_secure_boot = 1;
bool enable_vtpm = 2;
bool enable_integrity_monitoring = 3;
}

message DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigMasterConfig {
int64 num_instances = 1;
repeated string instance_names = 2;
Expand Down
7 changes: 7 additions & 0 deletions python/proto/dataproc/beta/workflow_template.proto
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ message DataprocBetaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfi
map<string, string> metadata = 9;
DataprocBetaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigReservationAffinity reservation_affinity = 10;
DataprocBetaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigNodeGroupAffinity node_group_affinity = 11;
DataprocBetaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig shielded_instance_config = 12;
}

message DataprocBetaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigReservationAffinity {
Expand All @@ -144,6 +145,12 @@ message DataprocBetaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfi
string node_group = 1;
}

message DataprocBetaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig {
bool enable_secure_boot = 1;
bool enable_vtpm = 2;
bool enable_integrity_monitoring = 3;
}

message DataprocBetaWorkflowTemplatePlacementManagedClusterConfigMasterConfig {
int64 num_instances = 1;
repeated string instance_names = 2;
Expand Down
7 changes: 7 additions & 0 deletions python/proto/dataproc/workflow_template.proto
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ message DataprocWorkflowTemplatePlacementManagedClusterConfigGceClusterConfig {
map<string, string> metadata = 9;
DataprocWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigReservationAffinity reservation_affinity = 10;
DataprocWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigNodeGroupAffinity node_group_affinity = 11;
DataprocWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig shielded_instance_config = 12;
}

message DataprocWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigReservationAffinity {
Expand All @@ -142,6 +143,12 @@ message DataprocWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigNod
string node_group = 1;
}

message DataprocWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig {
bool enable_secure_boot = 1;
bool enable_vtpm = 2;
bool enable_integrity_monitoring = 3;
}

message DataprocWorkflowTemplatePlacementManagedClusterConfigMasterConfig {
int64 num_instances = 1;
repeated string instance_names = 2;
Expand Down
84 changes: 84 additions & 0 deletions python/services/dataproc/alpha/workflow_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ def __init__(
metadata: dict = None,
reservation_affinity: dict = None,
node_group_affinity: dict = None,
shielded_instance_config: dict = None,
):
self.zone = zone
self.network = network
Expand All @@ -554,6 +555,7 @@ def __init__(
self.metadata = metadata
self.reservation_affinity = reservation_affinity
self.node_group_affinity = node_group_affinity
self.shielded_instance_config = shielded_instance_config

@classmethod
def to_proto(self, resource):
Expand Down Expand Up @@ -607,6 +609,16 @@ def to_proto(self, resource):
)
else:
res.ClearField("node_group_affinity")
if WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig.to_proto(
resource.shielded_instance_config
):
res.shielded_instance_config.CopyFrom(
WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig.to_proto(
resource.shielded_instance_config
)
)
else:
res.ClearField("shielded_instance_config")
return res

@classmethod
Expand Down Expand Up @@ -634,6 +646,9 @@ def from_proto(self, resource):
node_group_affinity=WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigNodeGroupAffinity.from_proto(
resource.node_group_affinity
),
shielded_instance_config=WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig.from_proto(
resource.shielded_instance_config
),
)


Expand Down Expand Up @@ -775,6 +790,75 @@ def from_proto(self, resources):
]


class WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig(
object
):
def __init__(
self,
enable_secure_boot: bool = None,
enable_vtpm: bool = None,
enable_integrity_monitoring: bool = None,
):
self.enable_secure_boot = enable_secure_boot
self.enable_vtpm = enable_vtpm
self.enable_integrity_monitoring = enable_integrity_monitoring

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

res = (
workflow_template_pb2.DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig()
)
if Primitive.to_proto(resource.enable_secure_boot):
res.enable_secure_boot = Primitive.to_proto(resource.enable_secure_boot)
if Primitive.to_proto(resource.enable_vtpm):
res.enable_vtpm = Primitive.to_proto(resource.enable_vtpm)
if Primitive.to_proto(resource.enable_integrity_monitoring):
res.enable_integrity_monitoring = Primitive.to_proto(
resource.enable_integrity_monitoring
)
return res

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

return WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig(
enable_secure_boot=Primitive.from_proto(resource.enable_secure_boot),
enable_vtpm=Primitive.from_proto(resource.enable_vtpm),
enable_integrity_monitoring=Primitive.from_proto(
resource.enable_integrity_monitoring
),
)


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

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


class WorkflowTemplatePlacementManagedClusterConfigMasterConfig(object):
def __init__(
self,
Expand Down
27 changes: 27 additions & 0 deletions python/services/dataproc/alpha/workflow_template_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ func ProtoToDataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceCluster
ServiceAccount: dcl.StringOrNil(p.GetServiceAccount()),
ReservationAffinity: ProtoToDataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigReservationAffinity(p.GetReservationAffinity()),
NodeGroupAffinity: ProtoToDataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigNodeGroupAffinity(p.GetNodeGroupAffinity()),
ShieldedInstanceConfig: ProtoToDataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig(p.GetShieldedInstanceConfig()),
}
for _, r := range p.GetServiceAccountScopes() {
obj.ServiceAccountScopes = append(obj.ServiceAccountScopes, r)
Expand Down Expand Up @@ -197,6 +198,19 @@ func ProtoToDataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceCluster
return obj
}

// ProtoToWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig converts a WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig object from its proto representation.
func ProtoToDataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig(p *alphapb.DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig) *alpha.WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig {
if p == nil {
return nil
}
obj := &alpha.WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig{
EnableSecureBoot: dcl.Bool(p.GetEnableSecureBoot()),
EnableVtpm: dcl.Bool(p.GetEnableVtpm()),
EnableIntegrityMonitoring: dcl.Bool(p.GetEnableIntegrityMonitoring()),
}
return obj
}

// ProtoToWorkflowTemplatePlacementManagedClusterConfigMasterConfig converts a WorkflowTemplatePlacementManagedClusterConfigMasterConfig object from its proto representation.
func ProtoToDataprocAlphaWorkflowTemplatePlacementManagedClusterConfigMasterConfig(p *alphapb.DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigMasterConfig) *alpha.WorkflowTemplatePlacementManagedClusterConfigMasterConfig {
if p == nil {
Expand Down Expand Up @@ -1053,6 +1067,7 @@ func DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigT
p.SetServiceAccount(dcl.ValueOrEmptyString(o.ServiceAccount))
p.SetReservationAffinity(DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigReservationAffinityToProto(o.ReservationAffinity))
p.SetNodeGroupAffinity(DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigNodeGroupAffinityToProto(o.NodeGroupAffinity))
p.SetShieldedInstanceConfig(DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfigToProto(o.ShieldedInstanceConfig))
sServiceAccountScopes := make([]string, len(o.ServiceAccountScopes))
for i, r := range o.ServiceAccountScopes {
sServiceAccountScopes[i] = r
Expand Down Expand Up @@ -1097,6 +1112,18 @@ func DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigN
return p
}

// WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfigToProto converts a WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig object to its proto representation.
func DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfigToProto(o *alpha.WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig) *alphapb.DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig {
if o == nil {
return nil
}
p := &alphapb.DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig{}
p.SetEnableSecureBoot(dcl.ValueOrEmptyBool(o.EnableSecureBoot))
p.SetEnableVtpm(dcl.ValueOrEmptyBool(o.EnableVtpm))
p.SetEnableIntegrityMonitoring(dcl.ValueOrEmptyBool(o.EnableIntegrityMonitoring))
return p
}

// WorkflowTemplatePlacementManagedClusterConfigMasterConfigToProto converts a WorkflowTemplatePlacementManagedClusterConfigMasterConfig object to its proto representation.
func DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigMasterConfigToProto(o *alpha.WorkflowTemplatePlacementManagedClusterConfigMasterConfig) *alphapb.DataprocAlphaWorkflowTemplatePlacementManagedClusterConfigMasterConfig {
if o == nil {
Expand Down
84 changes: 84 additions & 0 deletions python/services/dataproc/beta/workflow_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,7 @@ def __init__(
metadata: dict = None,
reservation_affinity: dict = None,
node_group_affinity: dict = None,
shielded_instance_config: dict = None,
):
self.zone = zone
self.network = network
Expand All @@ -554,6 +555,7 @@ def __init__(
self.metadata = metadata
self.reservation_affinity = reservation_affinity
self.node_group_affinity = node_group_affinity
self.shielded_instance_config = shielded_instance_config

@classmethod
def to_proto(self, resource):
Expand Down Expand Up @@ -607,6 +609,16 @@ def to_proto(self, resource):
)
else:
res.ClearField("node_group_affinity")
if WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig.to_proto(
resource.shielded_instance_config
):
res.shielded_instance_config.CopyFrom(
WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig.to_proto(
resource.shielded_instance_config
)
)
else:
res.ClearField("shielded_instance_config")
return res

@classmethod
Expand Down Expand Up @@ -634,6 +646,9 @@ def from_proto(self, resource):
node_group_affinity=WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigNodeGroupAffinity.from_proto(
resource.node_group_affinity
),
shielded_instance_config=WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig.from_proto(
resource.shielded_instance_config
),
)


Expand Down Expand Up @@ -775,6 +790,75 @@ def from_proto(self, resources):
]


class WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig(
object
):
def __init__(
self,
enable_secure_boot: bool = None,
enable_vtpm: bool = None,
enable_integrity_monitoring: bool = None,
):
self.enable_secure_boot = enable_secure_boot
self.enable_vtpm = enable_vtpm
self.enable_integrity_monitoring = enable_integrity_monitoring

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

res = (
workflow_template_pb2.DataprocBetaWorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig()
)
if Primitive.to_proto(resource.enable_secure_boot):
res.enable_secure_boot = Primitive.to_proto(resource.enable_secure_boot)
if Primitive.to_proto(resource.enable_vtpm):
res.enable_vtpm = Primitive.to_proto(resource.enable_vtpm)
if Primitive.to_proto(resource.enable_integrity_monitoring):
res.enable_integrity_monitoring = Primitive.to_proto(
resource.enable_integrity_monitoring
)
return res

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

return WorkflowTemplatePlacementManagedClusterConfigGceClusterConfigShieldedInstanceConfig(
enable_secure_boot=Primitive.from_proto(resource.enable_secure_boot),
enable_vtpm=Primitive.from_proto(resource.enable_vtpm),
enable_integrity_monitoring=Primitive.from_proto(
resource.enable_integrity_monitoring
),
)


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

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


class WorkflowTemplatePlacementManagedClusterConfigMasterConfig(object):
def __init__(
self,
Expand Down
Loading

0 comments on commit b91ad81

Please sign in to comment.