diff --git a/.devcontainer/postCreate.sh b/.devcontainer/postCreate.sh index 533e9a691..c6835fba2 100755 --- a/.devcontainer/postCreate.sh +++ b/.devcontainer/postCreate.sh @@ -16,7 +16,7 @@ npm ci # Install the tsp cli # pinned to the last working version combination -npm install -g @typespec/compiler@0.55.0 +npm install -g @typespec/compiler@0.56.0 # Install azure/oav for validation of openapi and swagger example generation # https://github.com/Azure/oav diff --git a/api/autorest-config.yaml b/api/autorest-config.yaml index d8999b74d..06f5652b9 100644 --- a/api/autorest-config.yaml +++ b/api/autorest-config.yaml @@ -6,9 +6,8 @@ use: go: namespace: redhatopenshift project-folder: ../internal - output-folder: $(project-folder)/api/v20240610preview - file-prefix: generated + output-folder: $(project-folder)/api/v20240610preview/generated module-version: "0.0.1" - containing-module: "github.com/Azure/ARO-HCP/internal/api" + containing-module: "github.com/Azure/ARO-HCP/internal/api/v20240610preview" azure-arm: true generate-fakes: true diff --git a/api/redhatopenshift/HcpCluster/hcpCluster-models.tsp b/api/redhatopenshift/HcpCluster/hcpCluster-models.tsp index 7b6b7b18b..d96bc6906 100644 --- a/api/redhatopenshift/HcpCluster/hcpCluster-models.tsp +++ b/api/redhatopenshift/HcpCluster/hcpCluster-models.tsp @@ -28,7 +28,7 @@ model HcpOpenShiftClusterResource @segment("hcpOpenShiftClusters") name: string; - ...ManagedServiceIdentity; + ...ManagedServiceIdentityProperty; } // The NodePool needs to be TrackedResource for the following reasons: diff --git a/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenshift/preview/2024-06-10-preview/openapi.json b/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenshift/preview/2024-06-10-preview/openapi.json index 412f3e8ec..d9e012c6c 100644 --- a/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenshift/preview/2024-06-10-preview/openapi.json +++ b/api/redhatopenshift/resource-manager/Microsoft.RedHatOpenshift/preview/2024-06-10-preview/openapi.json @@ -2162,24 +2162,6 @@ } } }, - "Versions": { - "type": "string", - "description": "The available API versions.", - "enum": [ - "2024-06-10-preview" - ], - "x-ms-enum": { - "name": "Versions", - "modelAsString": true, - "values": [ - { - "name": "v2024_06_10_preview", - "value": "2024-06-10-preview", - "description": "2024-06-10-preview version" - } - ] - } - }, "Visibility": { "type": "string", "description": "The visibility of the API server", diff --git a/internal/api/v20240610preview/generated_client_factory.go b/internal/api/v20240610preview/generated/client_factory.go similarity index 98% rename from internal/api/v20240610preview/generated_client_factory.go rename to internal/api/v20240610preview/generated/client_factory.go index 60b86306f..3f6e0b1b9 100644 --- a/internal/api/v20240610preview/generated_client_factory.go +++ b/internal/api/v20240610preview/generated/client_factory.go @@ -5,7 +5,7 @@ // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. -package v20240610preview +package generated import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore" diff --git a/internal/api/v20240610preview/generated_constants.go b/internal/api/v20240610preview/generated/constants.go similarity index 93% rename from internal/api/v20240610preview/generated_constants.go rename to internal/api/v20240610preview/generated/constants.go index 41a37e922..dbc73d82b 100644 --- a/internal/api/v20240610preview/generated_constants.go +++ b/internal/api/v20240610preview/generated/constants.go @@ -5,7 +5,7 @@ // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. -package v20240610preview +package generated const ( moduleName = "undefined" @@ -160,21 +160,6 @@ func PossibleResourceProvisioningStateValues() []ResourceProvisioningState { } } -// Versions - The available API versions. -type Versions string - -const ( - // VersionsV20240610Preview - 2024-06-10-preview version - VersionsV20240610Preview Versions = "2024-06-10-preview" -) - -// PossibleVersionsValues returns the possible values for the Versions const type. -func PossibleVersionsValues() []Versions { - return []Versions{ - VersionsV20240610Preview, - } -} - // Visibility - The visibility of the API server type Visibility string diff --git a/internal/api/v20240610preview/fake/generated_hcpclusterversionoperations_server.go b/internal/api/v20240610preview/generated/fake/hcpclusterversionoperations_server.go similarity index 80% rename from internal/api/v20240610preview/fake/generated_hcpclusterversionoperations_server.go rename to internal/api/v20240610preview/generated/fake/hcpclusterversionoperations_server.go index f9de0a656..421e0e9a3 100644 --- a/internal/api/v20240610preview/fake/generated_hcpclusterversionoperations_server.go +++ b/internal/api/v20240610preview/generated/fake/hcpclusterversionoperations_server.go @@ -10,7 +10,7 @@ package fake import ( "errors" "fmt" - "github.com/Azure/ARO-HCP/internal/api/v20240610preview" + "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" @@ -20,29 +20,29 @@ import ( "regexp" ) -// HcpClusterVersionOperationsServer is a fake server for instances of the v20240610preview.HcpClusterVersionOperationsClient type. +// HcpClusterVersionOperationsServer is a fake server for instances of the generated.HcpClusterVersionOperationsClient type. type HcpClusterVersionOperationsServer struct{ // NewListByLocationPager is the fake for method HcpClusterVersionOperationsClient.NewListByLocationPager // HTTP status codes to indicate success: http.StatusOK - NewListByLocationPager func(location string, options *v20240610preview.HcpClusterVersionOperationsClientListByLocationOptions) (resp azfake.PagerResponder[v20240610preview.HcpClusterVersionOperationsClientListByLocationResponse]) + NewListByLocationPager func(location string, options *generated.HcpClusterVersionOperationsClientListByLocationOptions) (resp azfake.PagerResponder[generated.HcpClusterVersionOperationsClientListByLocationResponse]) } // NewHcpClusterVersionOperationsServerTransport creates a new instance of HcpClusterVersionOperationsServerTransport with the provided implementation. -// The returned HcpClusterVersionOperationsServerTransport instance is connected to an instance of v20240610preview.HcpClusterVersionOperationsClient via the +// The returned HcpClusterVersionOperationsServerTransport instance is connected to an instance of generated.HcpClusterVersionOperationsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewHcpClusterVersionOperationsServerTransport(srv *HcpClusterVersionOperationsServer) *HcpClusterVersionOperationsServerTransport { return &HcpClusterVersionOperationsServerTransport{ srv: srv, - newListByLocationPager: newTracker[azfake.PagerResponder[v20240610preview.HcpClusterVersionOperationsClientListByLocationResponse]](), + newListByLocationPager: newTracker[azfake.PagerResponder[generated.HcpClusterVersionOperationsClientListByLocationResponse]](), } } -// HcpClusterVersionOperationsServerTransport connects instances of v20240610preview.HcpClusterVersionOperationsClient to instances of HcpClusterVersionOperationsServer. +// HcpClusterVersionOperationsServerTransport connects instances of generated.HcpClusterVersionOperationsClient to instances of HcpClusterVersionOperationsServer. // Don't use this type directly, use NewHcpClusterVersionOperationsServerTransport instead. type HcpClusterVersionOperationsServerTransport struct { srv *HcpClusterVersionOperationsServer - newListByLocationPager *tracker[azfake.PagerResponder[v20240610preview.HcpClusterVersionOperationsClientListByLocationResponse]] + newListByLocationPager *tracker[azfake.PagerResponder[generated.HcpClusterVersionOperationsClientListByLocationResponse]] } // Do implements the policy.Transporter interface for HcpClusterVersionOperationsServerTransport. @@ -89,7 +89,7 @@ func (h *HcpClusterVersionOperationsServerTransport) dispatchNewListByLocationPa resp := h.srv.NewListByLocationPager(locationParam, nil) newListByLocationPager = &resp h.newListByLocationPager.add(req, newListByLocationPager) - server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *v20240610preview.HcpClusterVersionOperationsClientListByLocationResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *generated.HcpClusterVersionOperationsClientListByLocationResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } diff --git a/internal/api/v20240610preview/fake/generated_hcpopenshiftclusters_server.go b/internal/api/v20240610preview/generated/fake/hcpopenshiftclusters_server.go similarity index 82% rename from internal/api/v20240610preview/fake/generated_hcpopenshiftclusters_server.go rename to internal/api/v20240610preview/generated/fake/hcpopenshiftclusters_server.go index b8d5705b7..738b45218 100644 --- a/internal/api/v20240610preview/fake/generated_hcpopenshiftclusters_server.go +++ b/internal/api/v20240610preview/generated/fake/hcpopenshiftclusters_server.go @@ -11,7 +11,7 @@ import ( "context" "errors" "fmt" - "github.com/Azure/ARO-HCP/internal/api/v20240610preview" + "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" @@ -21,65 +21,65 @@ import ( "regexp" ) -// HcpOpenShiftClustersServer is a fake server for instances of the v20240610preview.HcpOpenShiftClustersClient type. +// HcpOpenShiftClustersServer is a fake server for instances of the generated.HcpOpenShiftClustersClient type. 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 *v20240610preview.HcpOpenShiftClustersClientAdminCredentialsOptions) (resp azfake.Responder[v20240610preview.HcpOpenShiftClustersClientAdminCredentialsResponse], errResp azfake.ErrorResponder) + AdminCredentials func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, options *generated.HcpOpenShiftClustersClientAdminCredentialsOptions) (resp azfake.Responder[generated.HcpOpenShiftClustersClientAdminCredentialsResponse], errResp azfake.ErrorResponder) // BeginCreateOrUpdate is the fake for method HcpOpenShiftClustersClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, resource v20240610preview.HcpOpenShiftClusterResource, options *v20240610preview.HcpOpenShiftClustersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20240610preview.HcpOpenShiftClustersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, resource generated.HcpOpenShiftClusterResource, options *generated.HcpOpenShiftClustersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[generated.HcpOpenShiftClustersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method HcpOpenShiftClustersClient.BeginDelete // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, options *v20240610preview.HcpOpenShiftClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[v20240610preview.HcpOpenShiftClustersClientDeleteResponse], errResp azfake.ErrorResponder) + BeginDelete func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, options *generated.HcpOpenShiftClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[generated.HcpOpenShiftClustersClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method HcpOpenShiftClustersClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, options *v20240610preview.HcpOpenShiftClustersClientGetOptions) (resp azfake.Responder[v20240610preview.HcpOpenShiftClustersClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, options *generated.HcpOpenShiftClustersClientGetOptions) (resp azfake.Responder[generated.HcpOpenShiftClustersClientGetResponse], errResp azfake.ErrorResponder) // KubeConfig is the fake for method HcpOpenShiftClustersClient.KubeConfig // HTTP status codes to indicate success: http.StatusOK - KubeConfig func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, options *v20240610preview.HcpOpenShiftClustersClientKubeConfigOptions) (resp azfake.Responder[v20240610preview.HcpOpenShiftClustersClientKubeConfigResponse], errResp azfake.ErrorResponder) + KubeConfig func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, options *generated.HcpOpenShiftClustersClientKubeConfigOptions) (resp azfake.Responder[generated.HcpOpenShiftClustersClientKubeConfigResponse], errResp azfake.ErrorResponder) // NewListByResourceGroupPager is the fake for method HcpOpenShiftClustersClient.NewListByResourceGroupPager // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *v20240610preview.HcpOpenShiftClustersClientListByResourceGroupOptions) (resp azfake.PagerResponder[v20240610preview.HcpOpenShiftClustersClientListByResourceGroupResponse]) + NewListByResourceGroupPager func(resourceGroupName string, options *generated.HcpOpenShiftClustersClientListByResourceGroupOptions) (resp azfake.PagerResponder[generated.HcpOpenShiftClustersClientListByResourceGroupResponse]) // NewListBySubscriptionPager is the fake for method HcpOpenShiftClustersClient.NewListBySubscriptionPager // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *v20240610preview.HcpOpenShiftClustersClientListBySubscriptionOptions) (resp azfake.PagerResponder[v20240610preview.HcpOpenShiftClustersClientListBySubscriptionResponse]) + NewListBySubscriptionPager func(options *generated.HcpOpenShiftClustersClientListBySubscriptionOptions) (resp azfake.PagerResponder[generated.HcpOpenShiftClustersClientListBySubscriptionResponse]) // 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 v20240610preview.HcpOpenShiftClusterResourceUpdate, options *v20240610preview.HcpOpenShiftClustersClientBeginUpdateOptions) (resp azfake.PollerResponder[v20240610preview.HcpOpenShiftClustersClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, properties generated.HcpOpenShiftClusterResourceUpdate, options *generated.HcpOpenShiftClustersClientBeginUpdateOptions) (resp azfake.PollerResponder[generated.HcpOpenShiftClustersClientUpdateResponse], errResp azfake.ErrorResponder) } // NewHcpOpenShiftClustersServerTransport creates a new instance of HcpOpenShiftClustersServerTransport with the provided implementation. -// The returned HcpOpenShiftClustersServerTransport instance is connected to an instance of v20240610preview.HcpOpenShiftClustersClient via the +// The returned HcpOpenShiftClustersServerTransport instance is connected to an instance of generated.HcpOpenShiftClustersClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewHcpOpenShiftClustersServerTransport(srv *HcpOpenShiftClustersServer) *HcpOpenShiftClustersServerTransport { return &HcpOpenShiftClustersServerTransport{ srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20240610preview.HcpOpenShiftClustersClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[v20240610preview.HcpOpenShiftClustersClientDeleteResponse]](), - newListByResourceGroupPager: newTracker[azfake.PagerResponder[v20240610preview.HcpOpenShiftClustersClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[v20240610preview.HcpOpenShiftClustersClientListBySubscriptionResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[v20240610preview.HcpOpenShiftClustersClientUpdateResponse]](), + 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]](), } } -// HcpOpenShiftClustersServerTransport connects instances of v20240610preview.HcpOpenShiftClustersClient to instances of HcpOpenShiftClustersServer. +// 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[v20240610preview.HcpOpenShiftClustersClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[v20240610preview.HcpOpenShiftClustersClientDeleteResponse]] - newListByResourceGroupPager *tracker[azfake.PagerResponder[v20240610preview.HcpOpenShiftClustersClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[v20240610preview.HcpOpenShiftClustersClientListBySubscriptionResponse]] - beginUpdate *tracker[azfake.PollerResponder[v20240610preview.HcpOpenShiftClustersClientUpdateResponse]] + 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]] } // Do implements the policy.Transporter interface for HcpOpenShiftClustersServerTransport. @@ -166,7 +166,7 @@ func (h *HcpOpenShiftClustersServerTransport) dispatchBeginCreateOrUpdate(req *h if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[v20240610preview.HcpOpenShiftClusterResource](req) + body, err := server.UnmarshalRequestAsJSON[generated.HcpOpenShiftClusterResource](req) if err != nil { return nil, err } @@ -331,7 +331,7 @@ func (h *HcpOpenShiftClustersServerTransport) dispatchNewListByResourceGroupPage resp := h.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) newListByResourceGroupPager = &resp h.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *v20240610preview.HcpOpenShiftClustersClientListByResourceGroupResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *generated.HcpOpenShiftClustersClientListByResourceGroupResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -364,7 +364,7 @@ func (h *HcpOpenShiftClustersServerTransport) dispatchNewListBySubscriptionPager resp := h.srv.NewListBySubscriptionPager(nil) newListBySubscriptionPager = &resp h.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *v20240610preview.HcpOpenShiftClustersClientListBySubscriptionResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *generated.HcpOpenShiftClustersClientListBySubscriptionResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -394,7 +394,7 @@ func (h *HcpOpenShiftClustersServerTransport) dispatchBeginUpdate(req *http.Requ if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[v20240610preview.HcpOpenShiftClusterResourceUpdate](req) + body, err := server.UnmarshalRequestAsJSON[generated.HcpOpenShiftClusterResourceUpdate](req) if err != nil { return nil, err } diff --git a/internal/api/v20240610preview/fake/generated_internal.go b/internal/api/v20240610preview/generated/fake/internal.go similarity index 100% rename from internal/api/v20240610preview/fake/generated_internal.go rename to internal/api/v20240610preview/generated/fake/internal.go diff --git a/internal/api/v20240610preview/fake/generated_nodepools_server.go b/internal/api/v20240610preview/generated/fake/nodepools_server.go similarity index 83% rename from internal/api/v20240610preview/fake/generated_nodepools_server.go rename to internal/api/v20240610preview/generated/fake/nodepools_server.go index 0d16641c9..8626aa8fd 100644 --- a/internal/api/v20240610preview/fake/generated_nodepools_server.go +++ b/internal/api/v20240610preview/generated/fake/nodepools_server.go @@ -11,7 +11,7 @@ import ( "context" "errors" "fmt" - "github.com/Azure/ARO-HCP/internal/api/v20240610preview" + "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" @@ -21,51 +21,51 @@ import ( "regexp" ) -// NodePoolsServer is a fake server for instances of the v20240610preview.NodePoolsClient type. +// NodePoolsServer is a fake server for instances of the generated.NodePoolsClient type. 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 v20240610preview.HcpOpenShiftClusterNodePoolResource, options *v20240610preview.NodePoolsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20240610preview.NodePoolsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + 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) // BeginDelete is the fake for method NodePoolsClient.BeginDelete // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, nodePoolName string, options *v20240610preview.NodePoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[v20240610preview.NodePoolsClientDeleteResponse], errResp azfake.ErrorResponder) + BeginDelete func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, nodePoolName string, options *generated.NodePoolsClientBeginDeleteOptions) (resp azfake.PollerResponder[generated.NodePoolsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method NodePoolsClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, nodePoolName string, options *v20240610preview.NodePoolsClientGetOptions) (resp azfake.Responder[v20240610preview.NodePoolsClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, nodePoolName string, options *generated.NodePoolsClientGetOptions) (resp azfake.Responder[generated.NodePoolsClientGetResponse], errResp azfake.ErrorResponder) // NewListByHcpOpenShiftClusterResourcePager is the fake for method NodePoolsClient.NewListByHcpOpenShiftClusterResourcePager // HTTP status codes to indicate success: http.StatusOK - NewListByHcpOpenShiftClusterResourcePager func(resourceGroupName string, hcpOpenShiftClusterName string, options *v20240610preview.NodePoolsClientListByHcpOpenShiftClusterResourceOptions) (resp azfake.PagerResponder[v20240610preview.NodePoolsClientListByHcpOpenShiftClusterResourceResponse]) + NewListByHcpOpenShiftClusterResourcePager func(resourceGroupName string, hcpOpenShiftClusterName string, options *generated.NodePoolsClientListByHcpOpenShiftClusterResourceOptions) (resp azfake.PagerResponder[generated.NodePoolsClientListByHcpOpenShiftClusterResourceResponse]) // 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 v20240610preview.HcpOpenShiftClusterNodePoolResourceUpdate, options *v20240610preview.NodePoolsClientBeginUpdateOptions) (resp azfake.PollerResponder[v20240610preview.NodePoolsClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, hcpOpenShiftClusterName string, nodePoolName string, properties generated.HcpOpenShiftClusterNodePoolResourceUpdate, options *generated.NodePoolsClientBeginUpdateOptions) (resp azfake.PollerResponder[generated.NodePoolsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewNodePoolsServerTransport creates a new instance of NodePoolsServerTransport with the provided implementation. -// The returned NodePoolsServerTransport instance is connected to an instance of v20240610preview.NodePoolsClient via the +// The returned NodePoolsServerTransport instance is connected to an instance of generated.NodePoolsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewNodePoolsServerTransport(srv *NodePoolsServer) *NodePoolsServerTransport { return &NodePoolsServerTransport{ srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20240610preview.NodePoolsClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[v20240610preview.NodePoolsClientDeleteResponse]](), - newListByHcpOpenShiftClusterResourcePager: newTracker[azfake.PagerResponder[v20240610preview.NodePoolsClientListByHcpOpenShiftClusterResourceResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[v20240610preview.NodePoolsClientUpdateResponse]](), + beginCreateOrUpdate: newTracker[azfake.PollerResponder[generated.NodePoolsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[generated.NodePoolsClientDeleteResponse]](), + newListByHcpOpenShiftClusterResourcePager: newTracker[azfake.PagerResponder[generated.NodePoolsClientListByHcpOpenShiftClusterResourceResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[generated.NodePoolsClientUpdateResponse]](), } } -// NodePoolsServerTransport connects instances of v20240610preview.NodePoolsClient to instances of NodePoolsServer. +// 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[v20240610preview.NodePoolsClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[v20240610preview.NodePoolsClientDeleteResponse]] - newListByHcpOpenShiftClusterResourcePager *tracker[azfake.PagerResponder[v20240610preview.NodePoolsClientListByHcpOpenShiftClusterResourceResponse]] - beginUpdate *tracker[azfake.PollerResponder[v20240610preview.NodePoolsClientUpdateResponse]] + beginCreateOrUpdate *tracker[azfake.PollerResponder[generated.NodePoolsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[generated.NodePoolsClientDeleteResponse]] + newListByHcpOpenShiftClusterResourcePager *tracker[azfake.PagerResponder[generated.NodePoolsClientListByHcpOpenShiftClusterResourceResponse]] + beginUpdate *tracker[azfake.PollerResponder[generated.NodePoolsClientUpdateResponse]] } // Do implements the policy.Transporter interface for NodePoolsServerTransport. @@ -113,7 +113,7 @@ func (n *NodePoolsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request if matches == nil || len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[v20240610preview.HcpOpenShiftClusterNodePoolResource](req) + body, err := server.UnmarshalRequestAsJSON[generated.HcpOpenShiftClusterNodePoolResource](req) if err != nil { return nil, err } @@ -261,7 +261,7 @@ func (n *NodePoolsServerTransport) dispatchNewListByHcpOpenShiftClusterResourceP resp := n.srv.NewListByHcpOpenShiftClusterResourcePager(resourceGroupNameParam, hcpOpenShiftClusterNameParam, nil) newListByHcpOpenShiftClusterResourcePager = &resp n.newListByHcpOpenShiftClusterResourcePager.add(req, newListByHcpOpenShiftClusterResourcePager) - server.PagerResponderInjectNextLinks(newListByHcpOpenShiftClusterResourcePager, req, func(page *v20240610preview.NodePoolsClientListByHcpOpenShiftClusterResourceResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListByHcpOpenShiftClusterResourcePager, req, func(page *generated.NodePoolsClientListByHcpOpenShiftClusterResourceResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -291,7 +291,7 @@ func (n *NodePoolsServerTransport) dispatchBeginUpdate(req *http.Request) (*http if matches == nil || len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[v20240610preview.HcpOpenShiftClusterNodePoolResourceUpdate](req) + body, err := server.UnmarshalRequestAsJSON[generated.HcpOpenShiftClusterNodePoolResourceUpdate](req) if err != nil { return nil, err } diff --git a/internal/api/v20240610preview/fake/generated_operations_server.go b/internal/api/v20240610preview/generated/fake/operations_server.go similarity index 78% rename from internal/api/v20240610preview/fake/generated_operations_server.go rename to internal/api/v20240610preview/generated/fake/operations_server.go index 303db033b..2b949f4f9 100644 --- a/internal/api/v20240610preview/fake/generated_operations_server.go +++ b/internal/api/v20240610preview/generated/fake/operations_server.go @@ -10,7 +10,7 @@ package fake import ( "errors" "fmt" - "github.com/Azure/ARO-HCP/internal/api/v20240610preview" + "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" @@ -18,29 +18,29 @@ import ( "net/http" ) -// OperationsServer is a fake server for instances of the v20240610preview.OperationsClient type. +// OperationsServer is a fake server for instances of the generated.OperationsClient type. type OperationsServer struct{ // NewListPager is the fake for method OperationsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *v20240610preview.OperationsClientListOptions) (resp azfake.PagerResponder[v20240610preview.OperationsClientListResponse]) + NewListPager func(options *generated.OperationsClientListOptions) (resp azfake.PagerResponder[generated.OperationsClientListResponse]) } // NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. -// The returned OperationsServerTransport instance is connected to an instance of v20240610preview.OperationsClient via the +// The returned OperationsServerTransport instance is connected to an instance of generated.OperationsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { return &OperationsServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[v20240610preview.OperationsClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[generated.OperationsClientListResponse]](), } } -// OperationsServerTransport connects instances of v20240610preview.OperationsClient to instances of OperationsServer. +// OperationsServerTransport connects instances of generated.OperationsClient to instances of OperationsServer. // Don't use this type directly, use NewOperationsServerTransport instead. type OperationsServerTransport struct { srv *OperationsServer - newListPager *tracker[azfake.PagerResponder[v20240610preview.OperationsClientListResponse]] + newListPager *tracker[azfake.PagerResponder[generated.OperationsClientListResponse]] } // Do implements the policy.Transporter interface for OperationsServerTransport. @@ -77,7 +77,7 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht resp := o.srv.NewListPager(nil) newListPager = &resp o.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20240610preview.OperationsClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *generated.OperationsClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } diff --git a/internal/api/v20240610preview/fake/generated_server_factory.go b/internal/api/v20240610preview/generated/fake/server_factory.go similarity index 92% rename from internal/api/v20240610preview/fake/generated_server_factory.go rename to internal/api/v20240610preview/generated/fake/server_factory.go index 3b6466e78..5e7b435b5 100644 --- a/internal/api/v20240610preview/fake/generated_server_factory.go +++ b/internal/api/v20240610preview/generated/fake/server_factory.go @@ -16,7 +16,7 @@ import ( "sync" ) -// ServerFactory is a fake server for instances of the v20240610preview.ClientFactory type. +// ServerFactory is a fake server for instances of the generated.ClientFactory type. type ServerFactory struct { HcpClusterVersionOperationsServer HcpClusterVersionOperationsServer HcpOpenShiftClustersServer HcpOpenShiftClustersServer @@ -25,7 +25,7 @@ type ServerFactory struct { } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. -// The returned ServerFactoryTransport instance is connected to an instance of v20240610preview.ClientFactory via the +// The returned ServerFactoryTransport instance is connected to an instance of generated.ClientFactory via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { return &ServerFactoryTransport{ @@ -33,7 +33,7 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { } } -// ServerFactoryTransport connects instances of v20240610preview.ClientFactory to instances of ServerFactory. +// ServerFactoryTransport connects instances of generated.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { srv *ServerFactory diff --git a/internal/api/v20240610preview/fake/generated_time_rfc3339.go b/internal/api/v20240610preview/generated/fake/time_rfc3339.go similarity index 100% rename from internal/api/v20240610preview/fake/generated_time_rfc3339.go rename to internal/api/v20240610preview/generated/fake/time_rfc3339.go diff --git a/internal/api/v20240610preview/generated_hcpclusterversionoperations_client.go b/internal/api/v20240610preview/generated/hcpclusterversionoperations_client.go similarity index 99% rename from internal/api/v20240610preview/generated_hcpclusterversionoperations_client.go rename to internal/api/v20240610preview/generated/hcpclusterversionoperations_client.go index 2a322be1c..ab65ee524 100644 --- a/internal/api/v20240610preview/generated_hcpclusterversionoperations_client.go +++ b/internal/api/v20240610preview/generated/hcpclusterversionoperations_client.go @@ -5,7 +5,7 @@ // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. -package v20240610preview +package generated import ( "context" diff --git a/internal/api/v20240610preview/generated_hcpopenshiftclusters_client.go b/internal/api/v20240610preview/generated/hcpopenshiftclusters_client.go similarity index 99% rename from internal/api/v20240610preview/generated_hcpopenshiftclusters_client.go rename to internal/api/v20240610preview/generated/hcpopenshiftclusters_client.go index 14760a0ad..b86d4f860 100644 --- a/internal/api/v20240610preview/generated_hcpopenshiftclusters_client.go +++ b/internal/api/v20240610preview/generated/hcpopenshiftclusters_client.go @@ -5,7 +5,7 @@ // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. -package v20240610preview +package generated import ( "context" diff --git a/internal/api/v20240610preview/generated_models.go b/internal/api/v20240610preview/generated/models.go similarity index 99% rename from internal/api/v20240610preview/generated_models.go rename to internal/api/v20240610preview/generated/models.go index 2c8155e76..ab61d07a6 100644 --- a/internal/api/v20240610preview/generated_models.go +++ b/internal/api/v20240610preview/generated/models.go @@ -5,7 +5,7 @@ // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. -package v20240610preview +package generated import "time" diff --git a/internal/api/v20240610preview/generated_models_serde.go b/internal/api/v20240610preview/generated/models_serde.go similarity index 99% rename from internal/api/v20240610preview/generated_models_serde.go rename to internal/api/v20240610preview/generated/models_serde.go index a51fb6f7f..78898fa7c 100644 --- a/internal/api/v20240610preview/generated_models_serde.go +++ b/internal/api/v20240610preview/generated/models_serde.go @@ -5,7 +5,7 @@ // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. -package v20240610preview +package generated import ( "encoding/json" diff --git a/internal/api/v20240610preview/generated_nodepools_client.go b/internal/api/v20240610preview/generated/nodepools_client.go similarity index 99% rename from internal/api/v20240610preview/generated_nodepools_client.go rename to internal/api/v20240610preview/generated/nodepools_client.go index 236e3bed7..c8c180c1c 100644 --- a/internal/api/v20240610preview/generated_nodepools_client.go +++ b/internal/api/v20240610preview/generated/nodepools_client.go @@ -5,7 +5,7 @@ // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. -package v20240610preview +package generated import ( "context" diff --git a/internal/api/v20240610preview/generated_operations_client.go b/internal/api/v20240610preview/generated/operations_client.go similarity index 99% rename from internal/api/v20240610preview/generated_operations_client.go rename to internal/api/v20240610preview/generated/operations_client.go index 44180c9d9..08d73934e 100644 --- a/internal/api/v20240610preview/generated_operations_client.go +++ b/internal/api/v20240610preview/generated/operations_client.go @@ -5,7 +5,7 @@ // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. -package v20240610preview +package generated import ( "context" diff --git a/internal/api/v20240610preview/generated_options.go b/internal/api/v20240610preview/generated/options.go similarity index 99% rename from internal/api/v20240610preview/generated_options.go rename to internal/api/v20240610preview/generated/options.go index 12d7823dc..23af095d3 100644 --- a/internal/api/v20240610preview/generated_options.go +++ b/internal/api/v20240610preview/generated/options.go @@ -5,7 +5,7 @@ // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. -package v20240610preview +package generated // HcpClusterVersionOperationsClientListByLocationOptions contains the optional parameters for the HcpClusterVersionOperationsClient.NewListByLocationPager // method. diff --git a/internal/api/v20240610preview/generated_responses.go b/internal/api/v20240610preview/generated/responses.go similarity index 99% rename from internal/api/v20240610preview/generated_responses.go rename to internal/api/v20240610preview/generated/responses.go index 4e0c6ecba..bc3483392 100644 --- a/internal/api/v20240610preview/generated_responses.go +++ b/internal/api/v20240610preview/generated/responses.go @@ -5,7 +5,7 @@ // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. -package v20240610preview +package generated // HcpClusterVersionOperationsClientListByLocationResponse contains the response from method HcpClusterVersionOperationsClient.NewListByLocationPager. type HcpClusterVersionOperationsClientListByLocationResponse struct { diff --git a/internal/api/v20240610preview/generated_time_rfc3339.go b/internal/api/v20240610preview/generated/time_rfc3339.go similarity index 99% rename from internal/api/v20240610preview/generated_time_rfc3339.go rename to internal/api/v20240610preview/generated/time_rfc3339.go index 41ea5a189..b8083a52d 100644 --- a/internal/api/v20240610preview/generated_time_rfc3339.go +++ b/internal/api/v20240610preview/generated/time_rfc3339.go @@ -5,7 +5,7 @@ // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Code generated by @autorest/go. DO NOT EDIT. -package v20240610preview +package generated diff --git a/internal/api/v20240610preview/hcpopenshiftclusters_methods.go b/internal/api/v20240610preview/hcpopenshiftclusters_methods.go index 2842ee8de..e23fe774c 100644 --- a/internal/api/v20240610preview/hcpopenshiftclusters_methods.go +++ b/internal/api/v20240610preview/hcpopenshiftclusters_methods.go @@ -10,26 +10,67 @@ import ( "github.com/Azure/ARO-HCP/internal/api" "github.com/Azure/ARO-HCP/internal/api/arm" + "github.com/Azure/ARO-HCP/internal/api/v20240610preview/generated" ) -func newVersionProfile(from *api.VersionProfile) *VersionProfile { - return &VersionProfile{ +type HcpOpenShiftClusterResource struct { + generated.HcpOpenShiftClusterResource +} + +type VersionProfile struct { + generated.VersionProfile +} + +type DNSProfile struct { + generated.DNSProfile +} + +type NetworkProfile struct { + generated.NetworkProfile +} + +type ConsoleProfile struct { + generated.ConsoleProfile +} + +type APIProfile struct { + generated.APIProfile +} + +type ProxyProfile struct { + generated.ProxyProfile +} + +type PlatformProfile struct { + generated.PlatformProfile +} + +type ExternalAuthConfigProfile struct { + generated.ExternalAuthConfigProfile +} + +type IngressProfile struct { + generated.IngressProfile +} + +func newVersionProfile(from *api.VersionProfile) *generated.VersionProfile { + return &generated.VersionProfile{ ID: api.Ptr(from.ID), ChannelGroup: api.Ptr(from.ChannelGroup), AvailableUpgrades: api.StringSliceToStringPtrSlice(from.AvailableUpgrades), } } -func newDNSProfile(from *api.DNSProfile) *DNSProfile { - return &DNSProfile{ +func newDNSProfile(from *api.DNSProfile) *generated.DNSProfile { + return &generated.DNSProfile{ BaseDomain: api.Ptr(from.BaseDomain), BaseDomainPrefix: api.Ptr(from.BaseDomainPrefix), } } -func newNetworkProfile(from *api.NetworkProfile) *NetworkProfile { - return &NetworkProfile{ - NetworkType: api.Ptr(NetworkType(from.NetworkType)), +func newNetworkProfile(from *api.NetworkProfile) *generated.NetworkProfile { + return &generated.NetworkProfile{ + NetworkType: api.Ptr(generated.NetworkType(from.NetworkType)), PodCidr: api.Ptr(from.PodCIDR), ServiceCidr: api.Ptr(from.ServiceCIDR), MachineCidr: api.Ptr(from.MachineCIDR), @@ -37,22 +78,22 @@ func newNetworkProfile(from *api.NetworkProfile) *NetworkProfile { } } -func newConsoleProfile(from *api.ConsoleProfile) *ConsoleProfile { - return &ConsoleProfile{ +func newConsoleProfile(from *api.ConsoleProfile) *generated.ConsoleProfile { + return &generated.ConsoleProfile{ URL: api.Ptr(from.URL), } } -func newAPIProfile(from *api.APIProfile) *APIProfile { - return &APIProfile{ +func newAPIProfile(from *api.APIProfile) *generated.APIProfile { + return &generated.APIProfile{ URL: api.Ptr(from.URL), IP: api.Ptr(from.IP), - Visibility: api.Ptr(Visibility(from.Visibility)), + Visibility: api.Ptr(generated.Visibility(from.Visibility)), } } -func newProxyProfile(from *api.ProxyProfile) *ProxyProfile { - return &ProxyProfile{ +func newProxyProfile(from *api.ProxyProfile) *generated.ProxyProfile { + return &generated.ProxyProfile{ HTTPProxy: api.Ptr(from.HTTPProxy), HTTPSProxy: api.Ptr(from.HTTPSProxy), NoProxy: api.Ptr(from.NoProxy), @@ -60,44 +101,44 @@ func newProxyProfile(from *api.ProxyProfile) *ProxyProfile { } } -func newPlatformProfile(from *api.PlatformProfile) *PlatformProfile { - return &PlatformProfile{ +func newPlatformProfile(from *api.PlatformProfile) *generated.PlatformProfile { + return &generated.PlatformProfile{ ManagedResourceGroup: api.Ptr(from.ManagedResourceGroup), SubnetID: api.Ptr(from.SubnetID), - OutboundType: api.Ptr(OutboundType(from.OutboundType)), + OutboundType: api.Ptr(generated.OutboundType(from.OutboundType)), NetworkSecurityGroupID: api.Ptr(from.NetworkSecurityGroupID), EtcdEncryptionSetID: api.Ptr(from.EtcdEncryptionSetID), } } -func newIngressProfile(from *api.IngressProfile) *IngressProfile { - return &IngressProfile{ +func newIngressProfile(from *api.IngressProfile) *generated.IngressProfile { + return &generated.IngressProfile{ IP: api.Ptr(from.IP), URL: api.Ptr(from.URL), - Visibility: api.Ptr(Visibility(from.Visibility)), + Visibility: api.Ptr(generated.Visibility(from.Visibility)), } } -func newExternalAuthProfile(from *configv1.OIDCProvider) *ExternalAuthProfile { - out := &ExternalAuthProfile{ - Issuer: &TokenIssuerProfile{ +func newExternalAuthProfile(from *configv1.OIDCProvider) *generated.ExternalAuthProfile { + out := &generated.ExternalAuthProfile{ + Issuer: &generated.TokenIssuerProfile{ URL: api.Ptr(from.Issuer.URL), Audiences: make([]*string, len(from.Issuer.Audiences)), Ca: api.Ptr(from.Issuer.CertificateAuthority.Name), }, - Clients: make([]*ExternalAuthClientProfile, len(from.OIDCClients)), - Claim: &ExternalAuthClaimProfile{ - Mappings: &TokenClaimMappingsProfile{ - Username: &ClaimProfile{ + Clients: make([]*generated.ExternalAuthClientProfile, len(from.OIDCClients)), + Claim: &generated.ExternalAuthClaimProfile{ + Mappings: &generated.TokenClaimMappingsProfile{ + Username: &generated.ClaimProfile{ Claim: api.Ptr(from.ClaimMappings.Username.Claim), PrefixPolicy: api.Ptr(string(from.ClaimMappings.Username.PrefixPolicy)), }, - Groups: &ClaimProfile{ + Groups: &generated.ClaimProfile{ Claim: api.Ptr(from.ClaimMappings.Groups.Claim), Prefix: api.Ptr(from.ClaimMappings.Groups.Prefix), }, }, - ValidationRules: make([]*TokenClaimValidationRuleProfile, len(from.ClaimValidationRules)), + ValidationRules: make([]*generated.TokenClaimValidationRuleProfile, len(from.ClaimValidationRules)), }, } @@ -120,21 +161,21 @@ func newExternalAuthProfile(from *configv1.OIDCProvider) *ExternalAuthProfile { return out } -func newTokenClaimValidationRuleProfile(from configv1.TokenClaimValidationRule) *TokenClaimValidationRuleProfile { +func newTokenClaimValidationRuleProfile(from configv1.TokenClaimValidationRule) *generated.TokenClaimValidationRuleProfile { if from.RequiredClaim == nil { // Should never happen since we create these rules. panic("TokenClaimValidationRule has no RequiredClaim") } - return &TokenClaimValidationRuleProfile{ + return &generated.TokenClaimValidationRuleProfile{ Claim: api.Ptr(from.RequiredClaim.Claim), RequiredValue: api.Ptr(from.RequiredClaim.RequiredValue), } } -func newExternalAuthClientProfile(from configv1.OIDCClientConfig) *ExternalAuthClientProfile { - return &ExternalAuthClientProfile{ - Component: &ExternalAuthClientComponentProfile{ +func newExternalAuthClientProfile(from configv1.OIDCClientConfig) *generated.ExternalAuthClientProfile { + return &generated.ExternalAuthClientProfile{ + Component: &generated.ExternalAuthClientComponentProfile{ Name: api.Ptr(from.ComponentName), AuthClientNamespace: api.Ptr(from.ComponentNamespace), }, @@ -150,42 +191,44 @@ func (v version) NewHCPOpenShiftCluster(from *api.HCPOpenShiftCluster) api.Versi } out := &HcpOpenShiftClusterResource{ - ID: api.Ptr(from.Resource.ID), - Name: api.Ptr(from.Resource.Name), - Type: api.Ptr(from.Resource.Type), - Location: api.Ptr(from.TrackedResource.Location), - Tags: map[string]*string{}, - // FIXME Skipping ManagedServiceIdentity - Properties: &HcpOpenShiftClusterProperties{ - ProvisioningState: api.Ptr(ProvisioningState(from.Properties.ProvisioningState)), - Spec: &ClusterSpec{ - Version: newVersionProfile(&from.Properties.Spec.Version), - DNS: newDNSProfile(&from.Properties.Spec.DNS), - Network: newNetworkProfile(&from.Properties.Spec.Network), - Console: newConsoleProfile(&from.Properties.Spec.Console), - API: newAPIProfile(&from.Properties.Spec.API), - Fips: api.Ptr(from.Properties.Spec.FIPS), - EtcdEncryption: api.Ptr(from.Properties.Spec.EtcdEncryption), - DisableUserWorkloadMonitoring: api.Ptr(from.Properties.Spec.DisableUserWorkloadMonitoring), - Proxy: newProxyProfile(&from.Properties.Spec.Proxy), - Platform: newPlatformProfile(&from.Properties.Spec.Platform), - IssuerURL: api.Ptr(from.Properties.Spec.IssuerURL), - ExternalAuth: &ExternalAuthConfigProfile{ - Enabled: api.Ptr(from.Properties.Spec.ExternalAuth.Enabled), - ExternalAuths: make([]*ExternalAuthProfile, len(from.Properties.Spec.ExternalAuth.ExternalAuths)), + generated.HcpOpenShiftClusterResource{ + ID: api.Ptr(from.Resource.ID), + Name: api.Ptr(from.Resource.Name), + Type: api.Ptr(from.Resource.Type), + Location: api.Ptr(from.TrackedResource.Location), + Tags: map[string]*string{}, + // FIXME Skipping ManagedServiceIdentity + Properties: &generated.HcpOpenShiftClusterProperties{ + ProvisioningState: api.Ptr(generated.ProvisioningState(from.Properties.ProvisioningState)), + Spec: &generated.ClusterSpec{ + Version: newVersionProfile(&from.Properties.Spec.Version), + DNS: newDNSProfile(&from.Properties.Spec.DNS), + Network: newNetworkProfile(&from.Properties.Spec.Network), + Console: newConsoleProfile(&from.Properties.Spec.Console), + API: newAPIProfile(&from.Properties.Spec.API), + Fips: api.Ptr(from.Properties.Spec.FIPS), + EtcdEncryption: api.Ptr(from.Properties.Spec.EtcdEncryption), + DisableUserWorkloadMonitoring: api.Ptr(from.Properties.Spec.DisableUserWorkloadMonitoring), + Proxy: newProxyProfile(&from.Properties.Spec.Proxy), + Platform: newPlatformProfile(&from.Properties.Spec.Platform), + IssuerURL: api.Ptr(from.Properties.Spec.IssuerURL), + ExternalAuth: &generated.ExternalAuthConfigProfile{ + Enabled: api.Ptr(from.Properties.Spec.ExternalAuth.Enabled), + ExternalAuths: make([]*generated.ExternalAuthProfile, len(from.Properties.Spec.ExternalAuth.ExternalAuths)), + }, + Ingress: make([]*generated.IngressProfile, len(from.Properties.Spec.Ingress)), }, - Ingress: make([]*IngressProfile, len(from.Properties.Spec.Ingress)), }, }, } if from.Resource.SystemData != nil { - out.SystemData = &SystemData{ + out.SystemData = &generated.SystemData{ CreatedBy: api.Ptr(from.Resource.SystemData.CreatedBy), - CreatedByType: api.Ptr(CreatedByType(from.Resource.SystemData.CreatedByType)), + CreatedByType: api.Ptr(generated.CreatedByType(from.Resource.SystemData.CreatedByType)), CreatedAt: from.Resource.SystemData.CreatedAt, LastModifiedBy: api.Ptr(from.Resource.SystemData.LastModifiedBy), - LastModifiedByType: api.Ptr(CreatedByType(from.Resource.SystemData.LastModifiedByType)), + LastModifiedByType: api.Ptr(generated.CreatedByType(from.Resource.SystemData.LastModifiedByType)), LastModifiedAt: from.Resource.SystemData.LastModifiedAt, } } @@ -249,19 +292,19 @@ func (c *HcpOpenShiftClusterResource) Normalize(out *api.HCPOpenShiftCluster) { } if c.Properties.Spec != nil { if c.Properties.Spec.Version != nil { - c.Properties.Spec.Version.Normalize(&out.Properties.Spec.Version) + normalizeVersion(c.Properties.Spec.Version, &out.Properties.Spec.Version) } if c.Properties.Spec.DNS != nil { - c.Properties.Spec.DNS.Normalize(&out.Properties.Spec.DNS) + normailzeDNS(c.Properties.Spec.DNS, &out.Properties.Spec.DNS) } if c.Properties.Spec.Network != nil { - c.Properties.Spec.Network.Normalize(&out.Properties.Spec.Network) + normalizeNetwork(c.Properties.Spec.Network, &out.Properties.Spec.Network) } if c.Properties.Spec.Console != nil { - c.Properties.Spec.Console.Normalize(&out.Properties.Spec.Console) + normalizeConsole(c.Properties.Spec.Console, &out.Properties.Spec.Console) } if c.Properties.Spec.API != nil { - c.Properties.Spec.API.Normalize(&out.Properties.Spec.API) + normalizeAPI(c.Properties.Spec.API, &out.Properties.Spec.API) } if c.Properties.Spec.Fips != nil { out.Properties.Spec.FIPS = *c.Properties.Spec.Fips @@ -273,22 +316,22 @@ func (c *HcpOpenShiftClusterResource) Normalize(out *api.HCPOpenShiftCluster) { out.Properties.Spec.DisableUserWorkloadMonitoring = *c.Properties.Spec.DisableUserWorkloadMonitoring } if c.Properties.Spec.Proxy != nil { - c.Properties.Spec.Proxy.Normalize(&out.Properties.Spec.Proxy) + normalizeProxy(c.Properties.Spec.Proxy, &out.Properties.Spec.Proxy) } if c.Properties.Spec.Platform != nil { - c.Properties.Spec.Platform.Normalize(&out.Properties.Spec.Platform) + normalizePlatform(c.Properties.Spec.Platform, &out.Properties.Spec.Platform) } if c.Properties.Spec.IssuerURL != nil { out.Properties.Spec.IssuerURL = *c.Properties.Spec.IssuerURL } if c.Properties.Spec.ExternalAuth != nil { - c.Properties.Spec.ExternalAuth.Normalize(&out.Properties.Spec.ExternalAuth) + normalizeExternalAuthConfig(c.Properties.Spec.ExternalAuth, &out.Properties.Spec.ExternalAuth) } ingressSequence := api.DeleteNilsFromPtrSlice(c.Properties.Spec.Ingress) out.Properties.Spec.Ingress = make([]*api.IngressProfile, len(ingressSequence)) for index, item := range ingressSequence { out.Properties.Spec.Ingress[index] = &api.IngressProfile{} - item.Normalize(out.Properties.Spec.Ingress[index]) + normalizeIngress(item, out.Properties.Spec.Ingress[index]) } } } @@ -328,6 +371,10 @@ func (c *HcpOpenShiftClusterResource) ValidateStatic(current api.VersionedHCPOpe } func (p *VersionProfile) Normalize(out *api.VersionProfile) { + normalizeVersion(&p.VersionProfile, out) +} + +func normalizeVersion(p *generated.VersionProfile, out *api.VersionProfile) { if p.ID != nil { out.ID = *p.ID } @@ -338,6 +385,10 @@ func (p *VersionProfile) Normalize(out *api.VersionProfile) { } func (p *DNSProfile) Normalize(out *api.DNSProfile) { + normailzeDNS(&p.DNSProfile, out) +} + +func normailzeDNS(p *generated.DNSProfile, out *api.DNSProfile) { if p.BaseDomain != nil { out.BaseDomain = *p.BaseDomain } @@ -347,6 +398,10 @@ func (p *DNSProfile) Normalize(out *api.DNSProfile) { } func (p *NetworkProfile) Normalize(out *api.NetworkProfile) { + normalizeNetwork(&p.NetworkProfile, out) +} + +func normalizeNetwork(p *generated.NetworkProfile, out *api.NetworkProfile) { if p.NetworkType != nil { out.NetworkType = api.NetworkType(*p.NetworkType) } @@ -365,12 +420,20 @@ func (p *NetworkProfile) Normalize(out *api.NetworkProfile) { } func (p *ConsoleProfile) Normalize(out *api.ConsoleProfile) { + normalizeConsole(&p.ConsoleProfile, out) +} + +func normalizeConsole(p *generated.ConsoleProfile, out *api.ConsoleProfile) { if p.URL != nil { out.URL = *p.URL } } func (p *APIProfile) Normalize(out *api.APIProfile) { + normalizeAPI(&p.APIProfile, out) +} + +func normalizeAPI(p *generated.APIProfile, out *api.APIProfile) { if p.URL != nil { out.URL = *p.URL } @@ -383,6 +446,10 @@ func (p *APIProfile) Normalize(out *api.APIProfile) { } func (p *ProxyProfile) Normalize(out *api.ProxyProfile) { + normalizeProxy(&p.ProxyProfile, out) +} + +func normalizeProxy(p *generated.ProxyProfile, out *api.ProxyProfile) { if p.HTTPProxy != nil { out.HTTPProxy = *p.HTTPProxy } @@ -398,6 +465,10 @@ func (p *ProxyProfile) Normalize(out *api.ProxyProfile) { } func (p *PlatformProfile) Normalize(out *api.PlatformProfile) { + normalizePlatform(&p.PlatformProfile, out) +} + +func normalizePlatform(p *generated.PlatformProfile, out *api.PlatformProfile) { if p.ManagedResourceGroup != nil { out.ManagedResourceGroup = *p.ManagedResourceGroup } @@ -416,6 +487,10 @@ func (p *PlatformProfile) Normalize(out *api.PlatformProfile) { } func (p *ExternalAuthConfigProfile) Normalize(out *api.ExternalAuthConfigProfile) { + normalizeExternalAuthConfig(&p.ExternalAuthConfigProfile, out) +} + +func normalizeExternalAuthConfig(p *generated.ExternalAuthConfigProfile, out *api.ExternalAuthConfigProfile) { if p.Enabled != nil { out.Enabled = *p.Enabled } @@ -508,6 +583,10 @@ func (p *ExternalAuthConfigProfile) Normalize(out *api.ExternalAuthConfigProfile } func (p *IngressProfile) Normalize(out *api.IngressProfile) { + normalizeIngress(&p.IngressProfile, out) +} + +func normalizeIngress(p *generated.IngressProfile, out *api.IngressProfile) { if p.IP != nil { out.IP = *p.IP } diff --git a/internal/api/v20240610preview/register.go b/internal/api/v20240610preview/register.go index 6fe20cf03..922463b3d 100644 --- a/internal/api/v20240610preview/register.go +++ b/internal/api/v20240610preview/register.go @@ -8,6 +8,7 @@ import ( "strings" "github.com/Azure/ARO-HCP/internal/api" + "github.com/Azure/ARO-HCP/internal/api/v20240610preview/generated" ) type version struct{} @@ -45,14 +46,13 @@ func init() { api.Register(version{}) // Register enum type validations - validate.RegisterAlias("enum_actiontype", EnumValidateTag(PossibleActionTypeValues()...)) - validate.RegisterAlias("enum_createdbytype", EnumValidateTag(PossibleCreatedByTypeValues()...)) - validate.RegisterAlias("enum_managedserviceidentitytype", EnumValidateTag(PossibleManagedServiceIdentityTypeValues()...)) - validate.RegisterAlias("enum_networktype", EnumValidateTag(PossibleNetworkTypeValues()...)) - validate.RegisterAlias("enum_origin", EnumValidateTag(PossibleOriginValues()...)) - validate.RegisterAlias("enum_outboundtype", EnumValidateTag(PossibleOutboundTypeValues()...)) - validate.RegisterAlias("enum_provisioningstate", EnumValidateTag(PossibleProvisioningStateValues()...)) - validate.RegisterAlias("enum_resourceprovisioningstate", EnumValidateTag(PossibleResourceProvisioningStateValues()...)) - validate.RegisterAlias("enum_versions", EnumValidateTag(PossibleVersionsValues()...)) - validate.RegisterAlias("enum_visibility", EnumValidateTag(PossibleVisibilityValues()...)) + validate.RegisterAlias("enum_actiontype", EnumValidateTag(generated.PossibleActionTypeValues()...)) + validate.RegisterAlias("enum_createdbytype", EnumValidateTag(generated.PossibleCreatedByTypeValues()...)) + validate.RegisterAlias("enum_managedserviceidentitytype", EnumValidateTag(generated.PossibleManagedServiceIdentityTypeValues()...)) + validate.RegisterAlias("enum_networktype", EnumValidateTag(generated.PossibleNetworkTypeValues()...)) + validate.RegisterAlias("enum_origin", EnumValidateTag(generated.PossibleOriginValues()...)) + validate.RegisterAlias("enum_outboundtype", EnumValidateTag(generated.PossibleOutboundTypeValues()...)) + validate.RegisterAlias("enum_provisioningstate", EnumValidateTag(generated.PossibleProvisioningStateValues()...)) + validate.RegisterAlias("enum_resourceprovisioningstate", EnumValidateTag(generated.PossibleResourceProvisioningStateValues()...)) + validate.RegisterAlias("enum_visibility", EnumValidateTag(generated.PossibleVisibilityValues()...)) } diff --git a/package.json b/package.json index 07c0c0f25..a15f6bb1c 100644 --- a/package.json +++ b/package.json @@ -9,4 +9,4 @@ "@typespec/rest": "^0.56.0", "@typespec/versioning": "^0.56.0" } -} \ No newline at end of file +}