Skip to content

Commit

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

GitOrigin-RevId: 67ea91c61be67f2af3b1ecddd61ce1d357c648da
  • Loading branch information
DCL Team authored and copybara-github committed Feb 6, 2024
1 parent 37bbb40 commit a0e375a
Show file tree
Hide file tree
Showing 59 changed files with 3,297 additions and 106 deletions.
10 changes: 10 additions & 0 deletions python/proto/eventarc/alpha/trigger.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ message EventarcAlphaTriggerDestination {
string cloud_function = 2;
EventarcAlphaTriggerDestinationGke gke = 3;
string workflow = 4;
EventarcAlphaTriggerDestinationHttpEndpoint http_endpoint = 5;
EventarcAlphaTriggerDestinationNetworkConfig network_config = 6;
}

message EventarcAlphaTriggerDestinationCloudRunService {
Expand All @@ -66,6 +68,14 @@ message EventarcAlphaTriggerDestinationGke {
string path = 5;
}

message EventarcAlphaTriggerDestinationHttpEndpoint {
string uri = 1;
}

message EventarcAlphaTriggerDestinationNetworkConfig {
string network_attachment = 1;
}

message EventarcAlphaTriggerTransport {
EventarcAlphaTriggerTransportPubsub pubsub = 1;
}
Expand Down
10 changes: 10 additions & 0 deletions python/proto/eventarc/beta/trigger.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ message EventarcBetaTriggerDestination {
string cloud_function = 2;
EventarcBetaTriggerDestinationGke gke = 3;
string workflow = 4;
EventarcBetaTriggerDestinationHttpEndpoint http_endpoint = 5;
EventarcBetaTriggerDestinationNetworkConfig network_config = 6;
}

message EventarcBetaTriggerDestinationCloudRunService {
Expand All @@ -66,6 +68,14 @@ message EventarcBetaTriggerDestinationGke {
string path = 5;
}

message EventarcBetaTriggerDestinationHttpEndpoint {
string uri = 1;
}

message EventarcBetaTriggerDestinationNetworkConfig {
string network_attachment = 1;
}

message EventarcBetaTriggerTransport {
EventarcBetaTriggerTransportPubsub pubsub = 1;
}
Expand Down
10 changes: 10 additions & 0 deletions python/proto/eventarc/trigger.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ message EventarcTriggerDestination {
string cloud_function = 2;
EventarcTriggerDestinationGke gke = 3;
string workflow = 4;
EventarcTriggerDestinationHttpEndpoint http_endpoint = 5;
EventarcTriggerDestinationNetworkConfig network_config = 6;
}

message EventarcTriggerDestinationCloudRunService {
Expand All @@ -66,6 +68,14 @@ message EventarcTriggerDestinationGke {
string path = 5;
}

message EventarcTriggerDestinationHttpEndpoint {
string uri = 1;
}

message EventarcTriggerDestinationNetworkConfig {
string network_attachment = 1;
}

message EventarcTriggerTransport {
EventarcTriggerTransportPubsub pubsub = 1;
}
Expand Down
1 change: 1 addition & 0 deletions python/proto/logging/alpha/log_bucket.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ message LoggingAlphaLogBucket {
LoggingAlphaLogBucketLifecycleStateEnum lifecycle_state = 7;
string parent = 8;
string location = 9;
bool enable_analytics = 10;
}

message ApplyLoggingAlphaLogBucketRequest {
Expand Down
1 change: 1 addition & 0 deletions python/proto/logging/beta/log_bucket.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ message LoggingBetaLogBucket {
LoggingBetaLogBucketLifecycleStateEnum lifecycle_state = 7;
string parent = 8;
string location = 9;
bool enable_analytics = 10;
}

message ApplyLoggingBetaLogBucketRequest {
Expand Down
1 change: 1 addition & 0 deletions python/proto/logging/log_bucket.proto
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ message LoggingLogBucket {
LoggingLogBucketLifecycleStateEnum lifecycle_state = 7;
string parent = 8;
string location = 9;
bool enable_analytics = 10;
}

message ApplyLoggingLogBucketRequest {
Expand Down
94 changes: 94 additions & 0 deletions python/services/eventarc/alpha/trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,15 @@ def __init__(
cloud_function: str = None,
gke: dict = None,
workflow: str = None,
http_endpoint: dict = None,
network_config: dict = None,
):
self.cloud_run_service = cloud_run_service
self.cloud_function = cloud_function
self.gke = gke
self.workflow = workflow
self.http_endpoint = http_endpoint
self.network_config = network_config

@classmethod
def to_proto(self, resource):
Expand All @@ -282,6 +286,18 @@ def to_proto(self, resource):
res.ClearField("gke")
if Primitive.to_proto(resource.workflow):
res.workflow = Primitive.to_proto(resource.workflow)
if TriggerDestinationHttpEndpoint.to_proto(resource.http_endpoint):
res.http_endpoint.CopyFrom(
TriggerDestinationHttpEndpoint.to_proto(resource.http_endpoint)
)
else:
res.ClearField("http_endpoint")
if TriggerDestinationNetworkConfig.to_proto(resource.network_config):
res.network_config.CopyFrom(
TriggerDestinationNetworkConfig.to_proto(resource.network_config)
)
else:
res.ClearField("network_config")
return res

@classmethod
Expand All @@ -296,6 +312,12 @@ def from_proto(self, resource):
cloud_function=Primitive.from_proto(resource.cloud_function),
gke=TriggerDestinationGke.from_proto(resource.gke),
workflow=Primitive.from_proto(resource.workflow),
http_endpoint=TriggerDestinationHttpEndpoint.from_proto(
resource.http_endpoint
),
network_config=TriggerDestinationNetworkConfig.from_proto(
resource.network_config
),
)


Expand Down Expand Up @@ -414,6 +436,78 @@ def from_proto(self, resources):
return [TriggerDestinationGke.from_proto(i) for i in resources]


class TriggerDestinationHttpEndpoint(object):
def __init__(self, uri: str = None):
self.uri = uri

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

res = trigger_pb2.EventarcAlphaTriggerDestinationHttpEndpoint()
if Primitive.to_proto(resource.uri):
res.uri = Primitive.to_proto(resource.uri)
return res

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

return TriggerDestinationHttpEndpoint(
uri=Primitive.from_proto(resource.uri),
)


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

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


class TriggerDestinationNetworkConfig(object):
def __init__(self, network_attachment: str = None):
self.network_attachment = network_attachment

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

res = trigger_pb2.EventarcAlphaTriggerDestinationNetworkConfig()
if Primitive.to_proto(resource.network_attachment):
res.network_attachment = Primitive.to_proto(resource.network_attachment)
return res

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

return TriggerDestinationNetworkConfig(
network_attachment=Primitive.from_proto(resource.network_attachment),
)


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

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


class TriggerTransport(object):
def __init__(self, pubsub: dict = None):
self.pubsub = pubsub
Expand Down
46 changes: 46 additions & 0 deletions python/services/eventarc/alpha/trigger_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ func ProtoToEventarcAlphaTriggerDestination(p *alphapb.EventarcAlphaTriggerDesti
CloudFunction: dcl.StringOrNil(p.GetCloudFunction()),
Gke: ProtoToEventarcAlphaTriggerDestinationGke(p.GetGke()),
Workflow: dcl.StringOrNil(p.GetWorkflow()),
HttpEndpoint: ProtoToEventarcAlphaTriggerDestinationHttpEndpoint(p.GetHttpEndpoint()),
NetworkConfig: ProtoToEventarcAlphaTriggerDestinationNetworkConfig(p.GetNetworkConfig()),
}
return obj
}
Expand Down Expand Up @@ -79,6 +81,28 @@ func ProtoToEventarcAlphaTriggerDestinationGke(p *alphapb.EventarcAlphaTriggerDe
return obj
}

// ProtoToTriggerDestinationHttpEndpoint converts a TriggerDestinationHttpEndpoint object from its proto representation.
func ProtoToEventarcAlphaTriggerDestinationHttpEndpoint(p *alphapb.EventarcAlphaTriggerDestinationHttpEndpoint) *alpha.TriggerDestinationHttpEndpoint {
if p == nil {
return nil
}
obj := &alpha.TriggerDestinationHttpEndpoint{
Uri: dcl.StringOrNil(p.GetUri()),
}
return obj
}

// ProtoToTriggerDestinationNetworkConfig converts a TriggerDestinationNetworkConfig object from its proto representation.
func ProtoToEventarcAlphaTriggerDestinationNetworkConfig(p *alphapb.EventarcAlphaTriggerDestinationNetworkConfig) *alpha.TriggerDestinationNetworkConfig {
if p == nil {
return nil
}
obj := &alpha.TriggerDestinationNetworkConfig{
NetworkAttachment: dcl.StringOrNil(p.GetNetworkAttachment()),
}
return obj
}

// ProtoToTriggerTransport converts a TriggerTransport object from its proto representation.
func ProtoToEventarcAlphaTriggerTransport(p *alphapb.EventarcAlphaTriggerTransport) *alpha.TriggerTransport {
if p == nil {
Expand Down Expand Up @@ -146,6 +170,8 @@ func EventarcAlphaTriggerDestinationToProto(o *alpha.TriggerDestination) *alphap
p.SetCloudFunction(dcl.ValueOrEmptyString(o.CloudFunction))
p.SetGke(EventarcAlphaTriggerDestinationGkeToProto(o.Gke))
p.SetWorkflow(dcl.ValueOrEmptyString(o.Workflow))
p.SetHttpEndpoint(EventarcAlphaTriggerDestinationHttpEndpointToProto(o.HttpEndpoint))
p.SetNetworkConfig(EventarcAlphaTriggerDestinationNetworkConfigToProto(o.NetworkConfig))
return p
}

Expand Down Expand Up @@ -175,6 +201,26 @@ func EventarcAlphaTriggerDestinationGkeToProto(o *alpha.TriggerDestinationGke) *
return p
}

// TriggerDestinationHttpEndpointToProto converts a TriggerDestinationHttpEndpoint object to its proto representation.
func EventarcAlphaTriggerDestinationHttpEndpointToProto(o *alpha.TriggerDestinationHttpEndpoint) *alphapb.EventarcAlphaTriggerDestinationHttpEndpoint {
if o == nil {
return nil
}
p := &alphapb.EventarcAlphaTriggerDestinationHttpEndpoint{}
p.SetUri(dcl.ValueOrEmptyString(o.Uri))
return p
}

// TriggerDestinationNetworkConfigToProto converts a TriggerDestinationNetworkConfig object to its proto representation.
func EventarcAlphaTriggerDestinationNetworkConfigToProto(o *alpha.TriggerDestinationNetworkConfig) *alphapb.EventarcAlphaTriggerDestinationNetworkConfig {
if o == nil {
return nil
}
p := &alphapb.EventarcAlphaTriggerDestinationNetworkConfig{}
p.SetNetworkAttachment(dcl.ValueOrEmptyString(o.NetworkAttachment))
return p
}

// TriggerTransportToProto converts a TriggerTransport object to its proto representation.
func EventarcAlphaTriggerTransportToProto(o *alpha.TriggerTransport) *alphapb.EventarcAlphaTriggerTransport {
if o == nil {
Expand Down
Loading

0 comments on commit a0e375a

Please sign in to comment.