Skip to content

Commit

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

GitOrigin-RevId: dc5517d1c837c5e3a1ae9b367ca83997d0b7f595
  • Loading branch information
DCL Team authored and copybara-github committed Dec 20, 2022
1 parent b2d522d commit 2365f26
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
13 changes: 12 additions & 1 deletion services/google/osconfig/alpha/osconfig_ga_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,18 @@ func (op *updateOSPolicyAssignmentUpdateOSPolicyAssignmentOperation) do(ctx cont
if err != nil {
return err
}
mask := dcl.TopLevelUpdateMask(op.FieldDiffs)
diffs := make([]*dcl.FieldDiff, 0)
for _, d := range op.FieldDiffs {
// skipAwaitUpdate is a custom field not available in the API and should not be included in an update mask
if d.FieldName != "skipAwaitRollout" {
diffs = append(diffs, d)
}
}
if len(diffs) == 0 {
// Only diff was skipAwaitUpdate, return success
return nil
}
mask := dcl.TopLevelUpdateMask(diffs)
u, err = dcl.AddQueryParams(u, map[string]string{"updateMask": mask})
if err != nil {
return err
Expand Down
13 changes: 12 additions & 1 deletion services/google/osconfig/beta/osconfig_ga_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,18 @@ func (op *updateOSPolicyAssignmentUpdateOSPolicyAssignmentOperation) do(ctx cont
if err != nil {
return err
}
mask := dcl.TopLevelUpdateMask(op.FieldDiffs)
diffs := make([]*dcl.FieldDiff, 0)
for _, d := range op.FieldDiffs {
// skipAwaitUpdate is a custom field not available in the API and should not be included in an update mask
if d.FieldName != "skipAwaitRollout" {
diffs = append(diffs, d)
}
}
if len(diffs) == 0 {
// Only diff was skipAwaitUpdate, return success
return nil
}
mask := dcl.TopLevelUpdateMask(diffs)
u, err = dcl.AddQueryParams(u, map[string]string{"updateMask": mask})
if err != nil {
return err
Expand Down
13 changes: 12 additions & 1 deletion services/google/osconfig/osconfig_ga_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,18 @@ func (op *updateOSPolicyAssignmentUpdateOSPolicyAssignmentOperation) do(ctx cont
if err != nil {
return err
}
mask := dcl.TopLevelUpdateMask(op.FieldDiffs)
diffs := make([]*dcl.FieldDiff, 0)
for _, d := range op.FieldDiffs {
// skipAwaitUpdate is a custom field not available in the API and should not be included in an update mask
if d.FieldName != "skipAwaitRollout" {
diffs = append(diffs, d)
}
}
if len(diffs) == 0 {
// Only diff was skipAwaitUpdate, return success
return nil
}
mask := dcl.TopLevelUpdateMask(diffs)
u, err = dcl.AddQueryParams(u, map[string]string{"updateMask": mask})
if err != nil {
return err
Expand Down

0 comments on commit 2365f26

Please sign in to comment.