Skip to content

Commit

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

GitOrigin-RevId: 7ae521ea66d5626ce4084b1b9aa3aeb4835a6238
  • Loading branch information
DCL Team authored and copybara-github committed Jun 13, 2022
1 parent f6229bd commit 67c61f2
Show file tree
Hide file tree
Showing 27 changed files with 204 additions and 9 deletions.
1 change: 1 addition & 0 deletions python/proto/clouddeploy/alpha/delivery_pipeline.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ message ClouddeployAlphaDeliveryPipeline {
string etag = 10;
string project = 11;
string location = 12;
bool suspended = 13;
}

message ClouddeployAlphaDeliveryPipelineSerialPipeline {
Expand Down
1 change: 1 addition & 0 deletions python/proto/clouddeploy/beta/delivery_pipeline.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ message ClouddeployBetaDeliveryPipeline {
string etag = 10;
string project = 11;
string location = 12;
bool suspended = 13;
}

message ClouddeployBetaDeliveryPipelineSerialPipeline {
Expand Down
1 change: 1 addition & 0 deletions python/proto/clouddeploy/delivery_pipeline.proto
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ message ClouddeployDeliveryPipeline {
string etag = 10;
string project = 11;
string location = 12;
bool suspended = 13;
}

message ClouddeployDeliveryPipelineSerialPipeline {
Expand Down
11 changes: 11 additions & 0 deletions python/services/clouddeploy/alpha/delivery_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(
etag: str = None,
project: str = None,
location: str = None,
suspended: bool = None,
service_account_file: str = "",
):

Expand All @@ -48,6 +49,7 @@ def __init__(
self.serial_pipeline = serial_pipeline
self.project = project
self.location = location
self.suspended = suspended
self.service_account_file = service_account_file

def apply(self):
Expand Down Expand Up @@ -79,6 +81,9 @@ def apply(self):
if Primitive.to_proto(self.location):
request.resource.location = Primitive.to_proto(self.location)

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

request.service_account_file = self.service_account_file

response = stub.ApplyClouddeployAlphaDeliveryPipeline(request)
Expand All @@ -96,6 +101,7 @@ def apply(self):
self.etag = Primitive.from_proto(response.etag)
self.project = Primitive.from_proto(response.project)
self.location = Primitive.from_proto(response.location)
self.suspended = Primitive.from_proto(response.suspended)

def delete(self):
stub = delivery_pipeline_pb2_grpc.ClouddeployAlphaDeliveryPipelineServiceStub(
Expand Down Expand Up @@ -127,6 +133,9 @@ def delete(self):
if Primitive.to_proto(self.location):
request.resource.location = Primitive.to_proto(self.location)

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

response = stub.DeleteClouddeployAlphaDeliveryPipeline(request)

@classmethod
Expand Down Expand Up @@ -162,6 +171,8 @@ def to_proto(self):
resource.project = Primitive.to_proto(self.project)
if Primitive.to_proto(self.location):
resource.location = Primitive.to_proto(self.location)
if Primitive.to_proto(self.suspended):
resource.suspended = Primitive.to_proto(self.suspended)
return resource


Expand Down
2 changes: 2 additions & 0 deletions python/services/clouddeploy/alpha/delivery_pipeline_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func ProtoToDeliveryPipeline(p *alphapb.ClouddeployAlphaDeliveryPipeline) *alpha
Etag: dcl.StringOrNil(p.GetEtag()),
Project: dcl.StringOrNil(p.GetProject()),
Location: dcl.StringOrNil(p.GetLocation()),
Suspended: dcl.Bool(p.GetSuspended()),
}
return obj
}
Expand Down Expand Up @@ -186,6 +187,7 @@ func DeliveryPipelineToProto(resource *alpha.DeliveryPipeline) *alphapb.Clouddep
p.SetEtag(dcl.ValueOrEmptyString(resource.Etag))
p.SetProject(dcl.ValueOrEmptyString(resource.Project))
p.SetLocation(dcl.ValueOrEmptyString(resource.Location))
p.SetSuspended(dcl.ValueOrEmptyBool(resource.Suspended))
mAnnotations := make(map[string]string, len(resource.Annotations))
for k, r := range resource.Annotations {
mAnnotations[k] = r
Expand Down
11 changes: 11 additions & 0 deletions python/services/clouddeploy/beta/delivery_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(
etag: str = None,
project: str = None,
location: str = None,
suspended: bool = None,
service_account_file: str = "",
):

Expand All @@ -48,6 +49,7 @@ def __init__(
self.serial_pipeline = serial_pipeline
self.project = project
self.location = location
self.suspended = suspended
self.service_account_file = service_account_file

def apply(self):
Expand Down Expand Up @@ -79,6 +81,9 @@ def apply(self):
if Primitive.to_proto(self.location):
request.resource.location = Primitive.to_proto(self.location)

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

request.service_account_file = self.service_account_file

response = stub.ApplyClouddeployBetaDeliveryPipeline(request)
Expand All @@ -96,6 +101,7 @@ def apply(self):
self.etag = Primitive.from_proto(response.etag)
self.project = Primitive.from_proto(response.project)
self.location = Primitive.from_proto(response.location)
self.suspended = Primitive.from_proto(response.suspended)

def delete(self):
stub = delivery_pipeline_pb2_grpc.ClouddeployBetaDeliveryPipelineServiceStub(
Expand Down Expand Up @@ -127,6 +133,9 @@ def delete(self):
if Primitive.to_proto(self.location):
request.resource.location = Primitive.to_proto(self.location)

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

response = stub.DeleteClouddeployBetaDeliveryPipeline(request)

@classmethod
Expand Down Expand Up @@ -162,6 +171,8 @@ def to_proto(self):
resource.project = Primitive.to_proto(self.project)
if Primitive.to_proto(self.location):
resource.location = Primitive.to_proto(self.location)
if Primitive.to_proto(self.suspended):
resource.suspended = Primitive.to_proto(self.suspended)
return resource


Expand Down
2 changes: 2 additions & 0 deletions python/services/clouddeploy/beta/delivery_pipeline_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func ProtoToDeliveryPipeline(p *betapb.ClouddeployBetaDeliveryPipeline) *beta.De
Etag: dcl.StringOrNil(p.GetEtag()),
Project: dcl.StringOrNil(p.GetProject()),
Location: dcl.StringOrNil(p.GetLocation()),
Suspended: dcl.Bool(p.GetSuspended()),
}
return obj
}
Expand Down Expand Up @@ -186,6 +187,7 @@ func DeliveryPipelineToProto(resource *beta.DeliveryPipeline) *betapb.Clouddeplo
p.SetEtag(dcl.ValueOrEmptyString(resource.Etag))
p.SetProject(dcl.ValueOrEmptyString(resource.Project))
p.SetLocation(dcl.ValueOrEmptyString(resource.Location))
p.SetSuspended(dcl.ValueOrEmptyBool(resource.Suspended))
mAnnotations := make(map[string]string, len(resource.Annotations))
for k, r := range resource.Annotations {
mAnnotations[k] = r
Expand Down
11 changes: 11 additions & 0 deletions python/services/clouddeploy/delivery_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(
etag: str = None,
project: str = None,
location: str = None,
suspended: bool = None,
service_account_file: str = "",
):

Expand All @@ -48,6 +49,7 @@ def __init__(
self.serial_pipeline = serial_pipeline
self.project = project
self.location = location
self.suspended = suspended
self.service_account_file = service_account_file

def apply(self):
Expand Down Expand Up @@ -79,6 +81,9 @@ def apply(self):
if Primitive.to_proto(self.location):
request.resource.location = Primitive.to_proto(self.location)

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

request.service_account_file = self.service_account_file

response = stub.ApplyClouddeployDeliveryPipeline(request)
Expand All @@ -96,6 +101,7 @@ def apply(self):
self.etag = Primitive.from_proto(response.etag)
self.project = Primitive.from_proto(response.project)
self.location = Primitive.from_proto(response.location)
self.suspended = Primitive.from_proto(response.suspended)

def delete(self):
stub = delivery_pipeline_pb2_grpc.ClouddeployDeliveryPipelineServiceStub(
Expand Down Expand Up @@ -127,6 +133,9 @@ def delete(self):
if Primitive.to_proto(self.location):
request.resource.location = Primitive.to_proto(self.location)

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

response = stub.DeleteClouddeployDeliveryPipeline(request)

@classmethod
Expand Down Expand Up @@ -162,6 +171,8 @@ def to_proto(self):
resource.project = Primitive.to_proto(self.project)
if Primitive.to_proto(self.location):
resource.location = Primitive.to_proto(self.location)
if Primitive.to_proto(self.suspended):
resource.suspended = Primitive.to_proto(self.suspended)
return resource


Expand Down
2 changes: 2 additions & 0 deletions python/services/clouddeploy/delivery_pipeline_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ func ProtoToDeliveryPipeline(p *clouddeploypb.ClouddeployDeliveryPipeline) *clou
Etag: dcl.StringOrNil(p.GetEtag()),
Project: dcl.StringOrNil(p.GetProject()),
Location: dcl.StringOrNil(p.GetLocation()),
Suspended: dcl.Bool(p.GetSuspended()),
}
return obj
}
Expand Down Expand Up @@ -186,6 +187,7 @@ func DeliveryPipelineToProto(resource *clouddeploy.DeliveryPipeline) *clouddeplo
p.SetEtag(dcl.ValueOrEmptyString(resource.Etag))
p.SetProject(dcl.ValueOrEmptyString(resource.Project))
p.SetLocation(dcl.ValueOrEmptyString(resource.Location))
p.SetSuspended(dcl.ValueOrEmptyBool(resource.Suspended))
mAnnotations := make(map[string]string, len(resource.Annotations))
for k, r := range resource.Annotations {
mAnnotations[k] = r
Expand Down
2 changes: 2 additions & 0 deletions services/google/clouddeploy/alpha/delivery_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type DeliveryPipeline struct {
Etag *string `json:"etag"`
Project *string `json:"project"`
Location *string `json:"location"`
Suspended *bool `json:"suspended"`
}

func (r *DeliveryPipeline) String() string {
Expand Down Expand Up @@ -317,6 +318,7 @@ func (r *DeliveryPipeline) ID() (string, error) {
"etag": dcl.ValueOrEmptyString(nr.Etag),
"project": dcl.ValueOrEmptyString(nr.Project),
"location": dcl.ValueOrEmptyString(nr.Location),
"suspended": dcl.ValueOrEmptyString(nr.Suspended),
}
return dcl.Nprintf("projects/{{project}}/locations/{{location}}/deliveryPipelines/{{name}}", params), nil
}
Expand Down
5 changes: 5 additions & 0 deletions services/google/clouddeploy/alpha/delivery_pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ components:
example, this field would just be `my-target` (rather than `projects/project/locations/location/targets/my-target`).
The location of the `Target` is inferred to be the same as the
location of the `DeliveryPipeline` that contains this `Stage`.
suspended:
type: boolean
x-dcl-go-name: Suspended
description: When suspended, no new releases or rollouts can be created,
but in-progress ones will complete.
uid:
type: string
x-dcl-go-name: Uid
Expand Down

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions services/google/clouddeploy/alpha/delivery_pipeline_internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ func newUpdateDeliveryPipelineUpdateDeliveryPipelineRequest(ctx context.Context,
} else if !dcl.IsEmptyValueIndirect(v) {
req["condition"] = v
}
if v := f.Suspended; !dcl.IsEmptyValueIndirect(v) {
req["suspended"] = v
}
b, err := c.getDeliveryPipelineRaw(ctx, f)
if err != nil {
return nil, err
Expand Down Expand Up @@ -563,6 +566,11 @@ func canonicalizeDeliveryPipelineDesiredState(rawDesired, rawInitial *DeliveryPi
} else {
canonicalDesired.Location = rawDesired.Location
}
if dcl.BoolCanonicalize(rawDesired.Suspended, rawInitial.Suspended) {
canonicalDesired.Suspended = rawInitial.Suspended
} else {
canonicalDesired.Suspended = rawDesired.Suspended
}

return canonicalDesired, nil
}
Expand Down Expand Up @@ -657,6 +665,16 @@ func canonicalizeDeliveryPipelineNewState(c *Client, rawNew, rawDesired *Deliver

rawNew.Location = rawDesired.Location

if dcl.IsNotReturnedByServer(rawNew.Suspended) && dcl.IsNotReturnedByServer(rawDesired.Suspended) {
if rawDesired.Suspended != nil {
rawNew.Suspended = rawDesired.Suspended
}
} else {
if dcl.BoolCanonicalize(rawDesired.Suspended, rawNew.Suspended) {
rawNew.Suspended = rawDesired.Suspended
}
}

return rawNew, nil
}

Expand Down Expand Up @@ -1355,6 +1373,13 @@ func diffDeliveryPipeline(c *Client, desired, actual *DeliveryPipeline, opts ...
newDiffs = append(newDiffs, ds...)
}

if ds, err := dcl.Diff(desired.Suspended, actual.Suspended, dcl.DiffInfo{OperationSelector: dcl.TriggersOperation("updateDeliveryPipelineUpdateDeliveryPipelineOperation")}, fn.AddNest("Suspended")); len(ds) != 0 || err != nil {
if err != nil {
return nil, err
}
newDiffs = append(newDiffs, ds...)
}

return newDiffs, nil
}
func compareDeliveryPipelineSerialPipelineNewStyle(d, a interface{}, fn dcl.FieldName) ([]*dcl.FieldDiff, error) {
Expand Down Expand Up @@ -1630,6 +1655,9 @@ func expandDeliveryPipeline(c *Client, f *DeliveryPipeline) (map[string]interfac
} else if !dcl.IsEmptyValueIndirect(v) {
m["location"] = v
}
if v := f.Suspended; dcl.ValueShouldBeSent(v) {
m["suspended"] = v
}

return m, nil
}
Expand Down Expand Up @@ -1658,6 +1686,7 @@ func flattenDeliveryPipeline(c *Client, i interface{}, res *DeliveryPipeline) *D
resultRes.Etag = dcl.FlattenString(m["etag"])
resultRes.Project = dcl.FlattenString(m["project"])
resultRes.Location = dcl.FlattenString(m["location"])
resultRes.Suspended = dcl.FlattenBool(m["suspended"])

return resultRes
}
Expand Down
5 changes: 5 additions & 0 deletions services/google/clouddeploy/alpha/delivery_pipeline_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@ func DCLDeliveryPipelineSchema() *dcl.Schema {
},
},
},
"suspended": &dcl.Property{
Type: "boolean",
GoName: "Suspended",
Description: "When suspended, no new releases or rollouts can be created, but in-progress ones will complete.",
},
"uid": &dcl.Property{
Type: "string",
GoName: "Uid",
Expand Down
2 changes: 2 additions & 0 deletions services/google/clouddeploy/beta/delivery_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type DeliveryPipeline struct {
Etag *string `json:"etag"`
Project *string `json:"project"`
Location *string `json:"location"`
Suspended *bool `json:"suspended"`
}

func (r *DeliveryPipeline) String() string {
Expand Down Expand Up @@ -317,6 +318,7 @@ func (r *DeliveryPipeline) ID() (string, error) {
"etag": dcl.ValueOrEmptyString(nr.Etag),
"project": dcl.ValueOrEmptyString(nr.Project),
"location": dcl.ValueOrEmptyString(nr.Location),
"suspended": dcl.ValueOrEmptyString(nr.Suspended),
}
return dcl.Nprintf("projects/{{project}}/locations/{{location}}/deliveryPipelines/{{name}}", params), nil
}
Expand Down
5 changes: 5 additions & 0 deletions services/google/clouddeploy/beta/delivery_pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,11 @@ components:
example, this field would just be `my-target` (rather than `projects/project/locations/location/targets/my-target`).
The location of the `Target` is inferred to be the same as the
location of the `DeliveryPipeline` that contains this `Stage`.
suspended:
type: boolean
x-dcl-go-name: Suspended
description: When suspended, no new releases or rollouts can be created,
but in-progress ones will complete.
uid:
type: string
x-dcl-go-name: Uid
Expand Down
Loading

0 comments on commit 67c61f2

Please sign in to comment.