From 2365f266f4cc823384cb5139f12500fc6c845434 Mon Sep 17 00:00:00 2001 From: DCL Team Date: Tue, 20 Dec 2022 12:44:36 -0800 Subject: [PATCH] Automated DCL import. - dc5517d1c837c5e3a1ae9b367ca83997d0b7f595 Automatic import from cloud_mmv2_dcl_20221220_1231_RC00 by DCL Team GitOrigin-RevId: dc5517d1c837c5e3a1ae9b367ca83997d0b7f595 --- services/google/osconfig/alpha/osconfig_ga_utils.go | 13 ++++++++++++- services/google/osconfig/beta/osconfig_ga_utils.go | 13 ++++++++++++- services/google/osconfig/osconfig_ga_utils.go | 13 ++++++++++++- 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/services/google/osconfig/alpha/osconfig_ga_utils.go b/services/google/osconfig/alpha/osconfig_ga_utils.go index 2001b34037..37e810d353 100755 --- a/services/google/osconfig/alpha/osconfig_ga_utils.go +++ b/services/google/osconfig/alpha/osconfig_ga_utils.go @@ -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 diff --git a/services/google/osconfig/beta/osconfig_ga_utils.go b/services/google/osconfig/beta/osconfig_ga_utils.go index fe4b99deb8..435ec08f49 100755 --- a/services/google/osconfig/beta/osconfig_ga_utils.go +++ b/services/google/osconfig/beta/osconfig_ga_utils.go @@ -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 diff --git a/services/google/osconfig/osconfig_ga_utils.go b/services/google/osconfig/osconfig_ga_utils.go index f96436ee46..48f1128d9b 100755 --- a/services/google/osconfig/osconfig_ga_utils.go +++ b/services/google/osconfig/osconfig_ga_utils.go @@ -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