From c8b2083cb3c58346ad7ad601941c8e5f560b487c Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 5 Dec 2024 12:48:16 -0500 Subject: [PATCH 1/2] api: Rerun API generation with autorest 3.10.3 No API changes, just re-running "make generate". You may notice some of the indentation and other stylistic changes in the generated code are non-sensical but that's just the tool. --- .../generated/client_factory.go | 13 +- .../v20240610preview/generated/constants.go | 41 +- .../fake/hcpclusterversions_server.go | 42 +- .../fake/hcpopenshiftclusters_server.go | 196 +++++----- .../generated/fake/internal.go | 8 +- .../generated/fake/nodepools_server.go | 210 +++++----- .../generated/fake/operations_server.go | 18 +- .../generated/fake/server_factory.go | 29 +- .../generated/fake/time_rfc3339.go | 12 +- .../generated/hcpclusterversions_client.go | 20 +- .../generated/hcpopenshiftclusters_client.go | 40 +- .../api/v20240610preview/generated/models.go | 53 +-- .../generated/models_serde.go | 370 +++++++++--------- .../generated/nodepools_client.go | 34 +- .../generated/operations_client.go | 14 +- .../api/v20240610preview/generated/options.go | 3 +- .../v20240610preview/generated/responses.go | 3 +- .../generated/time_rfc3339.go | 12 +- 18 files changed, 563 insertions(+), 555 deletions(-) diff --git a/internal/api/v20240610preview/generated/client_factory.go b/internal/api/v20240610preview/generated/client_factory.go index d18146791..69184a2f6 100644 --- a/internal/api/v20240610preview/generated/client_factory.go +++ b/internal/api/v20240610preview/generated/client_factory.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -16,7 +16,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - internal *arm.Client + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -31,7 +31,7 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, } return &ClientFactory{ subscriptionID: subscriptionID, - internal: internal, + internal: internal, }, nil } @@ -39,7 +39,7 @@ func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, func (c *ClientFactory) NewHcpClusterVersionsClient() *HcpClusterVersionsClient { return &HcpClusterVersionsClient{ subscriptionID: c.subscriptionID, - internal: c.internal, + internal: c.internal, } } @@ -47,7 +47,7 @@ func (c *ClientFactory) NewHcpClusterVersionsClient() *HcpClusterVersionsClient func (c *ClientFactory) NewHcpOpenShiftClustersClient() *HcpOpenShiftClustersClient { return &HcpOpenShiftClustersClient{ subscriptionID: c.subscriptionID, - internal: c.internal, + internal: c.internal, } } @@ -55,7 +55,7 @@ func (c *ClientFactory) NewHcpOpenShiftClustersClient() *HcpOpenShiftClustersCli func (c *ClientFactory) NewNodePoolsClient() *NodePoolsClient { return &NodePoolsClient{ subscriptionID: c.subscriptionID, - internal: c.internal, + internal: c.internal, } } @@ -65,3 +65,4 @@ func (c *ClientFactory) NewOperationsClient() *OperationsClient { internal: c.internal, } } + diff --git a/internal/api/v20240610preview/generated/constants.go b/internal/api/v20240610preview/generated/constants.go index ea58e12cb..c3af8c49c 100644 --- a/internal/api/v20240610preview/generated/constants.go +++ b/internal/api/v20240610preview/generated/constants.go @@ -1,14 +1,14 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. package generated const ( - moduleName = "undefined" + moduleName = "undefined" moduleVersion = "v0.0.1" ) @@ -21,7 +21,7 @@ const ( // PossibleActionTypeValues returns the possible values for the ActionType const type. func PossibleActionTypeValues() []ActionType { - return []ActionType{ + return []ActionType{ ActionTypeInternal, } } @@ -30,15 +30,15 @@ func PossibleActionTypeValues() []ActionType { type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. func PossibleCreatedByTypeValues() []CreatedByType { - return []CreatedByType{ + return []CreatedByType{ CreatedByTypeApplication, CreatedByTypeKey, CreatedByTypeManagedIdentity, @@ -60,7 +60,7 @@ const ( // PossibleEffectValues returns the possible values for the Effect const type. func PossibleEffectValues() []Effect { - return []Effect{ + return []Effect{ EffectNoExecute, EffectNoSchedule, EffectPreferNoSchedule, @@ -71,15 +71,15 @@ func PossibleEffectValues() []Effect { type ManagedServiceIdentityType string const ( - ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" - ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" - ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" ) // PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { - return []ManagedServiceIdentityType{ + return []ManagedServiceIdentityType{ ManagedServiceIdentityTypeNone, ManagedServiceIdentityTypeSystemAssigned, ManagedServiceIdentityTypeSystemAssignedUserAssigned, @@ -99,7 +99,7 @@ const ( // PossibleNetworkTypeValues returns the possible values for the NetworkType const type. func PossibleNetworkTypeValues() []NetworkType { - return []NetworkType{ + return []NetworkType{ NetworkTypeOVNKubernetes, NetworkTypeOther, } @@ -110,14 +110,14 @@ func PossibleNetworkTypeValues() []NetworkType { type Origin string const ( - OriginSystem Origin = "system" - OriginUser Origin = "user" + OriginSystem Origin = "system" + OriginUser Origin = "user" OriginUserSystem Origin = "user,system" ) // PossibleOriginValues returns the possible values for the Origin const type. func PossibleOriginValues() []Origin { - return []Origin{ + return []Origin{ OriginSystem, OriginUser, OriginUserSystem, @@ -134,7 +134,7 @@ const ( // PossibleOutboundTypeValues returns the possible values for the OutboundType const type. func PossibleOutboundTypeValues() []OutboundType { - return []OutboundType{ + return []OutboundType{ OutboundTypeLoadBalancer, } } @@ -161,7 +161,7 @@ const ( // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. func PossibleProvisioningStateValues() []ProvisioningState { - return []ProvisioningState{ + return []ProvisioningState{ ProvisioningStateAccepted, ProvisioningStateCanceled, ProvisioningStateDeleting, @@ -186,7 +186,7 @@ const ( // PossibleResourceProvisioningStateValues returns the possible values for the ResourceProvisioningState const type. func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { - return []ResourceProvisioningState{ + return []ResourceProvisioningState{ ResourceProvisioningStateCanceled, ResourceProvisioningStateFailed, ResourceProvisioningStateSucceeded, @@ -205,8 +205,9 @@ const ( // PossibleVisibilityValues returns the possible values for the Visibility const type. func PossibleVisibilityValues() []Visibility { - return []Visibility{ + return []Visibility{ VisibilityPrivate, VisibilityPublic, } } + diff --git a/internal/api/v20240610preview/generated/fake/hcpclusterversions_server.go b/internal/api/v20240610preview/generated/fake/hcpclusterversions_server.go index b6dc49fd4..bc708efab 100644 --- a/internal/api/v20240610preview/generated/fake/hcpclusterversions_server.go +++ b/internal/api/v20240610preview/generated/fake/hcpclusterversions_server.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -10,23 +10,22 @@ package fake import ( "errors" "fmt" - "net/http" - "net/url" - "regexp" - + "github.com/Azure/ARO-HCP/internal/api/v20240610preview/generated" azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - - "github.com/Azure/ARO-HCP/internal/api/v20240610preview/generated" + "net/http" + "net/url" + "regexp" ) // HcpClusterVersionsServer is a fake server for instances of the generated.HcpClusterVersionsClient type. -type HcpClusterVersionsServer struct { +type HcpClusterVersionsServer struct{ // NewListPager is the fake for method HcpClusterVersionsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(location string, options *generated.HcpClusterVersionsClientListOptions) (resp azfake.PagerResponder[generated.HcpClusterVersionsClientListResponse]) + } // NewHcpClusterVersionsServerTransport creates a new instance of HcpClusterVersionsServerTransport with the provided implementation. @@ -34,7 +33,7 @@ type HcpClusterVersionsServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewHcpClusterVersionsServerTransport(srv *HcpClusterVersionsServer) *HcpClusterVersionsServerTransport { return &HcpClusterVersionsServerTransport{ - srv: srv, + srv: srv, newListPager: newTracker[azfake.PagerResponder[generated.HcpClusterVersionsClientListResponse]](), } } @@ -42,7 +41,7 @@ func NewHcpClusterVersionsServerTransport(srv *HcpClusterVersionsServer) *HcpClu // HcpClusterVersionsServerTransport connects instances of generated.HcpClusterVersionsClient to instances of HcpClusterVersionsServer. // Don't use this type directly, use NewHcpClusterVersionsServerTransport instead. type HcpClusterVersionsServerTransport struct { - srv *HcpClusterVersionsServer + srv *HcpClusterVersionsServer newListPager *tracker[azfake.PagerResponder[generated.HcpClusterVersionsClientListResponse]] } @@ -77,17 +76,17 @@ func (h *HcpClusterVersionsServerTransport) dispatchNewListPager(req *http.Reque } newListPager := h.newListPager.get(req) if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftVersions` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - resp := h.srv.NewListPager(locationParam, nil) + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftVersions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } +resp := h.srv.NewListPager(locationParam, nil) newListPager = &resp h.newListPager.add(req, newListPager) server.PagerResponderInjectNextLinks(newListPager, req, func(page *generated.HcpClusterVersionsClientListResponse, createLink func() string) { @@ -107,3 +106,4 @@ func (h *HcpClusterVersionsServerTransport) dispatchNewListPager(req *http.Reque } return resp, nil } + diff --git a/internal/api/v20240610preview/generated/fake/hcpopenshiftclusters_server.go b/internal/api/v20240610preview/generated/fake/hcpopenshiftclusters_server.go index 4e60df8cb..e8e6e6c15 100644 --- a/internal/api/v20240610preview/generated/fake/hcpopenshiftclusters_server.go +++ b/internal/api/v20240610preview/generated/fake/hcpopenshiftclusters_server.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -11,20 +11,18 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - + "github.com/Azure/ARO-HCP/internal/api/v20240610preview/generated" azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - - "github.com/Azure/ARO-HCP/internal/api/v20240610preview/generated" + "net/http" + "net/url" + "regexp" ) // HcpOpenShiftClustersServer is a fake server for instances of the generated.HcpOpenShiftClustersClient type. -type HcpOpenShiftClustersServer struct { +type HcpOpenShiftClustersServer struct{ // AdminCredentials is the fake for method HcpOpenShiftClustersClient.AdminCredentials // HTTP status codes to indicate success: http.StatusOK AdminCredentials func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, options *generated.HcpOpenShiftClustersClientAdminCredentialsOptions) (resp azfake.Responder[generated.HcpOpenShiftClustersClientAdminCredentialsResponse], errResp azfake.ErrorResponder) @@ -56,6 +54,7 @@ type HcpOpenShiftClustersServer struct { // BeginUpdate is the fake for method HcpOpenShiftClustersClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginUpdate func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, properties generated.HcpOpenShiftClusterPatch, options *generated.HcpOpenShiftClustersClientBeginUpdateOptions) (resp azfake.PollerResponder[generated.HcpOpenShiftClustersClientUpdateResponse], errResp azfake.ErrorResponder) + } // NewHcpOpenShiftClustersServerTransport creates a new instance of HcpOpenShiftClustersServerTransport with the provided implementation. @@ -63,24 +62,24 @@ type HcpOpenShiftClustersServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewHcpOpenShiftClustersServerTransport(srv *HcpOpenShiftClustersServer) *HcpOpenShiftClustersServerTransport { return &HcpOpenShiftClustersServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[generated.HcpOpenShiftClustersClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[generated.HcpOpenShiftClustersClientDeleteResponse]](), + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[generated.HcpOpenShiftClustersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[generated.HcpOpenShiftClustersClientDeleteResponse]](), newListByResourceGroupPager: newTracker[azfake.PagerResponder[generated.HcpOpenShiftClustersClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[generated.HcpOpenShiftClustersClientListBySubscriptionResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[generated.HcpOpenShiftClustersClientUpdateResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[generated.HcpOpenShiftClustersClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[generated.HcpOpenShiftClustersClientUpdateResponse]](), } } // HcpOpenShiftClustersServerTransport connects instances of generated.HcpOpenShiftClustersClient to instances of HcpOpenShiftClustersServer. // Don't use this type directly, use NewHcpOpenShiftClustersServerTransport instead. type HcpOpenShiftClustersServerTransport struct { - srv *HcpOpenShiftClustersServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[generated.HcpOpenShiftClustersClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[generated.HcpOpenShiftClustersClientDeleteResponse]] + srv *HcpOpenShiftClustersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[generated.HcpOpenShiftClustersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[generated.HcpOpenShiftClustersClientDeleteResponse]] newListByResourceGroupPager *tracker[azfake.PagerResponder[generated.HcpOpenShiftClustersClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[generated.HcpOpenShiftClustersClientListBySubscriptionResponse]] - beginUpdate *tracker[azfake.PollerResponder[generated.HcpOpenShiftClustersClientUpdateResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[generated.HcpOpenShiftClustersClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[generated.HcpOpenShiftClustersClientUpdateResponse]] } // Do implements the policy.Transporter interface for HcpOpenShiftClustersServerTransport. @@ -161,28 +160,28 @@ func (h *HcpOpenShiftClustersServerTransport) dispatchBeginCreateOrUpdate(req *h } beginCreateOrUpdate := h.beginCreateOrUpdate.get(req) if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[generated.HcpOpenShiftClusterResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) - if err != nil { - return nil, err - } - respr, errRespr := h.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, hcpOpenShiftClusterNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[generated.HcpOpenShiftClusterResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, hcpOpenShiftClusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } beginCreateOrUpdate = &respr h.beginCreateOrUpdate.add(req, beginCreateOrUpdate) } @@ -209,24 +208,24 @@ func (h *HcpOpenShiftClustersServerTransport) dispatchBeginDelete(req *http.Requ } beginDelete := h.beginDelete.get(req) if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) - if err != nil { - return nil, err - } - respr, errRespr := h.srv.BeginDelete(req.Context(), resourceGroupNameParam, hcpOpenShiftClusterNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginDelete(req.Context(), resourceGroupNameParam, hcpOpenShiftClusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } beginDelete = &respr h.beginDelete.add(req, beginDelete) } @@ -319,17 +318,17 @@ func (h *HcpOpenShiftClustersServerTransport) dispatchNewListByResourceGroupPage } newListByResourceGroupPager := h.newListByResourceGroupPager.get(req) if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := h.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } +resp := h.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) newListByResourceGroupPager = &resp h.newListByResourceGroupPager.add(req, newListByResourceGroupPager) server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *generated.HcpOpenShiftClustersClientListByResourceGroupResponse, createLink func() string) { @@ -356,13 +355,13 @@ func (h *HcpOpenShiftClustersServerTransport) dispatchNewListBySubscriptionPager } newListBySubscriptionPager := h.newListBySubscriptionPager.get(req) if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := h.srv.NewListBySubscriptionPager(nil) + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } +resp := h.srv.NewListBySubscriptionPager(nil) newListBySubscriptionPager = &resp h.newListBySubscriptionPager.add(req, newListBySubscriptionPager) server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *generated.HcpOpenShiftClustersClientListBySubscriptionResponse, createLink func() string) { @@ -389,28 +388,28 @@ func (h *HcpOpenShiftClustersServerTransport) dispatchBeginUpdate(req *http.Requ } beginUpdate := h.beginUpdate.get(req) if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[generated.HcpOpenShiftClusterPatch](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) - if err != nil { - return nil, err - } - respr, errRespr := h.srv.BeginUpdate(req.Context(), resourceGroupNameParam, hcpOpenShiftClusterNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[generated.HcpOpenShiftClusterPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginUpdate(req.Context(), resourceGroupNameParam, hcpOpenShiftClusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } beginUpdate = &respr h.beginUpdate.add(req, beginUpdate) } @@ -430,3 +429,4 @@ func (h *HcpOpenShiftClustersServerTransport) dispatchBeginUpdate(req *http.Requ return resp, nil } + diff --git a/internal/api/v20240610preview/generated/fake/internal.go b/internal/api/v20240610preview/generated/fake/internal.go index 20d9a0b32..1b914a3c8 100644 --- a/internal/api/v20240610preview/generated/fake/internal.go +++ b/internal/api/v20240610preview/generated/fake/internal.go @@ -1,19 +1,19 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. package fake import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "net/http" "sync" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" ) + type nonRetriableError struct { error } @@ -39,7 +39,7 @@ func newTracker[T any]() *tracker[T] { type tracker[T any] struct { items map[string]*T - mu sync.Mutex + mu sync.Mutex } func (p *tracker[T]) get(req *http.Request) *T { diff --git a/internal/api/v20240610preview/generated/fake/nodepools_server.go b/internal/api/v20240610preview/generated/fake/nodepools_server.go index fa9df3d04..22cf05f07 100644 --- a/internal/api/v20240610preview/generated/fake/nodepools_server.go +++ b/internal/api/v20240610preview/generated/fake/nodepools_server.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -11,20 +11,18 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "regexp" - + "github.com/Azure/ARO-HCP/internal/api/v20240610preview/generated" azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - - "github.com/Azure/ARO-HCP/internal/api/v20240610preview/generated" + "net/http" + "net/url" + "regexp" ) // NodePoolsServer is a fake server for instances of the generated.NodePoolsClient type. -type NodePoolsServer struct { +type NodePoolsServer struct{ // BeginCreateOrUpdate is the fake for method NodePoolsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, nodePoolName string, resource generated.HcpOpenShiftClusterNodePoolResource, options *generated.NodePoolsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[generated.NodePoolsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) @@ -44,6 +42,7 @@ type NodePoolsServer struct { // BeginUpdate is the fake for method NodePoolsClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted BeginUpdate func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, nodePoolName string, properties generated.HcpOpenShiftClusterNodePoolPatch, options *generated.NodePoolsClientBeginUpdateOptions) (resp azfake.PollerResponder[generated.NodePoolsClientUpdateResponse], errResp azfake.ErrorResponder) + } // NewNodePoolsServerTransport creates a new instance of NodePoolsServerTransport with the provided implementation. @@ -51,22 +50,22 @@ type NodePoolsServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewNodePoolsServerTransport(srv *NodePoolsServer) *NodePoolsServerTransport { return &NodePoolsServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[generated.NodePoolsClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[generated.NodePoolsClientDeleteResponse]](), + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[generated.NodePoolsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[generated.NodePoolsClientDeleteResponse]](), newListByParentPager: newTracker[azfake.PagerResponder[generated.NodePoolsClientListByParentResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[generated.NodePoolsClientUpdateResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[generated.NodePoolsClientUpdateResponse]](), } } // NodePoolsServerTransport connects instances of generated.NodePoolsClient to instances of NodePoolsServer. // Don't use this type directly, use NewNodePoolsServerTransport instead. type NodePoolsServerTransport struct { - srv *NodePoolsServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[generated.NodePoolsClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[generated.NodePoolsClientDeleteResponse]] + srv *NodePoolsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[generated.NodePoolsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[generated.NodePoolsClientDeleteResponse]] newListByParentPager *tracker[azfake.PagerResponder[generated.NodePoolsClientListByParentResponse]] - beginUpdate *tracker[azfake.PollerResponder[generated.NodePoolsClientUpdateResponse]] + beginUpdate *tracker[azfake.PollerResponder[generated.NodePoolsClientUpdateResponse]] } // Do implements the policy.Transporter interface for NodePoolsServerTransport. @@ -108,32 +107,32 @@ func (n *NodePoolsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request } beginCreateOrUpdate := n.beginCreateOrUpdate.get(req) if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[generated.HcpOpenShiftClusterNodePoolResource](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) - if err != nil { - return nil, err - } - nodePoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodePoolName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, hcpOpenShiftClusterNameParam, nodePoolNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[generated.HcpOpenShiftClusterNodePoolResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) + if err != nil { + return nil, err + } + nodePoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodePoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, hcpOpenShiftClusterNameParam, nodePoolNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } beginCreateOrUpdate = &respr n.beginCreateOrUpdate.add(req, beginCreateOrUpdate) } @@ -160,28 +159,28 @@ func (n *NodePoolsServerTransport) dispatchBeginDelete(req *http.Request) (*http } beginDelete := n.beginDelete.get(req) if beginDelete == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) - if err != nil { - return nil, err - } - nodePoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodePoolName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.BeginDelete(req.Context(), resourceGroupNameParam, hcpOpenShiftClusterNameParam, nodePoolNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) + if err != nil { + return nil, err + } + nodePoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodePoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.BeginDelete(req.Context(), resourceGroupNameParam, hcpOpenShiftClusterNameParam, nodePoolNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } beginDelete = &respr n.beginDelete.add(req, beginDelete) } @@ -245,21 +244,21 @@ func (n *NodePoolsServerTransport) dispatchNewListByParentPager(req *http.Reques } newListByParentPager := n.newListByParentPager.get(req) if newListByParentPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodePools` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) - if err != nil { - return nil, err - } - resp := n.srv.NewListByParentPager(resourceGroupNameParam, hcpOpenShiftClusterNameParam, nil) + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodePools` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) + if err != nil { + return nil, err + } +resp := n.srv.NewListByParentPager(resourceGroupNameParam, hcpOpenShiftClusterNameParam, nil) newListByParentPager = &resp n.newListByParentPager.add(req, newListByParentPager) server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *generated.NodePoolsClientListByParentResponse, createLink func() string) { @@ -286,32 +285,32 @@ func (n *NodePoolsServerTransport) dispatchBeginUpdate(req *http.Request) (*http } beginUpdate := n.beginUpdate.get(req) if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[generated.HcpOpenShiftClusterNodePoolPatch](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) - if err != nil { - return nil, err - } - nodePoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodePoolName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.BeginUpdate(req.Context(), resourceGroupNameParam, hcpOpenShiftClusterNameParam, nodePoolNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.RedHatOpenShift/hcpOpenShiftClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/nodePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[generated.HcpOpenShiftClusterNodePoolPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + hcpOpenShiftClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("hcpOpenShiftClusterName")]) + if err != nil { + return nil, err + } + nodePoolNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("nodePoolName")]) + if err != nil { + return nil, err + } + respr, errRespr := n.srv.BeginUpdate(req.Context(), resourceGroupNameParam, hcpOpenShiftClusterNameParam, nodePoolNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } beginUpdate = &respr n.beginUpdate.add(req, beginUpdate) } @@ -331,3 +330,4 @@ func (n *NodePoolsServerTransport) dispatchBeginUpdate(req *http.Request) (*http return resp, nil } + diff --git a/internal/api/v20240610preview/generated/fake/operations_server.go b/internal/api/v20240610preview/generated/fake/operations_server.go index e02368bbc..6208f5b0b 100644 --- a/internal/api/v20240610preview/generated/fake/operations_server.go +++ b/internal/api/v20240610preview/generated/fake/operations_server.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -10,21 +10,20 @@ package fake import ( "errors" "fmt" - "net/http" - + "github.com/Azure/ARO-HCP/internal/api/v20240610preview/generated" azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - - "github.com/Azure/ARO-HCP/internal/api/v20240610preview/generated" + "net/http" ) // OperationsServer is a fake server for instances of the generated.OperationsClient type. -type OperationsServer struct { +type OperationsServer struct{ // NewListPager is the fake for method OperationsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(options *generated.OperationsClientListOptions) (resp azfake.PagerResponder[generated.OperationsClientListResponse]) + } // NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. @@ -32,7 +31,7 @@ type OperationsServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { return &OperationsServerTransport{ - srv: srv, + srv: srv, newListPager: newTracker[azfake.PagerResponder[generated.OperationsClientListResponse]](), } } @@ -40,7 +39,7 @@ func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransp // OperationsServerTransport connects instances of generated.OperationsClient to instances of OperationsServer. // Don't use this type directly, use NewOperationsServerTransport instead. type OperationsServerTransport struct { - srv *OperationsServer + srv *OperationsServer newListPager *tracker[azfake.PagerResponder[generated.OperationsClientListResponse]] } @@ -75,7 +74,7 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } newListPager := o.newListPager.get(req) if newListPager == nil { - resp := o.srv.NewListPager(nil) +resp := o.srv.NewListPager(nil) newListPager = &resp o.newListPager.add(req, newListPager) server.PagerResponderInjectNextLinks(newListPager, req, func(page *generated.OperationsClientListResponse, createLink func() string) { @@ -95,3 +94,4 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + diff --git a/internal/api/v20240610preview/generated/fake/server_factory.go b/internal/api/v20240610preview/generated/fake/server_factory.go index 1b0355bd4..767fdb2d3 100644 --- a/internal/api/v20240610preview/generated/fake/server_factory.go +++ b/internal/api/v20240610preview/generated/fake/server_factory.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -10,19 +10,18 @@ package fake import ( "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "strings" "sync" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ServerFactory is a fake server for instances of the generated.ClientFactory type. type ServerFactory struct { - HcpClusterVersionsServer HcpClusterVersionsServer + HcpClusterVersionsServer HcpClusterVersionsServer HcpOpenShiftClustersServer HcpOpenShiftClustersServer - NodePoolsServer NodePoolsServer - OperationsServer OperationsServer + NodePoolsServer NodePoolsServer + OperationsServer OperationsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -37,12 +36,12 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of generated.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trHcpClusterVersionsServer *HcpClusterVersionsServerTransport + srv *ServerFactory + trMu sync.Mutex + trHcpClusterVersionsServer *HcpClusterVersionsServerTransport trHcpOpenShiftClustersServer *HcpOpenShiftClustersServerTransport - trNodePoolsServer *NodePoolsServerTransport - trOperationsServer *OperationsServerTransport + trNodePoolsServer *NodePoolsServerTransport + trOperationsServer *OperationsServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -59,14 +58,10 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { switch client { case "HcpClusterVersionsClient": - initServer(s, &s.trHcpClusterVersionsServer, func() *HcpClusterVersionsServerTransport { - return NewHcpClusterVersionsServerTransport(&s.srv.HcpClusterVersionsServer) - }) + initServer(s, &s.trHcpClusterVersionsServer, func() *HcpClusterVersionsServerTransport { return NewHcpClusterVersionsServerTransport(&s.srv.HcpClusterVersionsServer) }) resp, err = s.trHcpClusterVersionsServer.Do(req) case "HcpOpenShiftClustersClient": - initServer(s, &s.trHcpOpenShiftClustersServer, func() *HcpOpenShiftClustersServerTransport { - return NewHcpOpenShiftClustersServerTransport(&s.srv.HcpOpenShiftClustersServer) - }) + initServer(s, &s.trHcpOpenShiftClustersServer, func() *HcpOpenShiftClustersServerTransport { return NewHcpOpenShiftClustersServerTransport(&s.srv.HcpOpenShiftClustersServer) }) resp, err = s.trHcpOpenShiftClustersServer.Do(req) case "NodePoolsClient": initServer(s, &s.trNodePoolsServer, func() *NodePoolsServerTransport { return NewNodePoolsServerTransport(&s.srv.NodePoolsServer) }) diff --git a/internal/api/v20240610preview/generated/fake/time_rfc3339.go b/internal/api/v20240610preview/generated/fake/time_rfc3339.go index f2c4f2034..e48ebd541 100644 --- a/internal/api/v20240610preview/generated/fake/time_rfc3339.go +++ b/internal/api/v20240610preview/generated/fake/time_rfc3339.go @@ -1,23 +1,26 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. package fake + + import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "regexp" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) + + // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) @@ -59,7 +62,7 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { return t.Parse(layout, string(data)) } -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { +func (t *dateTimeRFC3339) UnmarshalText(data []byte) (error) { tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string @@ -85,6 +88,7 @@ func (t dateTimeRFC3339) String() string { return time.Time(t).Format(time.RFC3339Nano) } + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return diff --git a/internal/api/v20240610preview/generated/hcpclusterversions_client.go b/internal/api/v20240610preview/generated/hcpclusterversions_client.go index 9e1ca9b67..d147d9f97 100644 --- a/internal/api/v20240610preview/generated/hcpclusterversions_client.go +++ b/internal/api/v20240610preview/generated/hcpclusterversions_client.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -10,20 +10,19 @@ package generated import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // HcpClusterVersionsClient contains the methods for the HcpClusterVersions group. // Don't use this type directly, use NewHcpClusterVersionsClient() instead. type HcpClusterVersionsClient struct { - internal *arm.Client + internal *arm.Client subscriptionID string } @@ -38,7 +37,7 @@ func NewHcpClusterVersionsClient(subscriptionID string, credential azcore.TokenC } client := &HcpClusterVersionsClient{ subscriptionID: subscriptionID, - internal: cl, + internal: cl, } return client, nil } @@ -49,13 +48,13 @@ func NewHcpClusterVersionsClient(subscriptionID string, credential azcore.TokenC // - location - The name of the Azure region. // - options - HcpClusterVersionsClientListOptions contains the optional parameters for the HcpClusterVersionsClient.NewListPager // method. -func (client *HcpClusterVersionsClient) NewListPager(location string, options *HcpClusterVersionsClientListOptions) *runtime.Pager[HcpClusterVersionsClientListResponse] { +func (client *HcpClusterVersionsClient) NewListPager(location string, options *HcpClusterVersionsClientListOptions) (*runtime.Pager[HcpClusterVersionsClientListResponse]) { return runtime.NewPager(runtime.PagingHandler[HcpClusterVersionsClientListResponse]{ More: func(page HcpClusterVersionsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *HcpClusterVersionsClientListResponse) (HcpClusterVersionsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HcpClusterVersionsClient.NewListPager") + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HcpClusterVersionsClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -67,7 +66,7 @@ func (client *HcpClusterVersionsClient) NewListPager(location string, options *H return HcpClusterVersionsClientListResponse{}, err } return client.listHandleResponse(resp) - }, + }, Tracer: client.internal.Tracer(), }) } @@ -102,3 +101,4 @@ func (client *HcpClusterVersionsClient) listHandleResponse(resp *http.Response) } return result, nil } + diff --git a/internal/api/v20240610preview/generated/hcpopenshiftclusters_client.go b/internal/api/v20240610preview/generated/hcpopenshiftclusters_client.go index 677206231..67aa5d5a2 100644 --- a/internal/api/v20240610preview/generated/hcpopenshiftclusters_client.go +++ b/internal/api/v20240610preview/generated/hcpopenshiftclusters_client.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -10,20 +10,19 @@ package generated import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // HcpOpenShiftClustersClient contains the methods for the HcpOpenShiftClusters group. // Don't use this type directly, use NewHcpOpenShiftClustersClient() instead. type HcpOpenShiftClustersClient struct { - internal *arm.Client + internal *arm.Client subscriptionID string } @@ -38,7 +37,7 @@ func NewHcpOpenShiftClustersClient(subscriptionID string, credential azcore.Toke } client := &HcpOpenShiftClustersClient{ subscriptionID: subscriptionID, - internal: cl, + internal: cl, } return client, nil } @@ -125,7 +124,7 @@ func (client *HcpOpenShiftClustersClient) BeginCreateOrUpdate(ctx context.Contex } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HcpOpenShiftClustersClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -184,8 +183,8 @@ func (client *HcpOpenShiftClustersClient) createOrUpdateCreateRequest(ctx contex req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { - return nil, err - } + return nil, err +} return req, nil } @@ -205,7 +204,7 @@ func (client *HcpOpenShiftClustersClient) BeginDelete(ctx context.Context, resou } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HcpOpenShiftClustersClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -402,13 +401,13 @@ func (client *HcpOpenShiftClustersClient) kubeConfigHandleResponse(resp *http.Re // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - HcpOpenShiftClustersClientListByResourceGroupOptions contains the optional parameters for the HcpOpenShiftClustersClient.NewListByResourceGroupPager // method. -func (client *HcpOpenShiftClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *HcpOpenShiftClustersClientListByResourceGroupOptions) *runtime.Pager[HcpOpenShiftClustersClientListByResourceGroupResponse] { +func (client *HcpOpenShiftClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *HcpOpenShiftClustersClientListByResourceGroupOptions) (*runtime.Pager[HcpOpenShiftClustersClientListByResourceGroupResponse]) { return runtime.NewPager(runtime.PagingHandler[HcpOpenShiftClustersClientListByResourceGroupResponse]{ More: func(page HcpOpenShiftClustersClientListByResourceGroupResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *HcpOpenShiftClustersClientListByResourceGroupResponse) (HcpOpenShiftClustersClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HcpOpenShiftClustersClient.NewListByResourceGroupPager") + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HcpOpenShiftClustersClient.NewListByResourceGroupPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -420,7 +419,7 @@ func (client *HcpOpenShiftClustersClient) NewListByResourceGroupPager(resourceGr return HcpOpenShiftClustersClientListByResourceGroupResponse{}, err } return client.listByResourceGroupHandleResponse(resp) - }, + }, Tracer: client.internal.Tracer(), }) } @@ -461,13 +460,13 @@ func (client *HcpOpenShiftClustersClient) listByResourceGroupHandleResponse(resp // Generated from API version 2024-06-10-preview // - options - HcpOpenShiftClustersClientListBySubscriptionOptions contains the optional parameters for the HcpOpenShiftClustersClient.NewListBySubscriptionPager // method. -func (client *HcpOpenShiftClustersClient) NewListBySubscriptionPager(options *HcpOpenShiftClustersClientListBySubscriptionOptions) *runtime.Pager[HcpOpenShiftClustersClientListBySubscriptionResponse] { +func (client *HcpOpenShiftClustersClient) NewListBySubscriptionPager(options *HcpOpenShiftClustersClientListBySubscriptionOptions) (*runtime.Pager[HcpOpenShiftClustersClientListBySubscriptionResponse]) { return runtime.NewPager(runtime.PagingHandler[HcpOpenShiftClustersClientListBySubscriptionResponse]{ More: func(page HcpOpenShiftClustersClientListBySubscriptionResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *HcpOpenShiftClustersClientListBySubscriptionResponse) (HcpOpenShiftClustersClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HcpOpenShiftClustersClient.NewListBySubscriptionPager") + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HcpOpenShiftClustersClient.NewListBySubscriptionPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -479,7 +478,7 @@ func (client *HcpOpenShiftClustersClient) NewListBySubscriptionPager(options *Hc return HcpOpenShiftClustersClientListBySubscriptionResponse{}, err } return client.listBySubscriptionHandleResponse(resp) - }, + }, Tracer: client.internal.Tracer(), }) } @@ -528,7 +527,7 @@ func (client *HcpOpenShiftClustersClient) BeginUpdate(ctx context.Context, resou } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HcpOpenShiftClustersClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -587,7 +586,8 @@ func (client *HcpOpenShiftClustersClient) updateCreateRequest(ctx context.Contex req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { - return nil, err - } + return nil, err +} return req, nil } + diff --git a/internal/api/v20240610preview/generated/models.go b/internal/api/v20240610preview/generated/models.go index ef14dc733..dcc721a97 100644 --- a/internal/api/v20240610preview/generated/models.go +++ b/internal/api/v20240610preview/generated/models.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -57,7 +57,7 @@ type ClusterSpec struct { EtcdEncryption *bool // Configuration to override the openshift-oauth-apiserver inside cluster This changes user login into the cluster to external - // provider +// provider ExternalAuth *ExternalAuthConfigProfile // Enable FIPS mode for the cluster When set to true, etcdEncryption must be set to true @@ -96,7 +96,7 @@ type ConsoleProfile struct { // DNSProfile - DNS contains the DNS settings of the cluster type DNSProfile struct { // BaseDomainPrefix is the unique name of the cluster representing the OpenShift's cluster name. BaseDomainPrefix is the name - // that will appear in the cluster's DNS, provisioned cloud providers resources +// that will appear in the cluster's DNS, provisioned cloud providers resources BaseDomainPrefix *string // READ-ONLY; BaseDomain is the base DNS domain of the cluster. @@ -372,14 +372,14 @@ type ManagedServiceIdentity struct { Type *ManagedServiceIdentityType // The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM - // resource ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. - // The dictionary values can be empty objects ({}) in - // requests. +// resource ids in the form: +// '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. +// The dictionary values can be empty objects ({}) in +// requests. UserAssignedIdentities map[string]*UserAssignedIdentity // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned - // identity. +// identity. PrincipalID *string // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. @@ -446,32 +446,32 @@ type NodePoolPatchSpec struct { Taints []*Taint // Tuning configs, TODO provide meaningful explanation TuningConfig is a list of references to ConfigMaps containing serialized - // Tuned resources to define the tuning configuration to be applied to nodes - // in the NodePool. Each ConfigMap must have a single key named "tuned" whose value is the JSON or YAML of a serialized Tuned - // or PerformanceProfile. +// Tuned resources to define the tuning configuration to be applied to nodes +// in the NodePool. Each ConfigMap must have a single key named "tuned" whose value is the JSON or YAML of a serialized Tuned +// or PerformanceProfile. TuningConfigs []*string } // NodePoolPlatformProfile - Azure node pool platform configuration type NodePoolPlatformProfile struct { // REQUIRED; The VM size according to the documentation: - // * https://learn.microsoft.com/en-us/azure/virtual-machines/sizes +// * https://learn.microsoft.com/en-us/azure/virtual-machines/sizes VMSize *string // The availability zone for the node pool. Please read the documentation to see which regions support availability zones - // * https://learn.microsoft.com/en-us/azure/availability-zones/az-overview +// * https://learn.microsoft.com/en-us/azure/availability-zones/az-overview AvailabilityZone *string // Disk Encryption Set ID that will be used for encryption the Nodes disks - // * https://learn.microsoft.com/en-us/azure/virtual-machines/disk-encryption-overview - // * https://learn.microsoft.com/en-us/azure/virtual-machines/disk-encryption +// * https://learn.microsoft.com/en-us/azure/virtual-machines/disk-encryption-overview +// * https://learn.microsoft.com/en-us/azure/virtual-machines/disk-encryption DiskEncryptionSetID *string // The OS disk size in GiB DiskSizeGiB *int32 // The type of the disk storage account - // * https://learn.microsoft.com/en-us/azure/virtual-machines/disks-types +// * https://learn.microsoft.com/en-us/azure/virtual-machines/disks-types DiskStorageAccountType *string // Whether the worker machines should be encrypted at host @@ -517,9 +517,9 @@ type NodePoolSpec struct { Taints []*Taint // Tuning configs, TODO provide meaningful explanation TuningConfig is a list of references to ConfigMaps containing serialized - // Tuned resources to define the tuning configuration to be applied to nodes - // in the NodePool. Each ConfigMap must have a single key named "tuned" whose value is the JSON or YAML of a serialized Tuned - // or PerformanceProfile. +// Tuned resources to define the tuning configuration to be applied to nodes +// in the NodePool. Each ConfigMap must have a single key named "tuned" whose value is the JSON or YAML of a serialized Tuned +// or PerformanceProfile. TuningConfigs []*string } @@ -532,15 +532,15 @@ type Operation struct { ActionType *ActionType // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane - // operations. +// operations. IsDataAction *bool // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", - // "Microsoft.Compute/virtualMachines/capture/action" +// "Microsoft.Compute/virtualMachines/capture/action" Name *string // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default - // value is "user,system" +// value is "user,system" Origin *Origin } @@ -550,15 +550,15 @@ type OperationDisplay struct { Description *string // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual - // Machine", "Restart Virtual Machine". +// Machine", "Restart Virtual Machine". Operation *string // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft - // Compute". +// Compute". Provider *string // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job - // Schedule Collections". +// Schedule Collections". Resource *string } @@ -581,7 +581,7 @@ type PlatformProfile struct { SubnetID *string // The id of the disk encryption set to be used for etcd. Configure this when etcdEncryption is set to true Is used the - // https://learn.microsoft.com/en-us/azure/storage/common/customer-managed-keys-overview +// https://learn.microsoft.com/en-us/azure/storage/common/customer-managed-keys-overview EtcdEncryptionSetID *string // Resource group to put cluster resources @@ -742,3 +742,4 @@ type VersionProfile struct { // READ-ONLY; AvailableUpgrades is a list of version names the current version can be upgraded to. AvailableUpgrades []*string } + diff --git a/internal/api/v20240610preview/generated/models_serde.go b/internal/api/v20240610preview/generated/models_serde.go index 2573c28c2..ce925a5a8 100644 --- a/internal/api/v20240610preview/generated/models_serde.go +++ b/internal/api/v20240610preview/generated/models_serde.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -10,9 +10,8 @@ package generated import ( "encoding/json" "fmt" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" ) // MarshalJSON implements the json.Marshaller interface for type APIProfile. @@ -33,10 +32,10 @@ func (a *APIProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "url": - err = unpopulate(val, "URL", &a.URL) + err = unpopulate(val, "URL", &a.URL) delete(rawMsg, key) case "visibility": - err = unpopulate(val, "Visibility", &a.Visibility) + err = unpopulate(val, "Visibility", &a.Visibility) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", a, key) @@ -67,13 +66,13 @@ func (c *ClaimProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "claim": - err = unpopulate(val, "Claim", &c.Claim) + err = unpopulate(val, "Claim", &c.Claim) delete(rawMsg, key) case "prefix": - err = unpopulate(val, "Prefix", &c.Prefix) + err = unpopulate(val, "Prefix", &c.Prefix) delete(rawMsg, key) case "prefixPolicy": - err = unpopulate(val, "PrefixPolicy", &c.PrefixPolicy) + err = unpopulate(val, "PrefixPolicy", &c.PrefixPolicy) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", c, key) @@ -103,10 +102,10 @@ func (c *ClusterPatchSpec) UnmarshalJSON(data []byte) error { var err error switch key { case "disableUserWorkloadMonitoring": - err = unpopulate(val, "DisableUserWorkloadMonitoring", &c.DisableUserWorkloadMonitoring) + err = unpopulate(val, "DisableUserWorkloadMonitoring", &c.DisableUserWorkloadMonitoring) delete(rawMsg, key) case "proxy": - err = unpopulate(val, "Proxy", &c.Proxy) + err = unpopulate(val, "Proxy", &c.Proxy) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", c, key) @@ -146,40 +145,40 @@ func (c *ClusterSpec) UnmarshalJSON(data []byte) error { var err error switch key { case "api": - err = unpopulate(val, "API", &c.API) + err = unpopulate(val, "API", &c.API) delete(rawMsg, key) case "console": - err = unpopulate(val, "Console", &c.Console) + err = unpopulate(val, "Console", &c.Console) delete(rawMsg, key) case "dns": - err = unpopulate(val, "DNS", &c.DNS) + err = unpopulate(val, "DNS", &c.DNS) delete(rawMsg, key) case "disableUserWorkloadMonitoring": - err = unpopulate(val, "DisableUserWorkloadMonitoring", &c.DisableUserWorkloadMonitoring) + err = unpopulate(val, "DisableUserWorkloadMonitoring", &c.DisableUserWorkloadMonitoring) delete(rawMsg, key) case "etcdEncryption": - err = unpopulate(val, "EtcdEncryption", &c.EtcdEncryption) + err = unpopulate(val, "EtcdEncryption", &c.EtcdEncryption) delete(rawMsg, key) case "externalAuth": - err = unpopulate(val, "ExternalAuth", &c.ExternalAuth) + err = unpopulate(val, "ExternalAuth", &c.ExternalAuth) delete(rawMsg, key) case "fips": - err = unpopulate(val, "Fips", &c.Fips) + err = unpopulate(val, "Fips", &c.Fips) delete(rawMsg, key) case "issuerUrl": - err = unpopulate(val, "IssuerURL", &c.IssuerURL) + err = unpopulate(val, "IssuerURL", &c.IssuerURL) delete(rawMsg, key) case "network": - err = unpopulate(val, "Network", &c.Network) + err = unpopulate(val, "Network", &c.Network) delete(rawMsg, key) case "platform": - err = unpopulate(val, "Platform", &c.Platform) + err = unpopulate(val, "Platform", &c.Platform) delete(rawMsg, key) case "proxy": - err = unpopulate(val, "Proxy", &c.Proxy) + err = unpopulate(val, "Proxy", &c.Proxy) delete(rawMsg, key) case "version": - err = unpopulate(val, "Version", &c.Version) + err = unpopulate(val, "Version", &c.Version) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", c, key) @@ -209,10 +208,10 @@ func (c *ComponentsQjfoe3SchemasManagedserviceidentityupdatePropertiesUserassign var err error switch key { case "clientId": - err = unpopulate(val, "ClientID", &c.ClientID) + err = unpopulate(val, "ClientID", &c.ClientID) delete(rawMsg, key) case "principalId": - err = unpopulate(val, "PrincipalID", &c.PrincipalID) + err = unpopulate(val, "PrincipalID", &c.PrincipalID) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", c, key) @@ -241,7 +240,7 @@ func (c *ConsoleProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "url": - err = unpopulate(val, "URL", &c.URL) + err = unpopulate(val, "URL", &c.URL) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", c, key) @@ -271,10 +270,10 @@ func (d *DNSProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "baseDomain": - err = unpopulate(val, "BaseDomain", &d.BaseDomain) + err = unpopulate(val, "BaseDomain", &d.BaseDomain) delete(rawMsg, key) case "baseDomainPrefix": - err = unpopulate(val, "BaseDomainPrefix", &d.BaseDomainPrefix) + err = unpopulate(val, "BaseDomainPrefix", &d.BaseDomainPrefix) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", d, key) @@ -304,10 +303,10 @@ func (e *ErrorAdditionalInfo) UnmarshalJSON(data []byte) error { var err error switch key { case "info": - err = unpopulate(val, "Info", &e.Info) + err = unpopulate(val, "Info", &e.Info) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &e.Type) + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", e, key) @@ -340,19 +339,19 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { var err error switch key { case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) + err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) delete(rawMsg, key) case "code": - err = unpopulate(val, "Code", &e.Code) + err = unpopulate(val, "Code", &e.Code) delete(rawMsg, key) case "details": - err = unpopulate(val, "Details", &e.Details) + err = unpopulate(val, "Details", &e.Details) delete(rawMsg, key) case "message": - err = unpopulate(val, "Message", &e.Message) + err = unpopulate(val, "Message", &e.Message) delete(rawMsg, key) case "target": - err = unpopulate(val, "Target", &e.Target) + err = unpopulate(val, "Target", &e.Target) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", e, key) @@ -381,7 +380,7 @@ func (e *ErrorResponse) UnmarshalJSON(data []byte) error { var err error switch key { case "error": - err = unpopulate(val, "Error", &e.Error) + err = unpopulate(val, "Error", &e.Error) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", e, key) @@ -411,10 +410,10 @@ func (e *ExternalAuthClaimProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "mappings": - err = unpopulate(val, "Mappings", &e.Mappings) + err = unpopulate(val, "Mappings", &e.Mappings) delete(rawMsg, key) case "validationRules": - err = unpopulate(val, "ValidationRules", &e.ValidationRules) + err = unpopulate(val, "ValidationRules", &e.ValidationRules) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", e, key) @@ -444,10 +443,10 @@ func (e *ExternalAuthClientComponentProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "authClientNamespace": - err = unpopulate(val, "AuthClientNamespace", &e.AuthClientNamespace) + err = unpopulate(val, "AuthClientNamespace", &e.AuthClientNamespace) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &e.Name) + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", e, key) @@ -479,16 +478,16 @@ func (e *ExternalAuthClientProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "component": - err = unpopulate(val, "Component", &e.Component) + err = unpopulate(val, "Component", &e.Component) delete(rawMsg, key) case "extraScopes": - err = unpopulate(val, "ExtraScopes", &e.ExtraScopes) + err = unpopulate(val, "ExtraScopes", &e.ExtraScopes) delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &e.ID) + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) case "secret": - err = unpopulate(val, "Secret", &e.Secret) + err = unpopulate(val, "Secret", &e.Secret) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", e, key) @@ -518,10 +517,10 @@ func (e *ExternalAuthConfigProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "enabled": - err = unpopulate(val, "Enabled", &e.Enabled) + err = unpopulate(val, "Enabled", &e.Enabled) delete(rawMsg, key) case "externalAuths": - err = unpopulate(val, "ExternalAuths", &e.ExternalAuths) + err = unpopulate(val, "ExternalAuths", &e.ExternalAuths) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", e, key) @@ -552,13 +551,13 @@ func (e *ExternalAuthProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "claim": - err = unpopulate(val, "Claim", &e.Claim) + err = unpopulate(val, "Claim", &e.Claim) delete(rawMsg, key) case "clients": - err = unpopulate(val, "Clients", &e.Clients) + err = unpopulate(val, "Clients", &e.Clients) delete(rawMsg, key) case "issuer": - err = unpopulate(val, "Issuer", &e.Issuer) + err = unpopulate(val, "Issuer", &e.Issuer) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", e, key) @@ -588,10 +587,10 @@ func (h *HcpOpenShiftClusterCredentials) UnmarshalJSON(data []byte) error { var err error switch key { case "kubeadminPassword": - err = unpopulate(val, "KubeadminPassword", &h.KubeadminPassword) + err = unpopulate(val, "KubeadminPassword", &h.KubeadminPassword) delete(rawMsg, key) case "kubeadminUsername": - err = unpopulate(val, "KubeadminUsername", &h.KubeadminUsername) + err = unpopulate(val, "KubeadminUsername", &h.KubeadminUsername) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", h, key) @@ -620,7 +619,7 @@ func (h *HcpOpenShiftClusterKubeconfig) UnmarshalJSON(data []byte) error { var err error switch key { case "kubeconfig": - err = unpopulate(val, "Kubeconfig", &h.Kubeconfig) + err = unpopulate(val, "Kubeconfig", &h.Kubeconfig) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", h, key) @@ -651,13 +650,13 @@ func (h *HcpOpenShiftClusterNodePoolPatch) UnmarshalJSON(data []byte) error { var err error switch key { case "identity": - err = unpopulate(val, "Identity", &h.Identity) + err = unpopulate(val, "Identity", &h.Identity) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &h.Properties) + err = unpopulate(val, "Properties", &h.Properties) delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &h.Tags) + err = unpopulate(val, "Tags", &h.Tags) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", h, key) @@ -693,28 +692,28 @@ func (h *HcpOpenShiftClusterNodePoolResource) UnmarshalJSON(data []byte) error { var err error switch key { case "id": - err = unpopulate(val, "ID", &h.ID) + err = unpopulate(val, "ID", &h.ID) delete(rawMsg, key) case "identity": - err = unpopulate(val, "Identity", &h.Identity) + err = unpopulate(val, "Identity", &h.Identity) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &h.Location) + err = unpopulate(val, "Location", &h.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &h.Name) + err = unpopulate(val, "Name", &h.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &h.Properties) + err = unpopulate(val, "Properties", &h.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &h.SystemData) + err = unpopulate(val, "SystemData", &h.SystemData) delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &h.Tags) + err = unpopulate(val, "Tags", &h.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &h.Type) + err = unpopulate(val, "Type", &h.Type) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", h, key) @@ -744,10 +743,10 @@ func (h *HcpOpenShiftClusterNodePoolResourceListResult) UnmarshalJSON(data []byt var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &h.NextLink) + err = unpopulate(val, "NextLink", &h.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &h.Value) + err = unpopulate(val, "Value", &h.Value) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", h, key) @@ -778,13 +777,13 @@ func (h *HcpOpenShiftClusterPatch) UnmarshalJSON(data []byte) error { var err error switch key { case "identity": - err = unpopulate(val, "Identity", &h.Identity) + err = unpopulate(val, "Identity", &h.Identity) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &h.Properties) + err = unpopulate(val, "Properties", &h.Properties) delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &h.Tags) + err = unpopulate(val, "Tags", &h.Tags) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", h, key) @@ -814,10 +813,10 @@ func (h *HcpOpenShiftClusterPatchProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "provisioningState": - err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) delete(rawMsg, key) case "spec": - err = unpopulate(val, "Spec", &h.Spec) + err = unpopulate(val, "Spec", &h.Spec) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", h, key) @@ -847,10 +846,10 @@ func (h *HcpOpenShiftClusterProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "provisioningState": - err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) delete(rawMsg, key) case "spec": - err = unpopulate(val, "Spec", &h.Spec) + err = unpopulate(val, "Spec", &h.Spec) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", h, key) @@ -886,28 +885,28 @@ func (h *HcpOpenShiftClusterResource) UnmarshalJSON(data []byte) error { var err error switch key { case "id": - err = unpopulate(val, "ID", &h.ID) + err = unpopulate(val, "ID", &h.ID) delete(rawMsg, key) case "identity": - err = unpopulate(val, "Identity", &h.Identity) + err = unpopulate(val, "Identity", &h.Identity) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &h.Location) + err = unpopulate(val, "Location", &h.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &h.Name) + err = unpopulate(val, "Name", &h.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &h.Properties) + err = unpopulate(val, "Properties", &h.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &h.SystemData) + err = unpopulate(val, "SystemData", &h.SystemData) delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &h.Tags) + err = unpopulate(val, "Tags", &h.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &h.Type) + err = unpopulate(val, "Type", &h.Type) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", h, key) @@ -937,10 +936,10 @@ func (h *HcpOpenShiftClusterResourceListResult) UnmarshalJSON(data []byte) error var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &h.NextLink) + err = unpopulate(val, "NextLink", &h.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &h.Value) + err = unpopulate(val, "Value", &h.Value) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", h, key) @@ -973,19 +972,19 @@ func (h *HcpOpenShiftVersionResource) UnmarshalJSON(data []byte) error { var err error switch key { case "id": - err = unpopulate(val, "ID", &h.ID) + err = unpopulate(val, "ID", &h.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &h.Name) + err = unpopulate(val, "Name", &h.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &h.Properties) + err = unpopulate(val, "Properties", &h.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &h.SystemData) + err = unpopulate(val, "SystemData", &h.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &h.Type) + err = unpopulate(val, "Type", &h.Type) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", h, key) @@ -1015,10 +1014,10 @@ func (h *HcpOpenShiftVersionResourceListResult) UnmarshalJSON(data []byte) error var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &h.NextLink) + err = unpopulate(val, "NextLink", &h.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &h.Value) + err = unpopulate(val, "Value", &h.Value) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", h, key) @@ -1048,10 +1047,10 @@ func (h *HcpOpenShiftVersionsProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "clusterVersion": - err = unpopulate(val, "ClusterVersion", &h.ClusterVersion) + err = unpopulate(val, "ClusterVersion", &h.ClusterVersion) delete(rawMsg, key) case "provisioningState": - err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", h, key) @@ -1081,10 +1080,10 @@ func (l *Label) UnmarshalJSON(data []byte) error { var err error switch key { case "key": - err = unpopulate(val, "Key", &l.Key) + err = unpopulate(val, "Key", &l.Key) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &l.Value) + err = unpopulate(val, "Value", &l.Value) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", l, key) @@ -1116,16 +1115,16 @@ func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { var err error switch key { case "principalId": - err = unpopulate(val, "PrincipalID", &m.PrincipalID) + err = unpopulate(val, "PrincipalID", &m.PrincipalID) delete(rawMsg, key) case "tenantId": - err = unpopulate(val, "TenantID", &m.TenantID) + err = unpopulate(val, "TenantID", &m.TenantID) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &m.Type) + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", m, key) @@ -1155,10 +1154,10 @@ func (m *ManagedServiceIdentityUpdate) UnmarshalJSON(data []byte) error { var err error switch key { case "type": - err = unpopulate(val, "Type", &m.Type) + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", m, key) @@ -1191,19 +1190,19 @@ func (n *NetworkProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "hostPrefix": - err = unpopulate(val, "HostPrefix", &n.HostPrefix) + err = unpopulate(val, "HostPrefix", &n.HostPrefix) delete(rawMsg, key) case "machineCidr": - err = unpopulate(val, "MachineCidr", &n.MachineCidr) + err = unpopulate(val, "MachineCidr", &n.MachineCidr) delete(rawMsg, key) case "networkType": - err = unpopulate(val, "NetworkType", &n.NetworkType) + err = unpopulate(val, "NetworkType", &n.NetworkType) delete(rawMsg, key) case "podCidr": - err = unpopulate(val, "PodCidr", &n.PodCidr) + err = unpopulate(val, "PodCidr", &n.PodCidr) delete(rawMsg, key) case "serviceCidr": - err = unpopulate(val, "ServiceCidr", &n.ServiceCidr) + err = unpopulate(val, "ServiceCidr", &n.ServiceCidr) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", n, key) @@ -1233,10 +1232,10 @@ func (n *NodePoolAutoScaling) UnmarshalJSON(data []byte) error { var err error switch key { case "max": - err = unpopulate(val, "Max", &n.Max) + err = unpopulate(val, "Max", &n.Max) delete(rawMsg, key) case "min": - err = unpopulate(val, "Min", &n.Min) + err = unpopulate(val, "Min", &n.Min) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", n, key) @@ -1266,10 +1265,10 @@ func (n *NodePoolPatchProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "provisioningState": - err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) delete(rawMsg, key) case "spec": - err = unpopulate(val, "Spec", &n.Spec) + err = unpopulate(val, "Spec", &n.Spec) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", n, key) @@ -1302,19 +1301,19 @@ func (n *NodePoolPatchSpec) UnmarshalJSON(data []byte) error { var err error switch key { case "autoScaling": - err = unpopulate(val, "AutoScaling", &n.AutoScaling) + err = unpopulate(val, "AutoScaling", &n.AutoScaling) delete(rawMsg, key) case "labels": - err = unpopulate(val, "Labels", &n.Labels) + err = unpopulate(val, "Labels", &n.Labels) delete(rawMsg, key) case "replicas": - err = unpopulate(val, "Replicas", &n.Replicas) + err = unpopulate(val, "Replicas", &n.Replicas) delete(rawMsg, key) case "taints": - err = unpopulate(val, "Taints", &n.Taints) + err = unpopulate(val, "Taints", &n.Taints) delete(rawMsg, key) case "tuningConfigs": - err = unpopulate(val, "TuningConfigs", &n.TuningConfigs) + err = unpopulate(val, "TuningConfigs", &n.TuningConfigs) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", n, key) @@ -1350,28 +1349,28 @@ func (n *NodePoolPlatformProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "availabilityZone": - err = unpopulate(val, "AvailabilityZone", &n.AvailabilityZone) + err = unpopulate(val, "AvailabilityZone", &n.AvailabilityZone) delete(rawMsg, key) case "diskEncryptionSetId": - err = unpopulate(val, "DiskEncryptionSetID", &n.DiskEncryptionSetID) + err = unpopulate(val, "DiskEncryptionSetID", &n.DiskEncryptionSetID) delete(rawMsg, key) case "diskSizeGiB": - err = unpopulate(val, "DiskSizeGiB", &n.DiskSizeGiB) + err = unpopulate(val, "DiskSizeGiB", &n.DiskSizeGiB) delete(rawMsg, key) case "diskStorageAccountType": - err = unpopulate(val, "DiskStorageAccountType", &n.DiskStorageAccountType) + err = unpopulate(val, "DiskStorageAccountType", &n.DiskStorageAccountType) delete(rawMsg, key) case "encryptionAtHost": - err = unpopulate(val, "EncryptionAtHost", &n.EncryptionAtHost) + err = unpopulate(val, "EncryptionAtHost", &n.EncryptionAtHost) delete(rawMsg, key) case "ephemeralOsDisk": - err = unpopulate(val, "EphemeralOsDisk", &n.EphemeralOsDisk) + err = unpopulate(val, "EphemeralOsDisk", &n.EphemeralOsDisk) delete(rawMsg, key) case "subnetId": - err = unpopulate(val, "SubnetID", &n.SubnetID) + err = unpopulate(val, "SubnetID", &n.SubnetID) delete(rawMsg, key) case "vmSize": - err = unpopulate(val, "VMSize", &n.VMSize) + err = unpopulate(val, "VMSize", &n.VMSize) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", n, key) @@ -1401,10 +1400,10 @@ func (n *NodePoolProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "provisioningState": - err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) + err = unpopulate(val, "ProvisioningState", &n.ProvisioningState) delete(rawMsg, key) case "spec": - err = unpopulate(val, "Spec", &n.Spec) + err = unpopulate(val, "Spec", &n.Spec) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", n, key) @@ -1440,28 +1439,28 @@ func (n *NodePoolSpec) UnmarshalJSON(data []byte) error { var err error switch key { case "autoRepair": - err = unpopulate(val, "AutoRepair", &n.AutoRepair) + err = unpopulate(val, "AutoRepair", &n.AutoRepair) delete(rawMsg, key) case "autoScaling": - err = unpopulate(val, "AutoScaling", &n.AutoScaling) + err = unpopulate(val, "AutoScaling", &n.AutoScaling) delete(rawMsg, key) case "labels": - err = unpopulate(val, "Labels", &n.Labels) + err = unpopulate(val, "Labels", &n.Labels) delete(rawMsg, key) case "platform": - err = unpopulate(val, "Platform", &n.Platform) + err = unpopulate(val, "Platform", &n.Platform) delete(rawMsg, key) case "replicas": - err = unpopulate(val, "Replicas", &n.Replicas) + err = unpopulate(val, "Replicas", &n.Replicas) delete(rawMsg, key) case "taints": - err = unpopulate(val, "Taints", &n.Taints) + err = unpopulate(val, "Taints", &n.Taints) delete(rawMsg, key) case "tuningConfigs": - err = unpopulate(val, "TuningConfigs", &n.TuningConfigs) + err = unpopulate(val, "TuningConfigs", &n.TuningConfigs) delete(rawMsg, key) case "version": - err = unpopulate(val, "Version", &n.Version) + err = unpopulate(val, "Version", &n.Version) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", n, key) @@ -1494,19 +1493,19 @@ func (o *Operation) UnmarshalJSON(data []byte) error { var err error switch key { case "actionType": - err = unpopulate(val, "ActionType", &o.ActionType) + err = unpopulate(val, "ActionType", &o.ActionType) delete(rawMsg, key) case "display": - err = unpopulate(val, "Display", &o.Display) + err = unpopulate(val, "Display", &o.Display) delete(rawMsg, key) case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) + err = unpopulate(val, "IsDataAction", &o.IsDataAction) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &o.Name) + err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) case "origin": - err = unpopulate(val, "Origin", &o.Origin) + err = unpopulate(val, "Origin", &o.Origin) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", o, key) @@ -1538,16 +1537,16 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { var err error switch key { case "description": - err = unpopulate(val, "Description", &o.Description) + err = unpopulate(val, "Description", &o.Description) delete(rawMsg, key) case "operation": - err = unpopulate(val, "Operation", &o.Operation) + err = unpopulate(val, "Operation", &o.Operation) delete(rawMsg, key) case "provider": - err = unpopulate(val, "Provider", &o.Provider) + err = unpopulate(val, "Provider", &o.Provider) delete(rawMsg, key) case "resource": - err = unpopulate(val, "Resource", &o.Resource) + err = unpopulate(val, "Resource", &o.Resource) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", o, key) @@ -1577,10 +1576,10 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + err = unpopulate(val, "NextLink", &o.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &o.Value) + err = unpopulate(val, "Value", &o.Value) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", o, key) @@ -1613,19 +1612,19 @@ func (p *PlatformProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "etcdEncryptionSetId": - err = unpopulate(val, "EtcdEncryptionSetID", &p.EtcdEncryptionSetID) + err = unpopulate(val, "EtcdEncryptionSetID", &p.EtcdEncryptionSetID) delete(rawMsg, key) case "managedResourceGroup": - err = unpopulate(val, "ManagedResourceGroup", &p.ManagedResourceGroup) + err = unpopulate(val, "ManagedResourceGroup", &p.ManagedResourceGroup) delete(rawMsg, key) case "networkSecurityGroupId": - err = unpopulate(val, "NetworkSecurityGroupID", &p.NetworkSecurityGroupID) + err = unpopulate(val, "NetworkSecurityGroupID", &p.NetworkSecurityGroupID) delete(rawMsg, key) case "outboundType": - err = unpopulate(val, "OutboundType", &p.OutboundType) + err = unpopulate(val, "OutboundType", &p.OutboundType) delete(rawMsg, key) case "subnetId": - err = unpopulate(val, "SubnetID", &p.SubnetID) + err = unpopulate(val, "SubnetID", &p.SubnetID) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", p, key) @@ -1657,16 +1656,16 @@ func (p *ProxyProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "httpProxy": - err = unpopulate(val, "HTTPProxy", &p.HTTPProxy) + err = unpopulate(val, "HTTPProxy", &p.HTTPProxy) delete(rawMsg, key) case "httpsProxy": - err = unpopulate(val, "HTTPSProxy", &p.HTTPSProxy) + err = unpopulate(val, "HTTPSProxy", &p.HTTPSProxy) delete(rawMsg, key) case "noProxy": - err = unpopulate(val, "NoProxy", &p.NoProxy) + err = unpopulate(val, "NoProxy", &p.NoProxy) delete(rawMsg, key) case "trustedCa": - err = unpopulate(val, "TrustedCa", &p.TrustedCa) + err = unpopulate(val, "TrustedCa", &p.TrustedCa) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", p, key) @@ -1698,16 +1697,16 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { var err error switch key { case "id": - err = unpopulate(val, "ID", &p.ID) + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &p.Name) + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) + err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &p.Type) + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", p, key) @@ -1739,16 +1738,16 @@ func (r *Resource) UnmarshalJSON(data []byte) error { var err error switch key { case "id": - err = unpopulate(val, "ID", &r.ID) + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &r.Name) + err = unpopulate(val, "Name", &r.Name) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) + err = unpopulate(val, "SystemData", &r.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &r.Type) + err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", r, key) @@ -1782,22 +1781,22 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) + err = unpopulate(val, "CreatedBy", &s.CreatedBy) delete(rawMsg, key) case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) + err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) delete(rawMsg, key) case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", s, key) @@ -1828,13 +1827,13 @@ func (t *Taint) UnmarshalJSON(data []byte) error { var err error switch key { case "effect": - err = unpopulate(val, "Effect", &t.Effect) + err = unpopulate(val, "Effect", &t.Effect) delete(rawMsg, key) case "key": - err = unpopulate(val, "Key", &t.Key) + err = unpopulate(val, "Key", &t.Key) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &t.Value) + err = unpopulate(val, "Value", &t.Value) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", t, key) @@ -1864,10 +1863,10 @@ func (t *TokenClaimMappingsProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "groups": - err = unpopulate(val, "Groups", &t.Groups) + err = unpopulate(val, "Groups", &t.Groups) delete(rawMsg, key) case "username": - err = unpopulate(val, "Username", &t.Username) + err = unpopulate(val, "Username", &t.Username) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", t, key) @@ -1897,10 +1896,10 @@ func (t *TokenClaimValidationRuleProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "claim": - err = unpopulate(val, "Claim", &t.Claim) + err = unpopulate(val, "Claim", &t.Claim) delete(rawMsg, key) case "requiredValue": - err = unpopulate(val, "RequiredValue", &t.RequiredValue) + err = unpopulate(val, "RequiredValue", &t.RequiredValue) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", t, key) @@ -1931,13 +1930,13 @@ func (t *TokenIssuerProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "audiences": - err = unpopulate(val, "Audiences", &t.Audiences) + err = unpopulate(val, "Audiences", &t.Audiences) delete(rawMsg, key) case "ca": - err = unpopulate(val, "Ca", &t.Ca) + err = unpopulate(val, "Ca", &t.Ca) delete(rawMsg, key) case "url": - err = unpopulate(val, "URL", &t.URL) + err = unpopulate(val, "URL", &t.URL) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", t, key) @@ -1971,22 +1970,22 @@ func (t *TrackedResource) UnmarshalJSON(data []byte) error { var err error switch key { case "id": - err = unpopulate(val, "ID", &t.ID) + err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) case "location": - err = unpopulate(val, "Location", &t.Location) + err = unpopulate(val, "Location", &t.Location) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &t.Name) + err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &t.SystemData) + err = unpopulate(val, "SystemData", &t.SystemData) delete(rawMsg, key) case "tags": - err = unpopulate(val, "Tags", &t.Tags) + err = unpopulate(val, "Tags", &t.Tags) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &t.Type) + err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", t, key) @@ -2016,10 +2015,10 @@ func (u *UserAssignedIdentity) UnmarshalJSON(data []byte) error { var err error switch key { case "clientId": - err = unpopulate(val, "ClientID", &u.ClientID) + err = unpopulate(val, "ClientID", &u.ClientID) delete(rawMsg, key) case "principalId": - err = unpopulate(val, "PrincipalID", &u.PrincipalID) + err = unpopulate(val, "PrincipalID", &u.PrincipalID) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", u, key) @@ -2050,13 +2049,13 @@ func (v *VersionProfile) UnmarshalJSON(data []byte) error { var err error switch key { case "availableUpgrades": - err = unpopulate(val, "AvailableUpgrades", &v.AvailableUpgrades) + err = unpopulate(val, "AvailableUpgrades", &v.AvailableUpgrades) delete(rawMsg, key) case "channelGroup": - err = unpopulate(val, "ChannelGroup", &v.ChannelGroup) + err = unpopulate(val, "ChannelGroup", &v.ChannelGroup) delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &v.ID) + err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) default: err = fmt.Errorf("unmarshalling type %T, unknown field %q", v, key) @@ -2097,3 +2096,4 @@ func unpopulate(data json.RawMessage, fn string, v any) error { } return nil } + diff --git a/internal/api/v20240610preview/generated/nodepools_client.go b/internal/api/v20240610preview/generated/nodepools_client.go index c34a34572..fe348ccfc 100644 --- a/internal/api/v20240610preview/generated/nodepools_client.go +++ b/internal/api/v20240610preview/generated/nodepools_client.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -10,20 +10,19 @@ package generated import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NodePoolsClient contains the methods for the NodePools group. // Don't use this type directly, use NewNodePoolsClient() instead. type NodePoolsClient struct { - internal *arm.Client + internal *arm.Client subscriptionID string } @@ -38,7 +37,7 @@ func NewNodePoolsClient(subscriptionID string, credential azcore.TokenCredential } client := &NodePoolsClient{ subscriptionID: subscriptionID, - internal: cl, + internal: cl, } return client, nil } @@ -61,7 +60,7 @@ func (client *NodePoolsClient) BeginCreateOrUpdate(ctx context.Context, resource } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NodePoolsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -124,8 +123,8 @@ func (client *NodePoolsClient) createOrUpdateCreateRequest(ctx context.Context, req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, resource); err != nil { - return nil, err - } + return nil, err +} return req, nil } @@ -145,7 +144,7 @@ func (client *NodePoolsClient) BeginDelete(ctx context.Context, resourceGroupNam } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NodePoolsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -286,13 +285,13 @@ func (client *NodePoolsClient) getHandleResponse(resp *http.Response) (NodePools // - hcpOpenShiftClusterName - Name of HCP cluster // - options - NodePoolsClientListByParentOptions contains the optional parameters for the NodePoolsClient.NewListByParentPager // method. -func (client *NodePoolsClient) NewListByParentPager(resourceGroupName string, hcpOpenShiftClusterName string, options *NodePoolsClientListByParentOptions) *runtime.Pager[NodePoolsClientListByParentResponse] { +func (client *NodePoolsClient) NewListByParentPager(resourceGroupName string, hcpOpenShiftClusterName string, options *NodePoolsClientListByParentOptions) (*runtime.Pager[NodePoolsClientListByParentResponse]) { return runtime.NewPager(runtime.PagingHandler[NodePoolsClientListByParentResponse]{ More: func(page NodePoolsClientListByParentResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *NodePoolsClientListByParentResponse) (NodePoolsClientListByParentResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "NodePoolsClient.NewListByParentPager") + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "NodePoolsClient.NewListByParentPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -304,7 +303,7 @@ func (client *NodePoolsClient) NewListByParentPager(resourceGroupName string, hc return NodePoolsClientListByParentResponse{}, err } return client.listByParentHandleResponse(resp) - }, + }, Tracer: client.internal.Tracer(), }) } @@ -361,7 +360,7 @@ func (client *NodePoolsClient) BeginUpdate(ctx context.Context, resourceGroupNam } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NodePoolsClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -424,7 +423,8 @@ func (client *NodePoolsClient) updateCreateRequest(ctx context.Context, resource req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, properties); err != nil { - return nil, err - } + return nil, err +} return req, nil } + diff --git a/internal/api/v20240610preview/generated/operations_client.go b/internal/api/v20240610preview/generated/operations_client.go index 46e57d814..85b8e798c 100644 --- a/internal/api/v20240610preview/generated/operations_client.go +++ b/internal/api/v20240610preview/generated/operations_client.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -9,12 +9,11 @@ package generated import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -32,7 +31,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return nil, err } client := &OperationsClient{ - internal: cl, + internal: cl, } return client, nil } @@ -41,13 +40,13 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // // Generated from API version 2024-06-10-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. -func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { +func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) (*runtime.Pager[OperationsClientListResponse]) { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ More: func(page OperationsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -59,7 +58,7 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return OperationsClientListResponse{}, err } return client.listHandleResponse(resp) - }, + }, Tracer: client.internal.Tracer(), }) } @@ -86,3 +85,4 @@ func (client *OperationsClient) listHandleResponse(resp *http.Response) (Operati } return result, nil } + diff --git a/internal/api/v20240610preview/generated/options.go b/internal/api/v20240610preview/generated/options.go index b946d66c4..c278a1bf4 100644 --- a/internal/api/v20240610preview/generated/options.go +++ b/internal/api/v20240610preview/generated/options.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -95,3 +95,4 @@ type NodePoolsClientListByParentOptions struct { type OperationsClientListOptions struct { // placeholder for future optional parameters } + diff --git a/internal/api/v20240610preview/generated/responses.go b/internal/api/v20240610preview/generated/responses.go index 73d751f0f..f423354d9 100644 --- a/internal/api/v20240610preview/generated/responses.go +++ b/internal/api/v20240610preview/generated/responses.go @@ -1,7 +1,7 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. @@ -94,3 +94,4 @@ type OperationsClientListResponse struct { // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. OperationListResult } + diff --git a/internal/api/v20240610preview/generated/time_rfc3339.go b/internal/api/v20240610preview/generated/time_rfc3339.go index 2008988d2..a4bf0e975 100644 --- a/internal/api/v20240610preview/generated/time_rfc3339.go +++ b/internal/api/v20240610preview/generated/time_rfc3339.go @@ -1,23 +1,26 @@ //go:build go1.18 // +build go1.18 -// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.2, generator: @autorest/go@4.0.0-preview.63) +// Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.10.3, generator: @autorest/go@4.0.0-preview.63) // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. package generated + + import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "regexp" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) + + // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) @@ -59,7 +62,7 @@ func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { return t.Parse(layout, string(data)) } -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { +func (t *dateTimeRFC3339) UnmarshalText(data []byte) (error) { tzOffset := tzOffsetRegex.Match(data) hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") var layout string @@ -85,6 +88,7 @@ func (t dateTimeRFC3339) String() string { return time.Time(t).Format(time.RFC3339Nano) } + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return From 42bd4e1abd2877304ecbb777b3249d8ce327e33a Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Thu, 5 Dec 2024 14:31:59 -0500 Subject: [PATCH 2/2] api: Make PlatformProfile.networkSecurityGroupId optional --- .../hcpCluster-models.tsp | 2 +- .../preview/2024-06-10-preview/openapi.json | 3 +-- frontend/pkg/frontend/ocm.go | 24 ++++++++++++------- internal/api/hcpopenshiftcluster.go | 11 ++++----- internal/api/hcpopenshiftcluster_test.go | 7 +----- .../api/v20240610preview/generated/models.go | 6 ++--- 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/api/redhatopenshift/HcpCluster.Management/hcpCluster-models.tsp b/api/redhatopenshift/HcpCluster.Management/hcpCluster-models.tsp index 1997bdefe..bb5f53720 100644 --- a/api/redhatopenshift/HcpCluster.Management/hcpCluster-models.tsp +++ b/api/redhatopenshift/HcpCluster.Management/hcpCluster-models.tsp @@ -316,7 +316,7 @@ model PlatformProfile { outboundType?: OutboundType = OutboundType.loadBalancer; /** ResourceId for the network security group attached to the cluster subnet */ - networkSecurityGroupId: NetworkSecurityGroupResourceId; + networkSecurityGroupId?: NetworkSecurityGroupResourceId; /** The id of the disk encryption set to be used for etcd. * Configure this when `etcdEncryption` is set to true diff --git a/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/hcpclusters/preview/2024-06-10-preview/openapi.json b/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/hcpclusters/preview/2024-06-10-preview/openapi.json index f02e82be3..0e9e1d90c 100644 --- a/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/hcpclusters/preview/2024-06-10-preview/openapi.json +++ b/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenShift/hcpclusters/preview/2024-06-10-preview/openapi.json @@ -1952,8 +1952,7 @@ } }, "required": [ - "subnetId", - "networkSecurityGroupId" + "subnetId" ] }, "ProvisioningState": { diff --git a/frontend/pkg/frontend/ocm.go b/frontend/pkg/frontend/ocm.go index 29e1c5b97..23a298b39 100644 --- a/frontend/pkg/frontend/ocm.go +++ b/frontend/pkg/frontend/ocm.go @@ -149,14 +149,6 @@ func (f *Frontend) BuildCSCluster(resourceID *arm.ResourceID, tenantID string, h ID(f.location)). CloudProvider(cmv1.NewCloudProvider(). ID(csCloudProvider)). - Azure(cmv1.NewAzure(). - TenantID(tenantID). - SubscriptionID(resourceID.SubscriptionID). - ResourceGroupName(resourceID.ResourceGroupName). - ResourceName(hcpCluster.Name). - ManagedResourceGroupName(ensureManagedResourceGroupName(hcpCluster)). - SubnetResourceID(hcpCluster.Properties.Spec.Platform.SubnetID). - NetworkSecurityGroupResourceID(hcpCluster.Properties.Spec.Platform.NetworkSecurityGroupID)). Product(cmv1.NewProduct(). ID(csProductId)). Hypershift(cmv1.NewHypershift(). @@ -177,6 +169,22 @@ func (f *Frontend) BuildCSCluster(resourceID *arm.ResourceID, tenantID string, h FIPS(hcpCluster.Properties.Spec.FIPS). EtcdEncryption(hcpCluster.Properties.Spec.EtcdEncryption) + azureBuilder := cmv1.NewAzure(). + TenantID(tenantID). + SubscriptionID(resourceID.SubscriptionID). + ResourceGroupName(resourceID.ResourceGroupName). + ResourceName(hcpCluster.Name). + ManagedResourceGroupName(ensureManagedResourceGroupName(hcpCluster)). + SubnetResourceID(hcpCluster.Properties.Spec.Platform.SubnetID) + + // Cluster Service rejects an empty NetworkSecurityGroupResourceID string. + if hcpCluster.Properties.Spec.Platform.NetworkSecurityGroupID != "" { + azureBuilder = azureBuilder. + NetworkSecurityGroupResourceID(hcpCluster.Properties.Spec.Platform.NetworkSecurityGroupID) + } + + clusterBuilder = clusterBuilder.Azure(azureBuilder) + // Cluster Service rejects an empty DomainPrefix string. if hcpCluster.Properties.Spec.DNS.BaseDomainPrefix != "" { clusterBuilder = clusterBuilder. diff --git a/internal/api/hcpopenshiftcluster.go b/internal/api/hcpopenshiftcluster.go index 0bc56c1a7..f163d5605 100644 --- a/internal/api/hcpopenshiftcluster.go +++ b/internal/api/hcpopenshiftcluster.go @@ -84,12 +84,11 @@ type ProxyProfile struct { // PlatformProfile represents the Azure platform configuration. // Visibility for the entire struct is "read create". type PlatformProfile struct { - ManagedResourceGroup string `json:"managedResourceGroup,omitempty"` - SubnetID string `json:"subnetId,omitempty" validate:"required_for_put"` - OutboundType OutboundType `json:"outboundType,omitempty" validate:"omitempty,enum_outboundtype"` - //TODO: Is nsg required for PUT, or will we create if not specified? - NetworkSecurityGroupID string `json:"networkSecurityGroupId,omitempty" validate:"required_for_put"` - EtcdEncryptionSetID string `json:"etcdEncryptionSetId,omitempty"` + ManagedResourceGroup string `json:"managedResourceGroup,omitempty"` + SubnetID string `json:"subnetId,omitempty" validate:"required_for_put"` + OutboundType OutboundType `json:"outboundType,omitempty" validate:"omitempty,enum_outboundtype"` + NetworkSecurityGroupID string `json:"networkSecurityGroupId,omitempty"` + EtcdEncryptionSetID string `json:"etcdEncryptionSetId,omitempty"` } // ExternalAuthConfigProfile represents the external authentication configuration. diff --git a/internal/api/hcpopenshiftcluster_test.go b/internal/api/hcpopenshiftcluster_test.go index 925e3c158..ad1b39db1 100644 --- a/internal/api/hcpopenshiftcluster_test.go +++ b/internal/api/hcpopenshiftcluster_test.go @@ -48,8 +48,7 @@ func minimumValidCluster() *HCPOpenShiftCluster { Visibility: "public", }, Platform: PlatformProfile{ - SubnetID: "/something/something/virtualNetworks/subnets", - NetworkSecurityGroupID: "/something/something/networkSecurityGroups", + SubnetID: "/something/something/virtualNetworks/subnets", }, }, }, @@ -104,10 +103,6 @@ func TestClusterRequiredForPut(t *testing.T) { Message: "Missing required field 'subnetId'", Target: "properties.spec.platform.subnetId", }, - { - Message: "Missing required field 'networkSecurityGroupId'", - Target: "properties.spec.platform.networkSecurityGroupId", - }, }, }, { diff --git a/internal/api/v20240610preview/generated/models.go b/internal/api/v20240610preview/generated/models.go index dcc721a97..825c63037 100644 --- a/internal/api/v20240610preview/generated/models.go +++ b/internal/api/v20240610preview/generated/models.go @@ -574,9 +574,6 @@ type OperationListResult struct { // PlatformProfile - Azure specific configuration type PlatformProfile struct { - // REQUIRED; ResourceId for the network security group attached to the cluster subnet - NetworkSecurityGroupID *string - // REQUIRED; ResourceId for the subnet used by the control plane SubnetID *string @@ -587,6 +584,9 @@ type PlatformProfile struct { // Resource group to put cluster resources ManagedResourceGroup *string + // ResourceId for the network security group attached to the cluster subnet + NetworkSecurityGroupID *string + // The core outgoing configuration OutboundType *OutboundType }