Skip to content

Commit

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

GitOrigin-RevId: 564fcf835a215a102ec5087e28aa74571a83482f
  • Loading branch information
DCL Team authored and copybara-github committed Jun 27, 2022
1 parent c532435 commit 3f92255
Show file tree
Hide file tree
Showing 33 changed files with 80 additions and 1,515 deletions.
17 changes: 2 additions & 15 deletions python/proto/gkehub/alpha/feature_membership.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ import "proto/connector/sdk.proto";
import "proto/empty.proto";


enum GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum {
GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnumNO_VALUE_DO_NOT_USE = 0;
GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnumMONITORING_BACKEND_UNSPECIFIED = 1;
GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnumPROMETHEUS = 2;
GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnumCLOUD_MONITORING = 3;
}

message GkehubAlphaFeatureMembership {
GkehubAlphaFeatureMembershipConfigmanagement configmanagement = 1;
string project = 2;
Expand Down Expand Up @@ -66,14 +59,8 @@ message GkehubAlphaFeatureMembershipConfigmanagementPolicyController {
repeated string exemptable_namespaces = 2;
bool referential_rules_enabled = 3;
bool log_denies_enabled = 4;
bool mutation_enabled = 5;
GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring policy_controller_monitoring = 6;
bool template_library_installed = 7;
string audit_interval_seconds = 8;
}

message GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring {
repeated GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum backends = 1;
bool template_library_installed = 5;
string audit_interval_seconds = 6;
}

message GkehubAlphaFeatureMembershipConfigmanagementBinauthz {
Expand Down
17 changes: 2 additions & 15 deletions python/proto/gkehub/beta/feature_membership.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@ import "proto/connector/sdk.proto";
import "proto/empty.proto";


enum GkehubBetaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum {
GkehubBetaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnumNO_VALUE_DO_NOT_USE = 0;
GkehubBetaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnumMONITORING_BACKEND_UNSPECIFIED = 1;
GkehubBetaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnumPROMETHEUS = 2;
GkehubBetaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnumCLOUD_MONITORING = 3;
}

message GkehubBetaFeatureMembership {
GkehubBetaFeatureMembershipConfigmanagement configmanagement = 1;
string project = 2;
Expand Down Expand Up @@ -66,14 +59,8 @@ message GkehubBetaFeatureMembershipConfigmanagementPolicyController {
repeated string exemptable_namespaces = 2;
bool referential_rules_enabled = 3;
bool log_denies_enabled = 4;
bool mutation_enabled = 5;
GkehubBetaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring policy_controller_monitoring = 6;
bool template_library_installed = 7;
string audit_interval_seconds = 8;
}

message GkehubBetaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring {
repeated GkehubBetaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum backends = 1;
bool template_library_installed = 5;
string audit_interval_seconds = 6;
}

message GkehubBetaFeatureMembershipConfigmanagementBinauthz {
Expand Down
105 changes: 0 additions & 105 deletions python/services/gkehub/alpha/feature_membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -375,17 +375,13 @@ def __init__(
exemptable_namespaces: list = None,
referential_rules_enabled: bool = None,
log_denies_enabled: bool = None,
mutation_enabled: bool = None,
policy_controller_monitoring: dict = None,
template_library_installed: bool = None,
audit_interval_seconds: str = None,
):
self.enabled = enabled
self.exemptable_namespaces = exemptable_namespaces
self.referential_rules_enabled = referential_rules_enabled
self.log_denies_enabled = log_denies_enabled
self.mutation_enabled = mutation_enabled
self.policy_controller_monitoring = policy_controller_monitoring
self.template_library_installed = template_library_installed
self.audit_interval_seconds = audit_interval_seconds

Expand All @@ -409,18 +405,6 @@ def to_proto(self, resource):
)
if Primitive.to_proto(resource.log_denies_enabled):
res.log_denies_enabled = Primitive.to_proto(resource.log_denies_enabled)
if Primitive.to_proto(resource.mutation_enabled):
res.mutation_enabled = Primitive.to_proto(resource.mutation_enabled)
if FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring.to_proto(
resource.policy_controller_monitoring
):
res.policy_controller_monitoring.CopyFrom(
FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring.to_proto(
resource.policy_controller_monitoring
)
)
else:
res.ClearField("policy_controller_monitoring")
if Primitive.to_proto(resource.template_library_installed):
res.template_library_installed = Primitive.to_proto(
resource.template_library_installed
Expand All @@ -443,10 +427,6 @@ def from_proto(self, resource):
resource.referential_rules_enabled
),
log_denies_enabled=Primitive.from_proto(resource.log_denies_enabled),
mutation_enabled=Primitive.from_proto(resource.mutation_enabled),
policy_controller_monitoring=FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring.from_proto(
resource.policy_controller_monitoring
),
template_library_installed=Primitive.from_proto(
resource.template_library_installed
),
Expand Down Expand Up @@ -474,66 +454,6 @@ def from_proto(self, resources):
]


class FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring(
object
):
def __init__(self, backends: list = None):
self.backends = backends

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

res = (
feature_membership_pb2.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring()
)
if FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnumArray.to_proto(
resource.backends
):
res.backends.extend(
FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnumArray.to_proto(
resource.backends
)
)
return res

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

return FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring(
backends=FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnumArray.from_proto(
resource.backends
),
)


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

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


class FeatureMembershipConfigmanagementBinauthz(object):
def __init__(self, enabled: bool = None):
self.enabled = enabled
Expand Down Expand Up @@ -641,31 +561,6 @@ def from_proto(self, resources):
]


class FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum(
object
):
@classmethod
def to_proto(self, resource):
if not resource:
return resource
return feature_membership_pb2.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum.Value(
"GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum%s"
% resource
)

@classmethod
def from_proto(self, resource):
if not resource:
return resource
return feature_membership_pb2.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum.Name(
resource
)[
len(
"GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum"
) :
]


class Primitive(object):
@classmethod
def to_proto(self, s):
Expand Down
63 changes: 5 additions & 58 deletions python/services/gkehub/alpha/feature_membership_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,6 @@ import (
// FeatureMembershipServer implements the gRPC interface for FeatureMembership.
type FeatureMembershipServer struct{}

// ProtoToFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum converts a FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum enum from its proto representation.
func ProtoToGkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum(e alphapb.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum) *alpha.FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum {
if e == 0 {
return nil
}
if n, ok := alphapb.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum_name[int32(e)]; ok {
e := alpha.FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum(n[len("GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum"):])
return &e
}
return nil
}

// ProtoToFeatureMembershipConfigmanagement converts a FeatureMembershipConfigmanagement object from its proto representation.
func ProtoToGkehubAlphaFeatureMembershipConfigmanagement(p *alphapb.GkehubAlphaFeatureMembershipConfigmanagement) *alpha.FeatureMembershipConfigmanagement {
if p == nil {
Expand Down Expand Up @@ -88,32 +76,18 @@ func ProtoToGkehubAlphaFeatureMembershipConfigmanagementPolicyController(p *alph
return nil
}
obj := &alpha.FeatureMembershipConfigmanagementPolicyController{
Enabled: dcl.Bool(p.GetEnabled()),
ReferentialRulesEnabled: dcl.Bool(p.GetReferentialRulesEnabled()),
LogDeniesEnabled: dcl.Bool(p.GetLogDeniesEnabled()),
MutationEnabled: dcl.Bool(p.GetMutationEnabled()),
PolicyControllerMonitoring: ProtoToGkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring(p.GetPolicyControllerMonitoring()),
TemplateLibraryInstalled: dcl.Bool(p.GetTemplateLibraryInstalled()),
AuditIntervalSeconds: dcl.StringOrNil(p.GetAuditIntervalSeconds()),
Enabled: dcl.Bool(p.GetEnabled()),
ReferentialRulesEnabled: dcl.Bool(p.GetReferentialRulesEnabled()),
LogDeniesEnabled: dcl.Bool(p.GetLogDeniesEnabled()),
TemplateLibraryInstalled: dcl.Bool(p.GetTemplateLibraryInstalled()),
AuditIntervalSeconds: dcl.StringOrNil(p.GetAuditIntervalSeconds()),
}
for _, r := range p.GetExemptableNamespaces() {
obj.ExemptableNamespaces = append(obj.ExemptableNamespaces, r)
}
return obj
}

// ProtoToFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring converts a FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring object from its proto representation.
func ProtoToGkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring(p *alphapb.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring) *alpha.FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring {
if p == nil {
return nil
}
obj := &alpha.FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring{}
for _, r := range p.GetBackends() {
obj.Backends = append(obj.Backends, *ProtoToGkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum(r))
}
return obj
}

// ProtoToFeatureMembershipConfigmanagementBinauthz converts a FeatureMembershipConfigmanagementBinauthz object from its proto representation.
func ProtoToGkehubAlphaFeatureMembershipConfigmanagementBinauthz(p *alphapb.GkehubAlphaFeatureMembershipConfigmanagementBinauthz) *alpha.FeatureMembershipConfigmanagementBinauthz {
if p == nil {
Expand Down Expand Up @@ -150,17 +124,6 @@ func ProtoToFeatureMembership(p *alphapb.GkehubAlphaFeatureMembership) *alpha.Fe
return obj
}

// FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnumToProto converts a FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum enum to its proto representation.
func GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnumToProto(e *alpha.FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum) alphapb.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum {
if e == nil {
return alphapb.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum(0)
}
if v, ok := alphapb.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum_value["FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum"+string(*e)]; ok {
return alphapb.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum(v)
}
return alphapb.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum(0)
}

// FeatureMembershipConfigmanagementToProto converts a FeatureMembershipConfigmanagement object to its proto representation.
func GkehubAlphaFeatureMembershipConfigmanagementToProto(o *alpha.FeatureMembershipConfigmanagement) *alphapb.GkehubAlphaFeatureMembershipConfigmanagement {
if o == nil {
Expand Down Expand Up @@ -213,8 +176,6 @@ func GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerToProto(o *alph
p.SetEnabled(dcl.ValueOrEmptyBool(o.Enabled))
p.SetReferentialRulesEnabled(dcl.ValueOrEmptyBool(o.ReferentialRulesEnabled))
p.SetLogDeniesEnabled(dcl.ValueOrEmptyBool(o.LogDeniesEnabled))
p.SetMutationEnabled(dcl.ValueOrEmptyBool(o.MutationEnabled))
p.SetPolicyControllerMonitoring(GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringToProto(o.PolicyControllerMonitoring))
p.SetTemplateLibraryInstalled(dcl.ValueOrEmptyBool(o.TemplateLibraryInstalled))
p.SetAuditIntervalSeconds(dcl.ValueOrEmptyString(o.AuditIntervalSeconds))
sExemptableNamespaces := make([]string, len(o.ExemptableNamespaces))
Expand All @@ -225,20 +186,6 @@ func GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerToProto(o *alph
return p
}

// FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringToProto converts a FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring object to its proto representation.
func GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringToProto(o *alpha.FeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring) *alphapb.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring {
if o == nil {
return nil
}
p := &alphapb.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoring{}
sBackends := make([]alphapb.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum, len(o.Backends))
for i, r := range o.Backends {
sBackends[i] = alphapb.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum(alphapb.GkehubAlphaFeatureMembershipConfigmanagementPolicyControllerPolicyControllerMonitoringBackendsEnum_value[string(r)])
}
p.SetBackends(sBackends)
return p
}

// FeatureMembershipConfigmanagementBinauthzToProto converts a FeatureMembershipConfigmanagementBinauthz object to its proto representation.
func GkehubAlphaFeatureMembershipConfigmanagementBinauthzToProto(o *alpha.FeatureMembershipConfigmanagementBinauthz) *alphapb.GkehubAlphaFeatureMembershipConfigmanagementBinauthz {
if o == nil {
Expand Down
Loading

0 comments on commit 3f92255

Please sign in to comment.