From e2d7440d5c4907028b416711250faa6d1c309aea Mon Sep 17 00:00:00 2001 From: lakshmimsft Date: Thu, 31 Oct 2024 12:03:59 -0700 Subject: [PATCH 1/9] updated to autorest latest version Signed-off-by: lakshmimsft --- typespec/UCP/aws-credentials.tsp | 4 +- typespec/UCP/azure-credentials.tsp | 4 +- typespec/UCP/common.tsp | 4 +- typespec/UCP/planes.tsp | 4 +- typespec/UCP/resourcegroups.tsp | 4 +- typespec/UCP/resourceproviders.tsp | 16 +++---- typespec/UCP/ucp-operations.tsp | 73 +++++++++++++++-------------- typespec/radius/v1/ucprootscope.tsp | 2 +- 8 files changed, 56 insertions(+), 55 deletions(-) diff --git a/typespec/UCP/aws-credentials.tsp b/typespec/UCP/aws-credentials.tsp index 7f4d68ab1f..deea84d5b7 100644 --- a/typespec/UCP/aws-credentials.tsp +++ b/typespec/UCP/aws-credentials.tsp @@ -108,8 +108,8 @@ model AwsIRSACredentialProperties extends AwsCredentialProperties { storage: CredentialStorageProperties; } -alias AwsCredentialBaseParameter = CredentialBaseParameters< - TResource, +alias AwsCredentialBaseParameter = CredentialBaseParameters< + Resource, AwsPlaneNameParameter >; diff --git a/typespec/UCP/azure-credentials.tsp b/typespec/UCP/azure-credentials.tsp index ad18ba8150..6c6c2736e8 100644 --- a/typespec/UCP/azure-credentials.tsp +++ b/typespec/UCP/azure-credentials.tsp @@ -114,8 +114,8 @@ model AzureWorkloadIdentityProperties extends AzureCredentialProperties { storage: CredentialStorageProperties; } -alias AzureCredentialBaseParameter = CredentialBaseParameters< - TResource, +alias AzureCredentialBaseParameter = CredentialBaseParameters< + Resource, AzurePlaneNameParameter >; diff --git a/typespec/UCP/common.tsp b/typespec/UCP/common.tsp index 6e26894eee..6095a55e70 100644 --- a/typespec/UCP/common.tsp +++ b/typespec/UCP/common.tsp @@ -36,10 +36,10 @@ using Azure.ResourceManager.Foundations; using OpenAPI; @doc("The UCP HTTP request base parameters.") -model CredentialBaseParameters { +model CredentialBaseParameters { ...ApiVersionParameter; ...TPlaneName; - ...KeysOf; + ...KeysOf; } @doc("Credential store kinds supported.") diff --git a/typespec/UCP/planes.tsp b/typespec/UCP/planes.tsp index 7c6637c5ad..9c22515738 100644 --- a/typespec/UCP/planes.tsp +++ b/typespec/UCP/planes.tsp @@ -48,9 +48,9 @@ model PlaneNameParameter { } @doc("The UCP HTTP request base parameters.") -model PlaneBaseParameters { +model PlaneBaseParameters { ...ApiVersionParameter; - ...KeysOf; + ...KeysOf; } @doc("The generic representation of a plane resource") diff --git a/typespec/UCP/resourcegroups.tsp b/typespec/UCP/resourcegroups.tsp index 7a9b6c176a..24df42b21d 100644 --- a/typespec/UCP/resourcegroups.tsp +++ b/typespec/UCP/resourcegroups.tsp @@ -68,9 +68,9 @@ model GenericResource extends ProxyResource { model ResourceProperties {} @doc("The UCP HTTP request base parameters.") -model ResourceGroupBaseParameters { +model ResourceGroupBaseParameters { ...PlaneBaseParameters; - ...KeysOf; + ...KeysOf; } @route("/planes") diff --git a/typespec/UCP/resourceproviders.tsp b/typespec/UCP/resourceproviders.tsp index adc706c63b..7c03c6b8aa 100644 --- a/typespec/UCP/resourceproviders.tsp +++ b/typespec/UCP/resourceproviders.tsp @@ -174,28 +174,28 @@ model ResourceProviderSummaryResourceType { @doc("The configuration of a resource type API version.") model ResourceTypeSummaryResultApiVersion {} -model ResourceProviderBaseParameters { +model ResourceProviderBaseParameters { ...PlaneBaseParameters; - ...KeysOf; + ...KeysOf; } -model ResourceTypeBaseParameters { +model ResourceTypeBaseParameters { ...PlaneBaseParameters; ...KeysOf; - ...KeysOf; + ...KeysOf; } -model ApiVersionBaseParameters { +model ApiVersionBaseParameters { ...PlaneBaseParameters; ...KeysOf; ...KeysOf; - ...KeysOf; + ...KeysOf; } -model LocationBaseParameters { +model LocationBaseParameters { ...PlaneBaseParameters; ...KeysOf; - ...KeysOf; + ...KeysOf; } @route("/planes") diff --git a/typespec/UCP/ucp-operations.tsp b/typespec/UCP/ucp-operations.tsp index e2fa14abc7..b557198ca5 100644 --- a/typespec/UCP/ucp-operations.tsp +++ b/typespec/UCP/ucp-operations.tsp @@ -20,6 +20,7 @@ import "@azure-tools/typespec-autorest"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; + using TypeSpec.Http; using TypeSpec.Rest; using Azure.ResourceManager; @@ -32,26 +33,26 @@ using OpenAPI; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @get @autoRoute -@doc("List {name}", TResource) -@segmentOf(TResource) -@armResourceList(TResource) -op UcpResourceList( +@doc("List {name}", Azure.ResourceManager.CommonTypes.Resource) +@segmentOf(Azure.ResourceManager.CommonTypes.Resource) +@armResourceList(Azure.ResourceManager.CommonTypes.Resource) +op UcpResourceList( ...TBaseParameters, - ...ParentKeysOf, -): ArmResponse> | ErrorResponse; + ...ParentKeysOf, +): ArmResponse> | ErrorResponse; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Get a {name}", TResource) +@doc("Get a {name}", Resource) @get -@armResourceRead(TResource) -op UcpResourceRead( +@armResourceRead(Resource) +op UcpResourceRead( ...TBaseParameters, -): ArmResponse | ErrorResponse; +): ArmResponse | ErrorResponse; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Create a {name}", TResource) +@doc("Create a {name}", Resource) @extension("x-ms-long-running-operation", true) @extension( "x-ms-long-running-operation-options", @@ -59,22 +60,22 @@ op UcpResourceRead( `final-state-via`: "azure-async-operation", } ) -@armResourceCreateOrUpdate(TResource) +@armResourceCreateOrUpdate(Resource) @put op UcpResourceCreateOrUpdateAsync< - TResource extends Foundations.Resource, + Resource extends Foundations.Resource, TBaseParameters >( ...TBaseParameters, @doc("Resource create parameters.") @body - resource: TResource, -): ArmResourceUpdatedResponse | ArmResourceCreatedResponse | ErrorResponse; + resource: Resource, +): ArmResourceUpdatedResponse | ArmResourceCreatedResponse | ErrorResponse; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Update a {name}", TResource) +@doc("Update a {name}", Resource) @extension("x-ms-long-running-operation", true) @extension( "x-ms-long-running-operation-options", @@ -82,23 +83,23 @@ op UcpResourceCreateOrUpdateAsync< `final-state-via`: "location", } ) -@armResourceUpdate(TResource) +@armResourceUpdate(Resource) @patch op UcpCustomPatchAsync< - TResource extends Foundations.Resource, + Resource extends Foundations.Resource, TBaseParameters, - TPatchModel extends TypeSpec.Reflection.Model = TagsUpdateModel + TPatchModel extends TypeSpec.Reflection.Model = TagsUpdateModel >( ...TBaseParameters, @doc("The resource properties to be updated.") @body properties: TPatchModel, -): ArmResponse | ArmAcceptedLroResponse<"Resource update request accepted."> | ErrorResponse; +): ArmResponse | ArmAcceptedLroResponse<"Resource update request accepted."> | ErrorResponse; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Delete a {name}", TResource) +@doc("Delete a {name}", Resource) @extension("x-ms-long-running-operation", true) @extension( "x-ms-long-running-operation-options", @@ -106,10 +107,10 @@ op UcpCustomPatchAsync< `final-state-via`: "location", } ) -@armResourceDelete(TResource) +@armResourceDelete(Resource) @delete op UcpResourceDeleteAsync< - TResource extends Foundations.Resource, + Resource extends Foundations.Resource, TBaseParameters >(...TBaseParameters): | ArmDeletedResponse @@ -119,44 +120,44 @@ op UcpResourceDeleteAsync< #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Create a {name}", TResource) -@armResourceCreateOrUpdate(TResource) +@doc("Create a {name}", Resource) +@armResourceCreateOrUpdate(Resource) @put op UcpResourceCreateOrUpdateSync< - TResource extends Foundations.Resource, + Resource extends Foundations.Resource, TBaseParameters >( ...TBaseParameters, @doc("Resource create parameters.") @body - resource: TResource, -): ArmResourceUpdatedResponse | ArmResourceCreatedSyncResponse | ErrorResponse; + resource: Resource, +): ArmResourceUpdatedResponse | ArmResourceCreatedSyncResponse | ErrorResponse; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Update a {name}", TResource) -@armResourceUpdate(TResource) +@doc("Update a {name}", Resource) +@armResourceUpdate(Resource) @patch op UcpCustomPatchSync< - TResource extends Foundations.Resource, + Resource extends Foundations.Resource, TBaseParameters, - TPatchModel extends TypeSpec.Reflection.Model = TagsUpdateModel + TPatchModel extends TypeSpec.Reflection.Model = TagsUpdateModel >( ...TBaseParameters, @doc("The resource properties to be updated.") @body properties: TPatchModel, -): ArmResponse | ErrorResponse; +): ArmResponse | ErrorResponse; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Delete a {name}", TResource) -@armResourceDelete(TResource) +@doc("Delete a {name}", Resource) +@armResourceDelete(Resource) @delete op UcpResourceDeleteSync< - TResource extends Foundations.Resource, + Resource extends Foundations.Resource, TBaseParameters >( ...TBaseParameters, diff --git a/typespec/radius/v1/ucprootscope.tsp b/typespec/radius/v1/ucprootscope.tsp index 34862aea3a..5142cd4602 100644 --- a/typespec/radius/v1/ucprootscope.tsp +++ b/typespec/radius/v1/ucprootscope.tsp @@ -35,7 +35,7 @@ model RootScopeParameter { } @doc("The UCP HTTP request base parameters.") -model UCPBaseParameters { +model UCPBaseParameters { ...ApiVersionParameter; ...RootScopeParameter; } From 1c75a663e88860cc75106851e6dd2c8939425dc5 Mon Sep 17 00:00:00 2001 From: lakshmimsft Date: Thu, 31 Oct 2024 17:32:26 -0700 Subject: [PATCH 2/9] intermidiate checkin Signed-off-by: lakshmimsft --- .../zz_generated_apiversions_client.go | 4 +- .../zz_generated_awscredentials_client.go | 20 +- .../zz_generated_azurecredentials_client.go | 6 +- .../zz_generated_locations_client.go | 4 +- .../v20231001preview/zz_generated_models.go | 90 +- .../zz_generated_models_serde.go | 284 +-- .../zz_generated_planes_client.go | 5 +- .../zz_generated_resourcegroups_client.go | 12 +- .../zz_generated_resourceproviders_client.go | 14 +- .../zz_generated_resources_client.go | 4 +- .../zz_generated_resourcetypes_client.go | 10 +- .../zz_generated_response_types.go | 36 +- .../preview/2023-10-01-preview/openapi.json | 2141 ++++++++--------- typespec/UCP/aws-credentials.tsp | 6 +- typespec/UCP/azure-credentials.tsp | 2 + typespec/UCP/resourcegroups.tsp | 6 +- typespec/UCP/resourceproviders.tsp | 10 +- 17 files changed, 1099 insertions(+), 1555 deletions(-) diff --git a/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go b/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go index 213af38bf7..0e11e28293 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go @@ -297,7 +297,7 @@ func (client *APIVersionsClient) NewListPager(planeName string, resourceProvider // listCreateRequest creates the List request. func (client *APIVersionsClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *APIVersionsClientListOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/apiversions" + urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -324,7 +324,7 @@ func (client *APIVersionsClient) listCreateRequest(ctx context.Context, planeNam // listHandleResponse handles the List response. func (client *APIVersionsClient) listHandleResponse(resp *http.Response) (APIVersionsClientListResponse, error) { result := APIVersionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.APIVersionResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { return APIVersionsClientListResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go b/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go index c6ec74d5ae..cfd8a20d87 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go @@ -68,7 +68,7 @@ func (client *AwsCredentialsClient) CreateOrUpdate(ctx context.Context, planeNam // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *AwsCredentialsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, credentialName string, resource AwsCredentialResource, options *AwsCredentialsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" + urlPath := "/PUT /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") @@ -123,7 +123,7 @@ func (client *AwsCredentialsClient) Delete(ctx context.Context, planeName string // deleteCreateRequest creates the Delete request. func (client *AwsCredentialsClient) deleteCreateRequest(ctx context.Context, planeName string, credentialName string, options *AwsCredentialsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" + urlPath := "/DELETE /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") @@ -167,7 +167,7 @@ func (client *AwsCredentialsClient) Get(ctx context.Context, planeName string, c // getCreateRequest creates the Get request. func (client *AwsCredentialsClient) getCreateRequest(ctx context.Context, planeName string, credentialName string, options *AwsCredentialsClientGetOptions) (*policy.Request, error) { - urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" + urlPath := "/GET /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") @@ -196,9 +196,8 @@ func (client *AwsCredentialsClient) getHandleResponse(resp *http.Response) (AwsC // NewListPager - List AWS credentials // // Generated from API version 2023-10-01-preview -// - planeName - The name of AWS plane // - options - AwsCredentialsClientListOptions contains the optional parameters for the AwsCredentialsClient.NewListPager method. -func (client *AwsCredentialsClient) NewListPager(planeName string, options *AwsCredentialsClientListOptions) (*runtime.Pager[AwsCredentialsClientListResponse]) { +func (client *AwsCredentialsClient) NewListPager(options *AwsCredentialsClientListOptions) (*runtime.Pager[AwsCredentialsClientListResponse]) { return runtime.NewPager(runtime.PagingHandler[AwsCredentialsClientListResponse]{ More: func(page AwsCredentialsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -207,7 +206,7 @@ func (client *AwsCredentialsClient) NewListPager(planeName string, options *AwsC var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, planeName, options) + req, err = client.listCreateRequest(ctx, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } @@ -227,9 +226,8 @@ func (client *AwsCredentialsClient) NewListPager(planeName string, options *AwsC } // listCreateRequest creates the List request. -func (client *AwsCredentialsClient) listCreateRequest(ctx context.Context, planeName string, options *AwsCredentialsClientListOptions) (*policy.Request, error) { - urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials" - urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) +func (client *AwsCredentialsClient) listCreateRequest(ctx context.Context, options *AwsCredentialsClientListOptions) (*policy.Request, error) { + urlPath := "/GET /planes/aws" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -244,7 +242,7 @@ func (client *AwsCredentialsClient) listCreateRequest(ctx context.Context, plane // listHandleResponse handles the List response. func (client *AwsCredentialsClient) listHandleResponse(resp *http.Response) (AwsCredentialsClientListResponse, error) { result := AwsCredentialsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AwsCredentialResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { return AwsCredentialsClientListResponse{}, err } return result, nil @@ -278,7 +276,7 @@ func (client *AwsCredentialsClient) Update(ctx context.Context, planeName string // updateCreateRequest creates the Update request. func (client *AwsCredentialsClient) updateCreateRequest(ctx context.Context, planeName string, credentialName string, properties AwsCredentialResourceTagsUpdate, options *AwsCredentialsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" + urlPath := "/PATCH /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") diff --git a/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go b/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go index b9f110905d..eb2d0973ad 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go @@ -167,7 +167,7 @@ func (client *AzureCredentialsClient) Get(ctx context.Context, planeName string, // getCreateRequest creates the Get request. func (client *AzureCredentialsClient) getCreateRequest(ctx context.Context, planeName string, credentialName string, options *AzureCredentialsClientGetOptions) (*policy.Request, error) { - urlPath := "/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}" + urlPath := "/GET /planes/azure/{planeName}/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") @@ -229,7 +229,7 @@ func (client *AzureCredentialsClient) NewListPager(planeName string, options *Az // listCreateRequest creates the List request. func (client *AzureCredentialsClient) listCreateRequest(ctx context.Context, planeName string, options *AzureCredentialsClientListOptions) (*policy.Request, error) { - urlPath := "/planes/azure/{planeName}/providers/System.Azure/credentials" + urlPath := "/GET /planes/azure/planes/azure/{planeName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -245,7 +245,7 @@ func (client *AzureCredentialsClient) listCreateRequest(ctx context.Context, pla // listHandleResponse handles the List response. func (client *AzureCredentialsClient) listHandleResponse(resp *http.Response) (AzureCredentialsClientListResponse, error) { result := AzureCredentialsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AzureCredentialResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { return AzureCredentialsClientListResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go b/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go index 01e75c698f..45dac4abfb 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go @@ -283,7 +283,7 @@ func (client *LocationsClient) NewListPager(planeName string, resourceProviderNa // listCreateRequest creates the List request. func (client *LocationsClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *LocationsClientListOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations" + urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -306,7 +306,7 @@ func (client *LocationsClient) listCreateRequest(ctx context.Context, planeName // listHandleResponse handles the List response. func (client *LocationsClient) listHandleResponse(resp *http.Response) (LocationsClientListResponse, error) { result := LocationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.LocationResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { return LocationsClientListResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_models.go b/pkg/ucp/api/v20231001preview/zz_generated_models.go index 0edd7cf8b4..431e90a292 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_models.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_models.go @@ -34,15 +34,6 @@ type APIVersionResource struct { Type *string } -// APIVersionResourceListResult - The response of a ApiVersionResource list operation. -type APIVersionResourceListResult struct { - // REQUIRED; The ApiVersionResource items on this page - Value []*APIVersionResource - - // The link to the next page of items - NextLink *string -} - // AwsAccessKeyCredentialProperties - AWS credential properties for Access Key type AwsAccessKeyCredentialProperties struct { // REQUIRED; Access key ID for AWS identity @@ -106,15 +97,6 @@ type AwsCredentialResource struct { Type *string } -// AwsCredentialResourceListResult - The response of a AwsCredentialResource list operation. -type AwsCredentialResourceListResult struct { - // REQUIRED; The AwsCredentialResource items on this page - Value []*AwsCredentialResource - - // The link to the next page of items - NextLink *string -} - // AwsCredentialResourceTagsUpdate - The type used for updating tags in AwsCredentialResource resources. type AwsCredentialResourceTagsUpdate struct { // Resource tags. @@ -225,15 +207,6 @@ type AzureCredentialResource struct { Type *string } -// AzureCredentialResourceListResult - The response of a AzureCredentialResource list operation. -type AzureCredentialResourceListResult struct { - // REQUIRED; The AzureCredentialResource items on this page - Value []*AzureCredentialResource - - // The link to the next page of items - NextLink *string -} - // AzureCredentialResourceTagsUpdate - The type used for updating tags in AzureCredentialResource resources. type AzureCredentialResourceTagsUpdate struct { // Resource tags. @@ -429,15 +402,6 @@ type GenericPlaneResource struct { Type *string } -// GenericPlaneResourceListResult - The response of a GenericPlaneResource list operation. -type GenericPlaneResourceListResult struct { - // REQUIRED; The GenericPlaneResource items on this page - Value []*GenericPlaneResource - - // The link to the next page of items - NextLink *string -} - // GenericPlaneResourceProperties - The properties of the generic representation of a plane resource. type GenericPlaneResourceProperties struct { // READ-ONLY; The status of the asynchronous operation. @@ -462,15 +426,6 @@ type GenericResource struct { Type *string } -// GenericResourceListResult - The response of a GenericResource list operation. -type GenericResourceListResult struct { - // REQUIRED; The GenericResource items on this page - Value []*GenericResource - - // The link to the next page of items - NextLink *string -} - // InternalCredentialStorageProperties - Internal credential storage properties type InternalCredentialStorageProperties struct { // REQUIRED; The kind of credential storage @@ -518,15 +473,6 @@ type LocationResource struct { Type *string } -// LocationResourceListResult - The response of a LocationResource list operation. -type LocationResourceListResult struct { - // REQUIRED; The LocationResource items on this page - Value []*LocationResource - - // The link to the next page of items - NextLink *string -} - // LocationResourceType - The configuration for a resource type in a specific location. type LocationResourceType struct { // The configuration for API versions of a resource type supported by the location. @@ -657,21 +603,21 @@ type ResourceGroupResource struct { Type *string } -// ResourceGroupResourceListResult - The response of a ResourceGroupResource list operation. -type ResourceGroupResourceListResult struct { - // REQUIRED; The ResourceGroupResource items on this page - Value []*ResourceGroupResource - - // The link to the next page of items - NextLink *string -} - // ResourceGroupResourceTagsUpdate - The type used for updating tags in ResourceGroupResource resources. type ResourceGroupResourceTagsUpdate struct { // Resource tags. Tags map[string]*string } +// ResourceListResult - The response of a Resource list operation. +type ResourceListResult struct { + // REQUIRED; The Resource items on this page + Value []*Resource + + // The link to the next page of items + NextLink *string +} + // ResourceProviderProperties - The properties of a resource provider. type ResourceProviderProperties struct { // READ-ONLY; The status of the asynchronous operation. @@ -702,15 +648,6 @@ type ResourceProviderResource struct { Type *string } -// ResourceProviderResourceListResult - The response of a ResourceProviderResource list operation. -type ResourceProviderResourceListResult struct { - // REQUIRED; The ResourceProviderResource items on this page - Value []*ResourceProviderResource - - // The link to the next page of items - NextLink *string -} - // ResourceProviderSummary - The summary of a resource provider configuration. This type is optimized for querying resource // providers and supported types. type ResourceProviderSummary struct { @@ -760,15 +697,6 @@ type ResourceTypeResource struct { Type *string } -// ResourceTypeResourceListResult - The response of a ResourceTypeResource list operation. -type ResourceTypeResourceListResult struct { - // REQUIRED; The ResourceTypeResource items on this page - Value []*ResourceTypeResource - - // The link to the next page of items - NextLink *string -} - // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). diff --git a/pkg/ucp/api/v20231001preview/zz_generated_models_serde.go b/pkg/ucp/api/v20231001preview/zz_generated_models_serde.go index f62e590dfd..d8188fbbcb 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_models_serde.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_models_serde.go @@ -84,37 +84,6 @@ func (a *APIVersionResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type APIVersionResourceListResult. -func (a APIVersionResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type APIVersionResourceListResult. -func (a *APIVersionResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type AwsAccessKeyCredentialProperties. func (a AwsAccessKeyCredentialProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -240,37 +209,6 @@ func (a *AwsCredentialResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AwsCredentialResourceListResult. -func (a AwsCredentialResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCredentialResourceListResult. -func (a *AwsCredentialResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type AwsCredentialResourceTagsUpdate. func (a AwsCredentialResourceTagsUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -555,37 +493,6 @@ func (a *AzureCredentialResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureCredentialResourceListResult. -func (a AzureCredentialResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureCredentialResourceListResult. -func (a *AzureCredentialResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", a, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type AzureCredentialResourceTagsUpdate. func (a AzureCredentialResourceTagsUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1065,37 +972,6 @@ func (g *GenericPlaneResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type GenericPlaneResourceListResult. -func (g GenericPlaneResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GenericPlaneResourceListResult. -func (g *GenericPlaneResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type GenericPlaneResourceProperties. func (g GenericPlaneResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1166,37 +1042,6 @@ func (g *GenericResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type GenericResourceListResult. -func (g GenericResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", g.NextLink) - populate(objectMap, "value", g.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GenericResourceListResult. -func (g *GenericResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &g.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &g.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type InternalCredentialStorageProperties. func (i InternalCredentialStorageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1306,37 +1151,6 @@ func (l *LocationResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type LocationResourceListResult. -func (l LocationResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", l.NextLink) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LocationResourceListResult. -func (l *LocationResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &l.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &l.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type LocationResourceType. func (l LocationResourceType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1718,16 +1532,15 @@ func (r *ResourceGroupResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceGroupResourceListResult. -func (r ResourceGroupResourceListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceGroupResourceTagsUpdate. +func (r ResourceGroupResourceTagsUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "tags", r.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroupResourceListResult. -func (r *ResourceGroupResourceListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroupResourceTagsUpdate. +func (r *ResourceGroupResourceTagsUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -1735,11 +1548,8 @@ func (r *ResourceGroupResourceListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) } if err != nil { @@ -1749,15 +1559,16 @@ func (r *ResourceGroupResourceListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceGroupResourceTagsUpdate. -func (r ResourceGroupResourceTagsUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceListResult. +func (r ResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", r.Tags) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroupResourceTagsUpdate. -func (r *ResourceGroupResourceTagsUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceListResult. +func (r *ResourceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -1765,8 +1576,11 @@ func (r *ResourceGroupResourceTagsUpdate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -1854,37 +1668,6 @@ func (r *ResourceProviderResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceProviderResourceListResult. -func (r ResourceProviderResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderResourceListResult. -func (r *ResourceProviderResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type ResourceProviderSummary. func (r ResourceProviderSummary) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2025,37 +1808,6 @@ func (r *ResourceTypeResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceTypeResourceListResult. -func (r ResourceTypeResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceTypeResourceListResult. -func (r *ResourceTypeResourceListResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go b/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go index 56574fd314..6d21643391 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go @@ -70,8 +70,7 @@ func (client *PlanesClient) NewListPlanesPager(options *PlanesClientListPlanesOp // listPlanesCreateRequest creates the ListPlanes request. func (client *PlanesClient) listPlanesCreateRequest(ctx context.Context, options *PlanesClientListPlanesOptions) (*policy.Request, error) { - urlPath := "/planes" - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodGet, client.internal.Endpoint()) if err != nil { return nil, err } @@ -85,7 +84,7 @@ func (client *PlanesClient) listPlanesCreateRequest(ctx context.Context, options // listPlanesHandleResponse handles the ListPlanes response. func (client *PlanesClient) listPlanesHandleResponse(resp *http.Response) (PlanesClientListPlanesResponse, error) { result := PlanesClientListPlanesResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GenericPlaneResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { return PlanesClientListPlanesResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go index bcb851c724..484fc23d38 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go @@ -68,7 +68,7 @@ func (client *ResourceGroupsClient) CreateOrUpdate(ctx context.Context, planeNam // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *ResourceGroupsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceGroupName string, resource ResourceGroupResource, options *ResourceGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" + urlPath := "/PUT /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -126,7 +126,7 @@ func (client *ResourceGroupsClient) Delete(ctx context.Context, planeName string // deleteCreateRequest creates the Delete request. func (client *ResourceGroupsClient) deleteCreateRequest(ctx context.Context, planeName string, resourceGroupName string, options *ResourceGroupsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" + urlPath := "/DELETE /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -173,7 +173,7 @@ func (client *ResourceGroupsClient) Get(ctx context.Context, planeName string, r // getCreateRequest creates the Get request. func (client *ResourceGroupsClient) getCreateRequest(ctx context.Context, planeName string, resourceGroupName string, options *ResourceGroupsClientGetOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" + urlPath := "/GET /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -237,7 +237,7 @@ func (client *ResourceGroupsClient) NewListPager(planeName string, options *Reso // listCreateRequest creates the List request. func (client *ResourceGroupsClient) listCreateRequest(ctx context.Context, planeName string, options *ResourceGroupsClientListOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/resourcegroups" + urlPath := "/GET /planes/radius/{planeName}/resourcegroups/radius/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -256,7 +256,7 @@ func (client *ResourceGroupsClient) listCreateRequest(ctx context.Context, plane // listHandleResponse handles the List response. func (client *ResourceGroupsClient) listHandleResponse(resp *http.Response) (ResourceGroupsClientListResponse, error) { result := ResourceGroupsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGroupResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { return ResourceGroupsClientListResponse{}, err } return result, nil @@ -290,7 +290,7 @@ func (client *ResourceGroupsClient) Update(ctx context.Context, planeName string // updateCreateRequest creates the Update request. func (client *ResourceGroupsClient) updateCreateRequest(ctx context.Context, planeName string, resourceGroupName string, properties ResourceGroupResourceTagsUpdate, options *ResourceGroupsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" + urlPath := "/PATCH /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go index dd8f52981f..c2de34cfe5 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go @@ -86,7 +86,7 @@ func (client *ResourceProvidersClient) createOrUpdate(ctx context.Context, plane // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *ResourceProvidersClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resource ResourceProviderResource, options *ResourceProvidersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" + urlPath := "/PUT /planes/{resourceProviderName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -155,7 +155,7 @@ func (client *ResourceProvidersClient) deleteOperation(ctx context.Context, plan // deleteCreateRequest creates the Delete request. func (client *ResourceProvidersClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *ResourceProvidersClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" + urlPath := "/DELETE /planes/{resourceProviderName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -202,7 +202,7 @@ func (client *ResourceProvidersClient) Get(ctx context.Context, planeName string // getCreateRequest creates the Get request. func (client *ResourceProvidersClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *ResourceProvidersClientGetOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" + urlPath := "/GET /planes/{resourceProviderName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -260,7 +260,7 @@ func (client *ResourceProvidersClient) GetProviderSummary(ctx context.Context, p // getProviderSummaryCreateRequest creates the GetProviderSummary request. func (client *ResourceProvidersClient) getProviderSummaryCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *ResourceProvidersClientGetProviderSummaryOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/{resourceProviderName}" + urlPath := "/radius/{planeName}/providers/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -325,7 +325,7 @@ func (client *ResourceProvidersClient) NewListPager(planeName string, options *R // listCreateRequest creates the List request. func (client *ResourceProvidersClient) listCreateRequest(ctx context.Context, planeName string, options *ResourceProvidersClientListOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders" + urlPath := "/GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/radius/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -344,7 +344,7 @@ func (client *ResourceProvidersClient) listCreateRequest(ctx context.Context, pl // listHandleResponse handles the List response. func (client *ResourceProvidersClient) listHandleResponse(resp *http.Response) (ResourceProvidersClientListResponse, error) { result := ResourceProvidersClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceProviderResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { return ResourceProvidersClientListResponse{}, err } return result, nil @@ -387,7 +387,7 @@ func (client *ResourceProvidersClient) NewListProviderSummariesPager(planeName s // listProviderSummariesCreateRequest creates the ListProviderSummaries request. func (client *ResourceProvidersClient) listProviderSummariesCreateRequest(ctx context.Context, planeName string, options *ResourceProvidersClientListProviderSummariesOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers" + urlPath := "/radius/{planeName}/providers" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go index f9ade005f0..9a9d767e8a 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go @@ -75,7 +75,7 @@ func (client *ResourcesClient) NewListPager(planeName string, resourceGroupName // listCreateRequest creates the List request. func (client *ResourcesClient) listCreateRequest(ctx context.Context, planeName string, resourceGroupName string, options *ResourcesClientListOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/resources" + urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -98,7 +98,7 @@ func (client *ResourcesClient) listCreateRequest(ctx context.Context, planeName // listHandleResponse handles the List response. func (client *ResourcesClient) listHandleResponse(resp *http.Response) (ResourcesClientListResponse, error) { result := ResourcesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.GenericResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { return ResourcesClientListResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go index e1e8e2cfcb..615dddbe96 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go @@ -87,7 +87,7 @@ func (client *ResourceTypesClient) createOrUpdate(ctx context.Context, planeName // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *ResourceTypesClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, resource ResourceTypeResource, options *ResourceTypesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" + urlPath := "/PUT /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -161,7 +161,7 @@ func (client *ResourceTypesClient) deleteOperation(ctx context.Context, planeNam // deleteCreateRequest creates the Delete request. func (client *ResourceTypesClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *ResourceTypesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" + urlPath := "/DELETE /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -213,7 +213,7 @@ func (client *ResourceTypesClient) Get(ctx context.Context, planeName string, re // getCreateRequest creates the Get request. func (client *ResourceTypesClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *ResourceTypesClientGetOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" + urlPath := "/GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -282,7 +282,7 @@ func (client *ResourceTypesClient) NewListPager(planeName string, resourceProvid // listCreateRequest creates the List request. func (client *ResourceTypesClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *ResourceTypesClientListOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes" + urlPath := "/GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -305,7 +305,7 @@ func (client *ResourceTypesClient) listCreateRequest(ctx context.Context, planeN // listHandleResponse handles the List response. func (client *ResourceTypesClient) listHandleResponse(resp *http.Response) (ResourceTypesClientListResponse, error) { result := ResourceTypesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceTypeResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { return ResourceTypesClientListResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_response_types.go b/pkg/ucp/api/v20231001preview/zz_generated_response_types.go index c5e912f122..13b65e65a0 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_response_types.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_response_types.go @@ -26,8 +26,8 @@ type APIVersionsClientGetResponse struct { // APIVersionsClientListResponse contains the response from method APIVersionsClient.NewListPager. type APIVersionsClientListResponse struct { - // The response of a ApiVersionResource list operation. - APIVersionResourceListResult + // The response of a Resource list operation. + ResourceListResult } // AwsCredentialsClientCreateOrUpdateResponse contains the response from method AwsCredentialsClient.CreateOrUpdate. @@ -49,8 +49,8 @@ type AwsCredentialsClientGetResponse struct { // AwsCredentialsClientListResponse contains the response from method AwsCredentialsClient.NewListPager. type AwsCredentialsClientListResponse struct { - // The response of a AwsCredentialResource list operation. - AwsCredentialResourceListResult + // The response of a Resource list operation. + ResourceListResult } // AwsCredentialsClientUpdateResponse contains the response from method AwsCredentialsClient.Update. @@ -107,8 +107,8 @@ type AzureCredentialsClientGetResponse struct { // AzureCredentialsClientListResponse contains the response from method AzureCredentialsClient.NewListPager. type AzureCredentialsClientListResponse struct { - // The response of a AzureCredentialResource list operation. - AzureCredentialResourceListResult + // The response of a Resource list operation. + ResourceListResult } // AzureCredentialsClientUpdateResponse contains the response from method AzureCredentialsClient.Update. @@ -167,14 +167,14 @@ type LocationsClientGetResponse struct { // LocationsClientListResponse contains the response from method LocationsClient.NewListPager. type LocationsClientListResponse struct { - // The response of a LocationResource list operation. - LocationResourceListResult + // The response of a Resource list operation. + ResourceListResult } // PlanesClientListPlanesResponse contains the response from method PlanesClient.NewListPlanesPager. type PlanesClientListPlanesResponse struct { - // The response of a GenericPlaneResource list operation. - GenericPlaneResourceListResult + // The response of a Resource list operation. + ResourceListResult } // RadiusPlanesClientCreateOrUpdateResponse contains the response from method RadiusPlanesClient.BeginCreateOrUpdate. @@ -225,8 +225,8 @@ type ResourceGroupsClientGetResponse struct { // ResourceGroupsClientListResponse contains the response from method ResourceGroupsClient.NewListPager. type ResourceGroupsClientListResponse struct { - // The response of a ResourceGroupResource list operation. - ResourceGroupResourceListResult + // The response of a Resource list operation. + ResourceListResult } // ResourceGroupsClientUpdateResponse contains the response from method ResourceGroupsClient.Update. @@ -267,8 +267,8 @@ type ResourceProvidersClientListProviderSummariesResponse struct { // ResourceProvidersClientListResponse contains the response from method ResourceProvidersClient.NewListPager. type ResourceProvidersClientListResponse struct { - // The response of a ResourceProviderResource list operation. - ResourceProviderResourceListResult + // The response of a Resource list operation. + ResourceListResult } // ResourceTypesClientCreateOrUpdateResponse contains the response from method ResourceTypesClient.BeginCreateOrUpdate. @@ -290,13 +290,13 @@ type ResourceTypesClientGetResponse struct { // ResourceTypesClientListResponse contains the response from method ResourceTypesClient.NewListPager. type ResourceTypesClientListResponse struct { - // The response of a ResourceTypeResource list operation. - ResourceTypeResourceListResult + // The response of a Resource list operation. + ResourceListResult } // ResourcesClientListResponse contains the response from method ResourcesClient.NewListPager. type ResourcesClientListResponse struct { - // The response of a GenericResource list operation. - GenericResourceListResult + // The response of a Resource list operation. + ResourceListResult } diff --git a/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json b/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json index 089957ee01..c853245ffe 100644 --- a/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json +++ b/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json @@ -77,7 +77,7 @@ } ], "paths": { - "/planes": { + "/": { "get": { "operationId": "Planes_ListPlanes", "tags": [ @@ -93,7 +93,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/GenericPlaneResourceListResult" + "$ref": "#/definitions/ResourceListResult" } }, "default": { @@ -113,25 +113,57 @@ } } }, - "/planes/aws": { - "get": { - "operationId": "AwsPlanes_List", + "/DELETE /planes/{resourceProviderName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { + "delete": { + "operationId": "ResourceProviders_Delete", "tags": [ - "AwsPlanes" + "ResourceProviders" ], - "description": "List AWS planes", + "description": "Delete a resource provider", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" } ], "responses": { "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/AwsPlaneResourceListResult" + "description": "Resource deleted successfully." + }, + "202": { + "description": "Resource deletion accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } } }, + "204": { + "description": "Resource does not exist." + }, "default": { "description": "An unexpected error response.", "schema": { @@ -139,26 +171,35 @@ } } }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } + "x-ms-examples": { + "Delete a resource resource": { + "$ref": "./examples/ResourceProviders_Delete.json" + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true } }, - "/planes/aws/{planeName}": { - "get": { - "operationId": "AwsPlanes_Get", + "/DELETE /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { + "delete": { + "operationId": "AwsCredentials_Delete", "tags": [ - "AwsPlanes" + "AwsCredentials" ], - "description": "Get a plane by name", + "description": "Delete an AWS credential", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "name": "planeName", + "$ref": "#/parameters/AwsPlaneNameParameter" + }, + { + "name": "credentialName", "in": "path", - "description": "The plane name.", + "description": "The AWS credential name.", "required": true, "type": "string", "maxLength": 63, @@ -167,10 +208,10 @@ ], "responses": { "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/AwsPlaneResource" - } + "description": "Resource deleted successfully." + }, + "204": { + "description": "Resource does not exist." }, "default": { "description": "An unexpected error response.", @@ -178,14 +219,24 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } + }, + "x-ms-examples": { + "Delete an AWS AccessKey credential": { + "$ref": "./examples/AWSCredential_AccessKey_Delete.json" + }, + "Delete an AWS IRSA credential": { + "$ref": "./examples/AWSCredential_IRSA_Delete.json" + } } - }, - "put": { - "operationId": "AwsPlanes_CreateOrUpdate", + } + }, + "/DELETE /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { + "delete": { + "operationId": "ResourceTypes_Delete", "tags": [ - "AwsPlanes" + "ResourceTypes" ], - "description": "Create or update a plane", + "description": "Delete a resource type", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -200,28 +251,35 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resource", - "in": "body", - "description": "Resource create parameters.", + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", "required": true, - "schema": { - "$ref": "#/definitions/AwsPlaneResource" - } + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, + { + "name": "resourceTypeName", + "in": "path", + "description": "The resource type name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" } ], "responses": { "200": { - "description": "Resource 'AwsPlaneResource' update operation succeeded", - "schema": { - "$ref": "#/definitions/AwsPlaneResource" - } + "description": "Resource deleted successfully." }, - "201": { - "description": "Resource 'AwsPlaneResource' create operation succeeded", - "schema": { - "$ref": "#/definitions/AwsPlaneResource" - }, + "202": { + "description": "Resource deletion accepted.", "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, "Retry-After": { "type": "integer", "format": "int32", @@ -229,6 +287,9 @@ } } }, + "204": { + "description": "Resource does not exist." + }, "default": { "description": "An unexpected error response.", "schema": { @@ -236,17 +297,24 @@ } } }, + "x-ms-examples": { + "Delete a resource type defined by a resource provider.": { + "$ref": "./examples/ResourceTypes_Delete.json" + } + }, "x-ms-long-running-operation-options": { - "final-state-via": "azure-async-operation" + "final-state-via": "location" }, "x-ms-long-running-operation": true - }, - "patch": { - "operationId": "AwsPlanes_Update", + } + }, + "/DELETE /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}": { + "delete": { + "operationId": "ResourceGroups_Delete", "tags": [ - "AwsPlanes" + "ResourceGroups" ], - "description": "Update a plane", + "description": "Delete a resource group", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -261,35 +329,21 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "properties", - "in": "body", - "description": "The resource properties to be updated.", + "name": "resourceGroupName", + "in": "path", + "description": "The name of resource group", "required": true, - "schema": { - "$ref": "#/definitions/AwsPlaneResourceTagsUpdate" - } + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/AwsPlaneResource" - } + "description": "Resource deleted successfully." }, - "202": { - "description": "Resource update request accepted.", - "headers": { - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." - }, - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } - } + "204": { + "description": "Resource does not exist." }, "default": { "description": "An unexpected error response.", @@ -298,17 +352,20 @@ } } }, - "x-ms-long-running-operation-options": { - "final-state-via": "location" - }, - "x-ms-long-running-operation": true - }, - "delete": { - "operationId": "AwsPlanes_Delete", + "x-ms-examples": { + "Delete a resource group": { + "$ref": "./examples/ResourceGroups_Delete.json" + } + } + } + }, + "/GET /planes/{resourceProviderName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { + "get": { + "operationId": "ResourceProviders_Get", "tags": [ - "AwsPlanes" + "ResourceProviders" ], - "description": "Delete a plane", + "description": "Get the specified resource provider.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -321,29 +378,24 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" } ], "responses": { "200": { - "description": "Resource deleted successfully." - }, - "202": { - "description": "Resource deletion accepted.", - "headers": { - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." - }, - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/ResourceProviderResource" } }, - "204": { - "description": "Resource does not exist." - }, "default": { "description": "An unexpected error response.", "schema": { @@ -351,13 +403,14 @@ } } }, - "x-ms-long-running-operation-options": { - "final-state-via": "location" - }, - "x-ms-long-running-operation": true + "x-ms-examples": { + "Gets a resource provider.": { + "$ref": "./examples/ResourceProviders_Get.json" + } + } } }, - "/planes/aws/{planeName}/providers/System.AWS/credentials": { + "/GET /planes/aws": { "get": { "operationId": "AwsCredentials_List", "tags": [ @@ -367,16 +420,13 @@ "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/AwsPlaneNameParameter" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AwsCredentialResourceListResult" + "$ref": "#/definitions/ResourceListResult" } }, "default": { @@ -399,7 +449,7 @@ } } }, - "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { + "/GET /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { "get": { "operationId": "AwsCredentials_Get", "tags": [ @@ -445,50 +495,37 @@ "$ref": "./examples/AWSCredential_IRSA_Get.json" } } - }, - "put": { - "operationId": "AwsCredentials_CreateOrUpdate", + } + }, + "/GET /planes/azure/{planeName}/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}": { + "get": { + "operationId": "AzureCredentials_Get", "tags": [ - "AwsCredentials" + "AzureCredentials" ], - "description": "Create or update an AWS credential", + "description": "Get an Azure credential", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/AwsPlaneNameParameter" + "$ref": "#/parameters/AzurePlaneNameParameter" }, { "name": "credentialName", "in": "path", - "description": "The AWS credential name.", + "description": "The Azure credential name.", "required": true, "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resource", - "in": "body", - "description": "Resource create parameters.", - "required": true, - "schema": { - "$ref": "#/definitions/AwsCredentialResource" - } } ], "responses": { "200": { - "description": "Resource 'AwsCredentialResource' update operation succeeded", - "schema": { - "$ref": "#/definitions/AwsCredentialResource" - } - }, - "201": { - "description": "Resource 'AwsCredentialResource' create operation succeeded", + "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AwsCredentialResource" + "$ref": "#/definitions/AzureCredentialResource" } }, "default": { @@ -499,51 +536,35 @@ } }, "x-ms-examples": { - "Create or update an AWS AccessKey credential": { - "$ref": "./examples/AWSCredential_AccessKey_CreateOrUpdate.json" + "Get an Azure Service Principal credential": { + "$ref": "./examples/AzureCredential_ServicePrincipal_Get.json" }, - "Create or update an AWS IRSA credential": { - "$ref": "./examples/AWSCredential_IRSA_CreateOrUpdate.json" + "Get an Azure Workload Identity credential": { + "$ref": "./examples/AzureCredential_WorkloadIdentity_Get.json" } } - }, - "patch": { - "operationId": "AwsCredentials_Update", + } + }, + "/GET /planes/azure/planes/azure/{planeName}": { + "get": { + "operationId": "AzureCredentials_List", "tags": [ - "AwsCredentials" + "AzureCredentials" ], - "description": "Update an AWS credential", + "description": "List Azure credentials", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/AwsPlaneNameParameter" - }, - { - "name": "credentialName", - "in": "path", - "description": "The AWS credential name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "properties", - "in": "body", - "description": "The resource properties to be updated.", - "required": true, - "schema": { - "$ref": "#/definitions/AwsCredentialResourceTagsUpdate" - } + "$ref": "#/parameters/AzurePlaneNameParameter" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AwsCredentialResource" + "$ref": "#/definitions/ResourceListResult" } }, "default": { @@ -554,43 +575,63 @@ } }, "x-ms-examples": { - "Update an AWS AccessKey credential": { - "$ref": "./examples/AWSCredential_AccessKey_Update.json" + "List Azure Service Principal credentials": { + "$ref": "./examples/AzureCredential_ServicePrincipal_List.json" }, - "Update an AWS IRSA credential": { - "$ref": "./examples/AWSCredential_IRSA_Update.json" + "List Azure Workload Identity credentials": { + "$ref": "./examples/AzureCredential_WorkloadIdentity_List.json" } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" } - }, - "delete": { - "operationId": "AwsCredentials_Delete", + } + }, + "/GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { + "get": { + "operationId": "ResourceTypes_Get", "tags": [ - "AwsCredentials" + "ResourceTypes" ], - "description": "Delete an AWS credential", + "description": "Get the specified resource type.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/AwsPlaneNameParameter" + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "credentialName", + "name": "resourceProviderName", "in": "path", - "description": "The AWS credential name.", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, + { + "name": "resourceTypeName", + "in": "path", + "description": "The resource type name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" } ], "responses": { "200": { - "description": "Resource deleted successfully." - }, - "204": { - "description": "Resource does not exist." + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/ResourceTypeResource" + } }, "default": { "description": "An unexpected error response.", @@ -600,32 +641,47 @@ } }, "x-ms-examples": { - "Delete an AWS AccessKey credential": { - "$ref": "./examples/AWSCredential_AccessKey_Delete.json" - }, - "Delete an AWS IRSA credential": { - "$ref": "./examples/AWSCredential_IRSA_Delete.json" + "Gets a resource type defined by a resource provider.": { + "$ref": "./examples/ResourceTypes_Get.json" } } } }, - "/planes/azure": { + "/GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { "get": { - "operationId": "AzurePlanes_List", + "operationId": "ResourceTypes_List", "tags": [ - "AzurePlanes" + "ResourceTypes" ], - "description": "List azure planes", + "description": "List resource types.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AzurePlaneResourceListResult" + "$ref": "#/definitions/ResourceListResult" } }, "default": { @@ -635,18 +691,23 @@ } } }, + "x-ms-examples": { + "List resource types defined by a resource provider.": { + "$ref": "./examples/ResourceTypes_List.json" + } + }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, - "/planes/azure/{planeName}": { + "/GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/radius/{planeName}": { "get": { - "operationId": "AzurePlanes_Get", + "operationId": "ResourceProviders_List", "tags": [ - "AzurePlanes" + "ResourceProviders" ], - "description": "Get a plane by name", + "description": "List resource providers.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -665,7 +726,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AzurePlaneResource" + "$ref": "#/definitions/ResourceListResult" } }, "default": { @@ -674,14 +735,24 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } + }, + "x-ms-examples": { + "List resource providers.": { + "$ref": "./examples/ResourceProviders_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" } - }, - "put": { - "operationId": "AzurePlanes_CreateOrUpdate", + } + }, + "/GET /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}": { + "get": { + "operationId": "ResourceGroups_Get", "tags": [ - "AzurePlanes" + "ResourceGroups" ], - "description": "Create or update a plane", + "description": "Get a resource group", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -696,33 +767,20 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resource", - "in": "body", - "description": "Resource create parameters.", + "name": "resourceGroupName", + "in": "path", + "description": "The name of resource group", "required": true, - "schema": { - "$ref": "#/definitions/AzurePlaneResource" - } + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { - "description": "Resource 'AzurePlaneResource' update operation succeeded", - "schema": { - "$ref": "#/definitions/AzurePlaneResource" - } - }, - "201": { - "description": "Resource 'AzurePlaneResource' create operation succeeded", + "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AzurePlaneResource" - }, - "headers": { - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } + "$ref": "#/definitions/ResourceGroupResource" } }, "default": { @@ -732,17 +790,20 @@ } } }, - "x-ms-long-running-operation-options": { - "final-state-via": "azure-async-operation" - }, - "x-ms-long-running-operation": true - }, - "patch": { - "operationId": "AzurePlanes_Update", + "x-ms-examples": { + "Get a resource group": { + "$ref": "./examples/ResourceGroups_Get.json" + } + } + } + }, + "/GET /planes/radius/{planeName}/resourcegroups/radius/{planeName}": { + "get": { + "operationId": "ResourceGroups_List", "tags": [ - "AzurePlanes" + "ResourceGroups" ], - "description": "Update a plane", + "description": "List resource groups", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -755,32 +816,202 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "properties", - "in": "body", - "description": "The resource properties to be updated.", - "required": true, - "schema": { - "$ref": "#/definitions/AzurePlaneResourceTagsUpdate" - } } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AzurePlaneResource" + "$ref": "#/definitions/ResourceListResult" } }, - "202": { - "description": "Resource update request accepted.", - "headers": { - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." - }, - "Retry-After": { + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List resource groups": { + "$ref": "./examples/ResourceGroups_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/PATCH /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { + "patch": { + "operationId": "AwsCredentials_Update", + "tags": [ + "AwsCredentials" + ], + "description": "Update an AWS credential", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/AwsPlaneNameParameter" + }, + { + "name": "credentialName", + "in": "path", + "description": "The AWS credential name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/AwsCredentialResourceTagsUpdate" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/AwsCredentialResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Update an AWS AccessKey credential": { + "$ref": "./examples/AWSCredential_AccessKey_Update.json" + }, + "Update an AWS IRSA credential": { + "$ref": "./examples/AWSCredential_IRSA_Update.json" + } + } + } + }, + "/PATCH /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}": { + "patch": { + "operationId": "ResourceGroups_Update", + "tags": [ + "ResourceGroups" + ], + "description": "Update a resource group", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceGroupName", + "in": "path", + "description": "The name of resource group", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/ResourceGroupResourceTagsUpdate" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/ResourceGroupResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Update a resource group": { + "$ref": "./examples/ResourceGroups_Update.json" + } + } + } + }, + "/PUT /planes/{resourceProviderName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { + "put": { + "operationId": "ResourceProviders_CreateOrUpdate", + "tags": [ + "ResourceProviders" + ], + "description": "Create or update a resource provider", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/ResourceProviderResource" + } + } + ], + "responses": { + "200": { + "description": "Resource 'ResourceProviderResource' update operation succeeded", + "schema": { + "$ref": "#/definitions/ResourceProviderResource" + } + }, + "201": { + "description": "Resource 'ResourceProviderResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/ResourceProviderResource" + }, + "headers": { + "Retry-After": { "type": "integer", "format": "int32", "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." @@ -794,17 +1025,87 @@ } } }, + "x-ms-examples": { + "Create or update a resource provider": { + "$ref": "./examples/ResourceProviders_CreateOrUpdate.json" + } + }, "x-ms-long-running-operation-options": { - "final-state-via": "location" + "final-state-via": "azure-async-operation" }, "x-ms-long-running-operation": true - }, - "delete": { - "operationId": "AzurePlanes_Delete", + } + }, + "/PUT /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { + "put": { + "operationId": "AwsCredentials_CreateOrUpdate", "tags": [ - "AzurePlanes" + "AwsCredentials" ], - "description": "Delete a plane", + "description": "Create or update an AWS credential", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/AwsPlaneNameParameter" + }, + { + "name": "credentialName", + "in": "path", + "description": "The AWS credential name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/AwsCredentialResource" + } + } + ], + "responses": { + "200": { + "description": "Resource 'AwsCredentialResource' update operation succeeded", + "schema": { + "$ref": "#/definitions/AwsCredentialResource" + } + }, + "201": { + "description": "Resource 'AwsCredentialResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/AwsCredentialResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Create or update an AWS AccessKey credential": { + "$ref": "./examples/AWSCredential_AccessKey_CreateOrUpdate.json" + }, + "Create or update an AWS IRSA credential": { + "$ref": "./examples/AWSCredential_IRSA_CreateOrUpdate.json" + } + } + } + }, + "/PUT /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { + "put": { + "operationId": "ResourceTypes_CreateOrUpdate", + "tags": [ + "ResourceTypes" + ], + "description": "Create or update a resource type", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -817,19 +1118,48 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, + { + "name": "resourceTypeName", + "in": "path", + "description": "The resource type name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/ResourceTypeResource" + } } ], "responses": { "200": { - "description": "Resource deleted successfully." + "description": "Resource 'ResourceTypeResource' update operation succeeded", + "schema": { + "$ref": "#/definitions/ResourceTypeResource" + } }, - "202": { - "description": "Resource deletion accepted.", + "201": { + "description": "Resource 'ResourceTypeResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/ResourceTypeResource" + }, "headers": { - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." - }, "Retry-After": { "type": "integer", "format": "int32", @@ -837,9 +1167,6 @@ } } }, - "204": { - "description": "Resource does not exist." - }, "default": { "description": "An unexpected error response.", "schema": { @@ -847,32 +1174,67 @@ } } }, + "x-ms-examples": { + "Create or update a resource type defined by a resource provider.": { + "$ref": "./examples/ResourceTypes_CreateOrUpdate.json" + } + }, "x-ms-long-running-operation-options": { - "final-state-via": "location" + "final-state-via": "azure-async-operation" }, "x-ms-long-running-operation": true } }, - "/planes/azure/{planeName}/providers/System.Azure/credentials": { - "get": { - "operationId": "AzureCredentials_List", + "/PUT /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}": { + "put": { + "operationId": "ResourceGroups_CreateOrUpdate", "tags": [ - "AzureCredentials" + "ResourceGroups" ], - "description": "List Azure credentials", + "description": "Create or update a resource group", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/AzurePlaneNameParameter" + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceGroupName", + "in": "path", + "description": "The name of resource group", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/ResourceGroupResource" + } } ], "responses": { "200": { - "description": "Azure operation completed successfully.", + "description": "Resource 'ResourceGroupResource' update operation succeeded", + "schema": { + "$ref": "#/definitions/ResourceGroupResource" + } + }, + "201": { + "description": "Resource 'ResourceGroupResource' create operation succeeded", "schema": { - "$ref": "#/definitions/AzureCredentialResourceListResult" + "$ref": "#/definitions/ResourceGroupResource" } }, "default": { @@ -883,11 +1245,36 @@ } }, "x-ms-examples": { - "List Azure Service Principal credentials": { - "$ref": "./examples/AzureCredential_ServicePrincipal_List.json" + "Create or update a resource group": { + "$ref": "./examples/ResourceGroups_CreateOrUpdate.json" + } + } + } + }, + "/planes/aws": { + "get": { + "operationId": "AwsPlanes_List", + "tags": [ + "AwsPlanes" + ], + "description": "List AWS planes", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/AwsPlaneResourceListResult" + } }, - "List Azure Workload Identity credentials": { - "$ref": "./examples/AzureCredential_WorkloadIdentity_List.json" + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } } }, "x-ms-pageable": { @@ -895,24 +1282,21 @@ } } }, - "/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}": { + "/planes/aws/{planeName}": { "get": { - "operationId": "AzureCredentials_Get", + "operationId": "AwsPlanes_Get", "tags": [ - "AzureCredentials" + "AwsPlanes" ], - "description": "Get an Azure credential", + "description": "Get a plane by name", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/AzurePlaneNameParameter" - }, - { - "name": "credentialName", + "name": "planeName", "in": "path", - "description": "The Azure credential name.", + "description": "The plane name.", "required": true, "type": "string", "maxLength": 63, @@ -923,7 +1307,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AzureCredentialResource" + "$ref": "#/definitions/AwsPlaneResource" } }, "default": { @@ -932,33 +1316,22 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } - }, - "x-ms-examples": { - "Get an Azure Service Principal credential": { - "$ref": "./examples/AzureCredential_ServicePrincipal_Get.json" - }, - "Get an Azure Workload Identity credential": { - "$ref": "./examples/AzureCredential_WorkloadIdentity_Get.json" - } } }, "put": { - "operationId": "AzureCredentials_CreateOrUpdate", + "operationId": "AwsPlanes_CreateOrUpdate", "tags": [ - "AzureCredentials" + "AwsPlanes" ], - "description": "Create or update an Azure credential", + "description": "Create or update a plane", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/AzurePlaneNameParameter" - }, - { - "name": "credentialName", + "name": "planeName", "in": "path", - "description": "The Azure credential name.", + "description": "The plane name.", "required": true, "type": "string", "maxLength": 63, @@ -970,21 +1343,28 @@ "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/AzureCredentialResource" + "$ref": "#/definitions/AwsPlaneResource" } } ], "responses": { "200": { - "description": "Resource 'AzureCredentialResource' update operation succeeded", + "description": "Resource 'AwsPlaneResource' update operation succeeded", "schema": { - "$ref": "#/definitions/AzureCredentialResource" + "$ref": "#/definitions/AwsPlaneResource" } }, "201": { - "description": "Resource 'AzureCredentialResource' create operation succeeded", + "description": "Resource 'AwsPlaneResource' create operation succeeded", "schema": { - "$ref": "#/definitions/AzureCredentialResource" + "$ref": "#/definitions/AwsPlaneResource" + }, + "headers": { + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } } }, "default": { @@ -994,32 +1374,25 @@ } } }, - "x-ms-examples": { - "Create or update an Azure Service Principal credential": { - "$ref": "./examples/AzureCredential_ServicePrincipal_CreateOrUpdate.json" - }, - "Create or update an Azure Workload Identity credential": { - "$ref": "./examples/AzureCredential_WorkloadIdentity_CreateOrUpdate.json" - } - } + "x-ms-long-running-operation-options": { + "final-state-via": "azure-async-operation" + }, + "x-ms-long-running-operation": true }, "patch": { - "operationId": "AzureCredentials_Update", + "operationId": "AwsPlanes_Update", "tags": [ - "AzureCredentials" + "AwsPlanes" ], - "description": "Update an Azure credential", + "description": "Update a plane", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/AzurePlaneNameParameter" - }, - { - "name": "credentialName", + "name": "planeName", "in": "path", - "description": "The Azure credential name.", + "description": "The plane name.", "required": true, "type": "string", "maxLength": 63, @@ -1031,7 +1404,7 @@ "description": "The resource properties to be updated.", "required": true, "schema": { - "$ref": "#/definitions/AzureCredentialResourceTagsUpdate" + "$ref": "#/definitions/AwsPlaneResourceTagsUpdate" } } ], @@ -1039,7 +1412,21 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AzureCredentialResource" + "$ref": "#/definitions/AwsPlaneResource" + } + }, + "202": { + "description": "Resource update request accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } } }, "default": { @@ -1049,32 +1436,25 @@ } } }, - "x-ms-examples": { - "Update an Azure Service Principal credential": { - "$ref": "./examples/AzureCredential_ServicePrincipal_Update.json" - }, - "Update an Azure Workload Identity credential": { - "$ref": "./examples/AzureCredential_WorkloadIdentity_Update.json" - } - } + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true }, "delete": { - "operationId": "AzureCredentials_Delete", + "operationId": "AwsPlanes_Delete", "tags": [ - "AzureCredentials" + "AwsPlanes" ], - "description": "Delete an Azure credential", + "description": "Delete a plane", "parameters": [ { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/AzurePlaneNameParameter" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "name": "credentialName", + "name": "planeName", "in": "path", - "description": "The Azure credential name.", + "description": "The plane name.", "required": true, "type": "string", "maxLength": 63, @@ -1085,6 +1465,20 @@ "200": { "description": "Resource deleted successfully." }, + "202": { + "description": "Resource deletion accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, "204": { "description": "Resource does not exist." }, @@ -1095,23 +1489,19 @@ } } }, - "x-ms-examples": { - "Delete an Azure Service Principal credential": { - "$ref": "./examples/AzureCredential_ServicePrincipal_Delete.json" - }, - "Delete an Azure Workload Identity credential": { - "$ref": "./examples/AzureCredential_WorkloadIdentity_Delete.json" - } - } + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true } }, - "/planes/radius": { + "/planes/azure": { "get": { - "operationId": "RadiusPlanes_List", + "operationId": "AzurePlanes_List", "tags": [ - "RadiusPlanes" + "AzurePlanes" ], - "description": "List Radius planes", + "description": "List azure planes", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1121,7 +1511,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/RadiusPlaneResourceListResult" + "$ref": "#/definitions/AzurePlaneResourceListResult" } }, "default": { @@ -1136,11 +1526,11 @@ } } }, - "/planes/radius/{planeName}": { + "/planes/azure/{planeName}": { "get": { - "operationId": "RadiusPlanes_Get", + "operationId": "AzurePlanes_Get", "tags": [ - "RadiusPlanes" + "AzurePlanes" ], "description": "Get a plane by name", "parameters": [ @@ -1161,7 +1551,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/RadiusPlaneResource" + "$ref": "#/definitions/AzurePlaneResource" } }, "default": { @@ -1173,9 +1563,9 @@ } }, "put": { - "operationId": "RadiusPlanes_CreateOrUpdate", + "operationId": "AzurePlanes_CreateOrUpdate", "tags": [ - "RadiusPlanes" + "AzurePlanes" ], "description": "Create or update a plane", "parameters": [ @@ -1197,21 +1587,21 @@ "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/RadiusPlaneResource" + "$ref": "#/definitions/AzurePlaneResource" } } ], "responses": { "200": { - "description": "Resource 'RadiusPlaneResource' update operation succeeded", + "description": "Resource 'AzurePlaneResource' update operation succeeded", "schema": { - "$ref": "#/definitions/RadiusPlaneResource" + "$ref": "#/definitions/AzurePlaneResource" } }, "201": { - "description": "Resource 'RadiusPlaneResource' create operation succeeded", + "description": "Resource 'AzurePlaneResource' create operation succeeded", "schema": { - "$ref": "#/definitions/RadiusPlaneResource" + "$ref": "#/definitions/AzurePlaneResource" }, "headers": { "Retry-After": { @@ -1234,9 +1624,9 @@ "x-ms-long-running-operation": true }, "patch": { - "operationId": "RadiusPlanes_Update", + "operationId": "AzurePlanes_Update", "tags": [ - "RadiusPlanes" + "AzurePlanes" ], "description": "Update a plane", "parameters": [ @@ -1258,7 +1648,7 @@ "description": "The resource properties to be updated.", "required": true, "schema": { - "$ref": "#/definitions/RadiusPlaneResourceTagsUpdate" + "$ref": "#/definitions/AzurePlaneResourceTagsUpdate" } } ], @@ -1266,7 +1656,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/RadiusPlaneResource" + "$ref": "#/definitions/AzurePlaneResource" } }, "202": { @@ -1296,9 +1686,9 @@ "x-ms-long-running-operation": true }, "delete": { - "operationId": "RadiusPlanes_Delete", + "operationId": "AzurePlanes_Delete", "tags": [ - "RadiusPlanes" + "AzurePlanes" ], "description": "Delete a plane", "parameters": [ @@ -1349,182 +1739,50 @@ "x-ms-long-running-operation": true } }, - "/planes/radius/{planeName}/providers": { - "get": { - "operationId": "ResourceProviders_ListProviderSummaries", + "/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}": { + "put": { + "operationId": "AzureCredentials_CreateOrUpdate", "tags": [ - "ResourceProviders" + "AzureCredentials" ], - "description": "List resource provider summaries. The resource provider summary aggregates the most commonly used information including locations, api versions and resource types.", + "description": "Create or update an Azure credential", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/PagedResourceProviderSummary" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "List resource provider summaries. The resource provider summary aggregates common information about resource types, api versions, and locations.": { - "$ref": "./examples/ResourceProviders_ListProviderSummaries.json" - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/planes/radius/{planeName}/providers/{resourceProviderName}": { - "get": { - "operationId": "ResourceProviders_GetProviderSummary", - "tags": [ - "ResourceProviders" - ], - "description": "Get the specified resource provider summary. The resource provider summary aggregates the most commonly used information including locations, api versions and resource types.", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + "$ref": "#/parameters/AzurePlaneNameParameter" }, { - "name": "planeName", + "name": "credentialName", "in": "path", - "description": "The plane name.", + "description": "The Azure credential name.", "required": true, "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "name": "resource", + "in": "body", + "description": "Resource create parameters.", "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/ResourceProviderSummary" - } - }, - "default": { - "description": "An unexpected error response.", "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + "$ref": "#/definitions/AzureCredentialResource" } } - }, - "x-ms-examples": { - "Get a resoure provider summary. The resource provider summary aggregates common information about resource types, api versions, and locations.": { - "$ref": "./examples/ResourceProviders_GetProviderSummary.json" - } - } - } - }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders": { - "get": { - "operationId": "ResourceProviders_List", - "tags": [ - "ResourceProviders" - ], - "description": "List resource providers.", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - } ], "responses": { "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/ResourceProviderResourceListResult" - } - }, - "default": { - "description": "An unexpected error response.", + "description": "Resource 'AzureCredentialResource' update operation succeeded", "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + "$ref": "#/definitions/AzureCredentialResource" } - } - }, - "x-ms-examples": { - "List resource providers.": { - "$ref": "./examples/ResourceProviders_List.json" - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { - "get": { - "operationId": "ResourceProviders_Get", - "tags": [ - "ResourceProviders" - ], - "description": "Get the specified resource provider.", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, - { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", + "201": { + "description": "Resource 'AzureCredentialResource' create operation succeeded", "schema": { - "$ref": "#/definitions/ResourceProviderResource" + "$ref": "#/definitions/AzureCredentialResource" } }, "default": { @@ -1535,67 +1793,51 @@ } }, "x-ms-examples": { - "Gets a resource provider.": { - "$ref": "./examples/ResourceProviders_Get.json" + "Create or update an Azure Service Principal credential": { + "$ref": "./examples/AzureCredential_ServicePrincipal_CreateOrUpdate.json" + }, + "Create or update an Azure Workload Identity credential": { + "$ref": "./examples/AzureCredential_WorkloadIdentity_CreateOrUpdate.json" } } }, - "put": { - "operationId": "ResourceProviders_CreateOrUpdate", + "patch": { + "operationId": "AzureCredentials_Update", "tags": [ - "ResourceProviders" + "AzureCredentials" ], - "description": "Create or update a resource provider", + "description": "Update an Azure credential", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "name": "planeName", + "$ref": "#/parameters/AzurePlaneNameParameter" + }, + { + "name": "credentialName", "in": "path", - "description": "The plane name.", + "description": "The Azure credential name.", "required": true, "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - }, - { - "name": "resource", + "name": "properties", "in": "body", - "description": "Resource create parameters.", + "description": "The resource properties to be updated.", "required": true, "schema": { - "$ref": "#/definitions/ResourceProviderResource" + "$ref": "#/definitions/AzureCredentialResourceTagsUpdate" } } ], "responses": { "200": { - "description": "Resource 'ResourceProviderResource' update operation succeeded", - "schema": { - "$ref": "#/definitions/ResourceProviderResource" - } - }, - "201": { - "description": "Resource 'ResourceProviderResource' create operation succeeded", + "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceProviderResource" - }, - "headers": { - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } + "$ref": "#/definitions/AzureCredentialResource" } }, "default": { @@ -1606,62 +1848,41 @@ } }, "x-ms-examples": { - "Create or update a resource provider": { - "$ref": "./examples/ResourceProviders_CreateOrUpdate.json" + "Update an Azure Service Principal credential": { + "$ref": "./examples/AzureCredential_ServicePrincipal_Update.json" + }, + "Update an Azure Workload Identity credential": { + "$ref": "./examples/AzureCredential_WorkloadIdentity_Update.json" } - }, - "x-ms-long-running-operation-options": { - "final-state-via": "azure-async-operation" - }, - "x-ms-long-running-operation": true + } }, "delete": { - "operationId": "ResourceProviders_Delete", + "operationId": "AzureCredentials_Delete", "tags": [ - "ResourceProviders" + "AzureCredentials" ], - "description": "Delete a resource provider", + "description": "Delete an Azure credential", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + "$ref": "#/parameters/AzurePlaneNameParameter" }, { - "name": "resourceProviderName", + "name": "credentialName", "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "description": "The Azure credential name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { "description": "Resource deleted successfully." }, - "202": { - "description": "Resource deletion accepted.", - "headers": { - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." - }, - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } - } - }, "204": { "description": "Resource does not exist." }, @@ -1673,51 +1894,32 @@ } }, "x-ms-examples": { - "Delete a resource resource": { - "$ref": "./examples/ResourceProviders_Delete.json" + "Delete an Azure Service Principal credential": { + "$ref": "./examples/AzureCredential_ServicePrincipal_Delete.json" + }, + "Delete an Azure Workload Identity credential": { + "$ref": "./examples/AzureCredential_WorkloadIdentity_Delete.json" } - }, - "x-ms-long-running-operation-options": { - "final-state-via": "location" - }, - "x-ms-long-running-operation": true + } } }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations": { + "/planes/radius": { "get": { - "operationId": "Locations_List", + "operationId": "RadiusPlanes_List", "tags": [ - "Locations" + "RadiusPlanes" ], - "description": "List available locations for the specified resource provider.", + "description": "List Radius planes", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/LocationResourceListResult" + "$ref": "#/definitions/RadiusPlaneResourceListResult" } }, "default": { @@ -1727,23 +1929,18 @@ } } }, - "x-ms-examples": { - "List locations supported by a resource provider.": { - "$ref": "./examples/Locations_List.json" - } - }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations/{locationName}": { + "/planes/radius/{planeName}": { "get": { - "operationId": "Locations_Get", + "operationId": "RadiusPlanes_Get", "tags": [ - "Locations" + "RadiusPlanes" ], - "description": "Get the specified location. The location resource represents a logical location where the resource provider operates.", + "description": "Get a plane by name", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1756,31 +1953,13 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - }, - { - "name": "locationName", - "in": "path", - "description": "The location name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z][A-Za-z0-9]*$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/LocationResource" + "$ref": "#/definitions/RadiusPlaneResource" } }, "default": { @@ -1789,19 +1968,14 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } - }, - "x-ms-examples": { - "Gets a location supported by a resource provider.": { - "$ref": "./examples/Locations_Get.json" - } } }, "put": { - "operationId": "Locations_CreateOrUpdate", + "operationId": "RadiusPlanes_CreateOrUpdate", "tags": [ - "Locations" + "RadiusPlanes" ], - "description": "Create or update a location. The location resource represents a logical location where the resource provider operates.", + "description": "Create or update a plane", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1815,45 +1989,27 @@ "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, - { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - }, - { - "name": "locationName", - "in": "path", - "description": "The location name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z][A-Za-z0-9]*$" - }, { "name": "resource", "in": "body", "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/LocationResource" + "$ref": "#/definitions/RadiusPlaneResource" } } ], "responses": { "200": { - "description": "Resource 'LocationResource' update operation succeeded", + "description": "Resource 'RadiusPlaneResource' update operation succeeded", "schema": { - "$ref": "#/definitions/LocationResource" + "$ref": "#/definitions/RadiusPlaneResource" } }, "201": { - "description": "Resource 'LocationResource' create operation succeeded", + "description": "Resource 'RadiusPlaneResource' create operation succeeded", "schema": { - "$ref": "#/definitions/LocationResource" + "$ref": "#/definitions/RadiusPlaneResource" }, "headers": { "Retry-After": { @@ -1870,22 +2026,17 @@ } } }, - "x-ms-examples": { - "Create or update a location supported by a resource provider.": { - "$ref": "./examples/Locations_CreateOrUpdate.json" - } - }, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" }, "x-ms-long-running-operation": true }, - "delete": { - "operationId": "Locations_Delete", + "patch": { + "operationId": "RadiusPlanes_Update", "tags": [ - "Locations" + "RadiusPlanes" ], - "description": "Delete a location. The location resource represents a logical location where the resource provider operates.", + "description": "Update a plane", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1900,22 +2051,66 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/RadiusPlaneResourceTagsUpdate" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/RadiusPlaneResource" + } + }, + "202": { + "description": "Resource update request accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + }, + "delete": { + "operationId": "RadiusPlanes_Delete", + "tags": [ + "RadiusPlanes" + ], + "description": "Delete a plane", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "name": "locationName", + "name": "planeName", "in": "path", - "description": "The location name.", + "description": "The plane name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^[A-Za-z][A-Za-z0-9]*$" + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { @@ -1946,24 +2141,19 @@ } } }, - "x-ms-examples": { - "Delete a location supported by a resource provider.": { - "$ref": "./examples/Locations_Delete.json" - } - }, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-long-running-operation": true } }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes": { + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { "get": { - "operationId": "ResourceTypes_List", + "operationId": "Locations_List", "tags": [ - "ResourceTypes" + "Locations" ], - "description": "List resource types.", + "description": "List available locations for the specified resource provider.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1991,7 +2181,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceTypeResourceListResult" + "$ref": "#/definitions/ResourceListResult" } }, "default": { @@ -2002,8 +2192,8 @@ } }, "x-ms-examples": { - "List resource types defined by a resource provider.": { - "$ref": "./examples/ResourceTypes_List.json" + "List locations supported by a resource provider.": { + "$ref": "./examples/Locations_List.json" } }, "x-ms-pageable": { @@ -2011,13 +2201,13 @@ } } }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations/{locationName}": { "get": { - "operationId": "ResourceTypes_Get", + "operationId": "Locations_Get", "tags": [ - "ResourceTypes" + "Locations" ], - "description": "Get the specified resource type.", + "description": "Get the specified location. The location resource represents a logical location where the resource provider operates.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2041,20 +2231,20 @@ "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" }, { - "name": "resourceTypeName", + "name": "locationName", "in": "path", - "description": "The resource type name.", + "description": "The location name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" + "pattern": "^[A-Za-z][A-Za-z0-9]*$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceTypeResource" + "$ref": "#/definitions/LocationResource" } }, "default": { @@ -2065,17 +2255,17 @@ } }, "x-ms-examples": { - "Gets a resource type defined by a resource provider.": { - "$ref": "./examples/ResourceTypes_Get.json" + "Gets a location supported by a resource provider.": { + "$ref": "./examples/Locations_Get.json" } } }, "put": { - "operationId": "ResourceTypes_CreateOrUpdate", + "operationId": "Locations_CreateOrUpdate", "tags": [ - "ResourceTypes" + "Locations" ], - "description": "Create or update a resource type", + "description": "Create or update a location. The location resource represents a logical location where the resource provider operates.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2099,13 +2289,13 @@ "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" }, { - "name": "resourceTypeName", + "name": "locationName", "in": "path", - "description": "The resource type name.", + "description": "The location name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" + "pattern": "^[A-Za-z][A-Za-z0-9]*$" }, { "name": "resource", @@ -2113,21 +2303,21 @@ "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/ResourceTypeResource" + "$ref": "#/definitions/LocationResource" } } ], "responses": { "200": { - "description": "Resource 'ResourceTypeResource' update operation succeeded", + "description": "Resource 'LocationResource' update operation succeeded", "schema": { - "$ref": "#/definitions/ResourceTypeResource" + "$ref": "#/definitions/LocationResource" } }, "201": { - "description": "Resource 'ResourceTypeResource' create operation succeeded", + "description": "Resource 'LocationResource' create operation succeeded", "schema": { - "$ref": "#/definitions/ResourceTypeResource" + "$ref": "#/definitions/LocationResource" }, "headers": { "Retry-After": { @@ -2145,8 +2335,8 @@ } }, "x-ms-examples": { - "Create or update a resource type defined by a resource provider.": { - "$ref": "./examples/ResourceTypes_CreateOrUpdate.json" + "Create or update a location supported by a resource provider.": { + "$ref": "./examples/Locations_CreateOrUpdate.json" } }, "x-ms-long-running-operation-options": { @@ -2155,11 +2345,11 @@ "x-ms-long-running-operation": true }, "delete": { - "operationId": "ResourceTypes_Delete", + "operationId": "Locations_Delete", "tags": [ - "ResourceTypes" + "Locations" ], - "description": "Delete a resource type", + "description": "Delete a location. The location resource represents a logical location where the resource provider operates.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2183,13 +2373,13 @@ "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" }, { - "name": "resourceTypeName", + "name": "locationName", "in": "path", - "description": "The resource type name.", + "description": "The location name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" + "pattern": "^[A-Za-z][A-Za-z0-9]*$" } ], "responses": { @@ -2221,8 +2411,8 @@ } }, "x-ms-examples": { - "Delete a resource type defined by a resource provider.": { - "$ref": "./examples/ResourceTypes_Delete.json" + "Delete a location supported by a resource provider.": { + "$ref": "./examples/Locations_Delete.json" } }, "x-ms-long-running-operation-options": { @@ -2231,7 +2421,7 @@ "x-ms-long-running-operation": true } }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/apiversions": { + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { "get": { "operationId": "ApiVersions_List", "tags": [ @@ -2274,7 +2464,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ApiVersionResourceListResult" + "$ref": "#/definitions/ResourceListResult" } }, "default": { @@ -2531,181 +2721,23 @@ } }, "x-ms-examples": { - "Delete an api version of a resource type supported by a resource provider.": { - "$ref": "./examples/ApiVersions_Delete.json" - } - }, - "x-ms-long-running-operation-options": { - "final-state-via": "location" - }, - "x-ms-long-running-operation": true - } - }, - "/planes/radius/{planeName}/resourcegroups": { - "get": { - "operationId": "ResourceGroups_List", - "tags": [ - "ResourceGroups" - ], - "description": "List resource groups", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/ResourceGroupResourceListResult" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "List resource groups": { - "$ref": "./examples/ResourceGroups_List.json" - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}": { - "get": { - "operationId": "ResourceGroups_Get", - "tags": [ - "ResourceGroups" - ], - "description": "Get a resource group", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceGroupName", - "in": "path", - "description": "The name of resource group", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/ResourceGroupResource" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Get a resource group": { - "$ref": "./examples/ResourceGroups_Get.json" - } - } - }, - "put": { - "operationId": "ResourceGroups_CreateOrUpdate", - "tags": [ - "ResourceGroups" - ], - "description": "Create or update a resource group", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceGroupName", - "in": "path", - "description": "The name of resource group", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resource", - "in": "body", - "description": "Resource create parameters.", - "required": true, - "schema": { - "$ref": "#/definitions/ResourceGroupResource" - } - } - ], - "responses": { - "200": { - "description": "Resource 'ResourceGroupResource' update operation succeeded", - "schema": { - "$ref": "#/definitions/ResourceGroupResource" - } - }, - "201": { - "description": "Resource 'ResourceGroupResource' create operation succeeded", - "schema": { - "$ref": "#/definitions/ResourceGroupResource" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Create or update a resource group": { - "$ref": "./examples/ResourceGroups_CreateOrUpdate.json" + "Delete an api version of a resource type supported by a resource provider.": { + "$ref": "./examples/ApiVersions_Delete.json" } - } - }, - "patch": { - "operationId": "ResourceGroups_Update", + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + } + }, + "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}": { + "get": { + "operationId": "Resources_List", "tags": [ - "ResourceGroups" + "Resources" ], - "description": "Update a resource group", + "description": "List resources in a resource group", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2727,22 +2759,13 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "properties", - "in": "body", - "description": "The resource properties to be updated.", - "required": true, - "schema": { - "$ref": "#/definitions/ResourceGroupResourceTagsUpdate" - } } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceGroupResource" + "$ref": "#/definitions/ResourceListResult" } }, "default": { @@ -2753,17 +2776,22 @@ } }, "x-ms-examples": { - "Update a resource group": { - "$ref": "./examples/ResourceGroups_Update.json" + "List resources in a resource group.": { + "$ref": "./examples/Resources_List.json" } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" } - }, - "delete": { - "operationId": "ResourceGroups_Delete", + } + }, + "/radius/{planeName}/providers": { + "get": { + "operationId": "ResourceProviders_ListProviderSummaries", "tags": [ - "ResourceGroups" + "ResourceProviders" ], - "description": "Delete a resource group", + "description": "List resource provider summaries. The resource provider summary aggregates the most commonly used information including locations, api versions and resource types.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2776,23 +2804,14 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceGroupName", - "in": "path", - "description": "The name of resource group", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { - "description": "Resource deleted successfully." - }, - "204": { - "description": "Resource does not exist." + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/PagedResourceProviderSummary" + } }, "default": { "description": "An unexpected error response.", @@ -2802,19 +2821,22 @@ } }, "x-ms-examples": { - "Delete a resource group": { - "$ref": "./examples/ResourceGroups_Delete.json" + "List resource provider summaries. The resource provider summary aggregates common information about resource types, api versions, and locations.": { + "$ref": "./examples/ResourceProviders_ListProviderSummaries.json" } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" } } }, - "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/resources": { + "/radius/{planeName}/providers/{resourceProviderName}": { "get": { - "operationId": "Resources_List", + "operationId": "ResourceProviders_GetProviderSummary", "tags": [ - "Resources" + "ResourceProviders" ], - "description": "List resources in a resource group", + "description": "Get the specified resource provider summary. The resource provider summary aggregates the most commonly used information including locations, api versions and resource types.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2829,20 +2851,20 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resourceGroupName", + "name": "resourceProviderName", "in": "path", - "description": "The name of resource group", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/GenericResourceListResult" + "$ref": "#/definitions/ResourceProviderSummary" } }, "default": { @@ -2853,12 +2875,9 @@ } }, "x-ms-examples": { - "List resources in a resource group.": { - "$ref": "./examples/Resources_List.json" + "Get a resoure provider summary. The resource provider summary aggregates common information about resource types, api versions, and locations.": { + "$ref": "./examples/ResourceProviders_GetProviderSummary.json" } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" } } } @@ -2920,27 +2939,6 @@ } ] }, - "ApiVersionResourceListResult": { - "type": "object", - "description": "The response of a ApiVersionResource list operation.", - "properties": { - "value": { - "type": "array", - "description": "The ApiVersionResource items on this page", - "items": { - "$ref": "#/definitions/ApiVersionResource" - } - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" - } - }, - "required": [ - "value" - ] - }, "AwsAccessKeyCredentialProperties": { "type": "object", "description": "AWS credential properties for Access Key", @@ -3016,27 +3014,6 @@ } ] }, - "AwsCredentialResourceListResult": { - "type": "object", - "description": "The response of a AwsCredentialResource list operation.", - "properties": { - "value": { - "type": "array", - "description": "The AwsCredentialResource items on this page", - "items": { - "$ref": "#/definitions/AwsCredentialResource" - } - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" - } - }, - "required": [ - "value" - ] - }, "AwsCredentialResourceTagsUpdate": { "type": "object", "description": "The type used for updating tags in AwsCredentialResource resources.", @@ -3208,27 +3185,6 @@ } ] }, - "AzureCredentialResourceListResult": { - "type": "object", - "description": "The response of a AzureCredentialResource list operation.", - "properties": { - "value": { - "type": "array", - "description": "The AzureCredentialResource items on this page", - "items": { - "$ref": "#/definitions/AzureCredentialResource" - } - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" - } - }, - "required": [ - "value" - ] - }, "AzureCredentialResourceTagsUpdate": { "type": "object", "description": "The type used for updating tags in AzureCredentialResource resources.", @@ -3441,27 +3397,6 @@ } ] }, - "GenericPlaneResourceListResult": { - "type": "object", - "description": "The response of a GenericPlaneResource list operation.", - "properties": { - "value": { - "type": "array", - "description": "The GenericPlaneResource items on this page", - "items": { - "$ref": "#/definitions/GenericPlaneResource" - } - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" - } - }, - "required": [ - "value" - ] - }, "GenericPlaneResourceProperties": { "type": "object", "description": "The properties of the generic representation of a plane resource.", @@ -3504,27 +3439,6 @@ } ] }, - "GenericResourceListResult": { - "type": "object", - "description": "The response of a GenericResource list operation.", - "properties": { - "value": { - "type": "array", - "description": "The GenericResource items on this page", - "items": { - "$ref": "#/definitions/GenericResource" - } - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" - } - }, - "required": [ - "value" - ] - }, "InternalCredentialStorageProperties": { "type": "object", "description": "Internal credential storage properties", @@ -3588,27 +3502,6 @@ } ] }, - "LocationResourceListResult": { - "type": "object", - "description": "The response of a LocationResource list operation.", - "properties": { - "value": { - "type": "array", - "description": "The LocationResource items on this page", - "items": { - "$ref": "#/definitions/LocationResource" - } - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" - } - }, - "required": [ - "value" - ] - }, "LocationResourceType": { "type": "object", "description": "The configuration for a resource type in a specific location.", @@ -3828,15 +3721,28 @@ } ] }, - "ResourceGroupResourceListResult": { + "ResourceGroupResourceTagsUpdate": { + "type": "object", + "description": "The type used for updating tags in ResourceGroupResource resources.", + "properties": { + "tags": { + "type": "object", + "description": "Resource tags.", + "additionalProperties": { + "type": "string" + } + } + } + }, + "ResourceListResult": { "type": "object", - "description": "The response of a ResourceGroupResource list operation.", + "description": "The response of a Resource list operation.", "properties": { "value": { "type": "array", - "description": "The ResourceGroupResource items on this page", + "description": "The Resource items on this page", "items": { - "$ref": "#/definitions/ResourceGroupResource" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" } }, "nextLink": { @@ -3849,19 +3755,6 @@ "value" ] }, - "ResourceGroupResourceTagsUpdate": { - "type": "object", - "description": "The type used for updating tags in ResourceGroupResource resources.", - "properties": { - "tags": { - "type": "object", - "description": "Resource tags.", - "additionalProperties": { - "type": "string" - } - } - } - }, "ResourceNameString": { "type": "string", "description": "The resource name", @@ -3904,27 +3797,6 @@ } ] }, - "ResourceProviderResourceListResult": { - "type": "object", - "description": "The response of a ResourceProviderResource list operation.", - "properties": { - "value": { - "type": "array", - "description": "The ResourceProviderResource items on this page", - "items": { - "$ref": "#/definitions/ResourceProviderResource" - } - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" - } - }, - "required": [ - "value" - ] - }, "ResourceProviderSummary": { "type": "object", "description": "The summary of a resource provider configuration. This type is optimized for querying resource providers and supported types.", @@ -4014,27 +3886,6 @@ } ] }, - "ResourceTypeResourceListResult": { - "type": "object", - "description": "The response of a ResourceTypeResource list operation.", - "properties": { - "value": { - "type": "array", - "description": "The ResourceTypeResource items on this page", - "items": { - "$ref": "#/definitions/ResourceTypeResource" - } - }, - "nextLink": { - "type": "string", - "format": "uri", - "description": "The link to the next page of items" - } - }, - "required": [ - "value" - ] - }, "ResourceTypeSummaryResultApiVersion": { "type": "object", "description": "The configuration of a resource type API version." diff --git a/typespec/UCP/aws-credentials.tsp b/typespec/UCP/aws-credentials.tsp index deea84d5b7..619070ca37 100644 --- a/typespec/UCP/aws-credentials.tsp +++ b/typespec/UCP/aws-credentials.tsp @@ -116,33 +116,37 @@ alias AwsCredentialBaseParameter = CredentialBaseParameters< @armResourceOperations interface AwsCredentials { @doc("List AWS credentials") + @route("GET /planes/aws") list is UcpResourceList< AwsCredentialResource, { ...ApiVersionParameter; - ...AwsPlaneNameParameter; } >; @doc("Get an AWS credential") + @route("GET /planes/aws/{planeName}") get is UcpResourceRead< AwsCredentialResource, AwsCredentialBaseParameter >; @doc("Create or update an AWS credential") + @route("PUT /planes/aws/{planeName}") createOrUpdate is UcpResourceCreateOrUpdateSync< AwsCredentialResource, AwsCredentialBaseParameter >; @doc("Update an AWS credential") + @route("PATCH /planes/aws/{planeName}") update is UcpCustomPatchSync< AwsCredentialResource, AwsCredentialBaseParameter >; @doc("Delete an AWS credential") + @route("DELETE /planes/aws/{planeName}") delete is UcpResourceDeleteSync< AwsCredentialResource, AwsCredentialBaseParameter diff --git a/typespec/UCP/azure-credentials.tsp b/typespec/UCP/azure-credentials.tsp index 6c6c2736e8..d6e9c49dfc 100644 --- a/typespec/UCP/azure-credentials.tsp +++ b/typespec/UCP/azure-credentials.tsp @@ -123,6 +123,7 @@ alias AzureCredentialBaseParameter = CredentialBaseParameters< @armResourceOperations interface AzureCredentials { @doc("List Azure credentials") + @route("GET /planes/azure") list is UcpResourceList< AzureCredentialResource, { @@ -132,6 +133,7 @@ interface AzureCredentials { >; @doc("Get an Azure credential") + @route("GET /planes/azure/{planeName}") get is UcpResourceRead< AzureCredentialResource, AzureCredentialBaseParameter diff --git a/typespec/UCP/resourcegroups.tsp b/typespec/UCP/resourcegroups.tsp index 24df42b21d..85c140c966 100644 --- a/typespec/UCP/resourcegroups.tsp +++ b/typespec/UCP/resourcegroups.tsp @@ -73,34 +73,38 @@ model ResourceGroupBaseParameters { ...KeysOf; } -@route("/planes") @armResourceOperations interface ResourceGroups { @doc("List resource groups") + @route("GET /planes/radius/{planeName}/resourcegroups") list is UcpResourceList< ResourceGroupResource, PlaneBaseParameters >; @doc("Get a resource group") + @route("GET /planes/radius/{planeName}/resourcegroups/{resourceGroupName}") get is UcpResourceRead< ResourceGroupResource, ResourceGroupBaseParameters >; @doc("Create or update a resource group") + @route("PUT /planes/radius/{planeName}/resourcegroups/{resourceGroupName}") createOrUpdate is UcpResourceCreateOrUpdateSync< ResourceGroupResource, ResourceGroupBaseParameters >; @doc("Update a resource group") + @route("PATCH /planes/radius/{planeName}/resourcegroups/{resourceGroupName}") update is UcpCustomPatchSync< ResourceGroupResource, ResourceGroupBaseParameters >; @doc("Delete a resource group") + @route("DELETE /planes/radius/{planeName}/resourcegroups/{resourceGroupName}") delete is UcpResourceDeleteSync< ResourceGroupResource, ResourceGroupBaseParameters diff --git a/typespec/UCP/resourceproviders.tsp b/typespec/UCP/resourceproviders.tsp index 7c03c6b8aa..4c18304b29 100644 --- a/typespec/UCP/resourceproviders.tsp +++ b/typespec/UCP/resourceproviders.tsp @@ -198,28 +198,31 @@ model LocationBaseParameters { ...KeysOf; } -@route("/planes") @armResourceOperations interface ResourceProviders { @doc("List resource providers.") + @route("GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders") list is UcpResourceList< ResourceProviderResource, PlaneBaseParameters >; @doc("Get the specified resource provider.") + @route("GET /planes/{resourceProviderName}") get is UcpResourceRead< ResourceProviderResource, ResourceProviderBaseParameters >; @doc("Create or update a resource provider") + @route("PUT /planes/{resourceProviderName}") createOrUpdate is UcpResourceCreateOrUpdateAsync< ResourceProviderResource, ResourceProviderBaseParameters >; @doc("Delete a resource provider") + @route("DELETE /planes/{resourceProviderName}") delete is UcpResourceDeleteAsync< ResourceProviderResource, ResourceProviderBaseParameters @@ -242,28 +245,31 @@ interface ResourceProviders { ): ArmResponse | ErrorResponse; } -@route("/planes") @armResourceOperations interface ResourceTypes { @doc("List resource types.") + @route("GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes") list is UcpResourceList< ResourceTypeResource, ResourceProviderBaseParameters >; @doc("Get the specified resource type.") + @route("GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}") get is UcpResourceRead< ResourceTypeResource, ResourceTypeBaseParameters >; @doc("Create or update a resource type") + @route("PUT /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}") createOrUpdate is UcpResourceCreateOrUpdateAsync< ResourceTypeResource, ResourceTypeBaseParameters >; @doc("Delete a resource type") + @route("DELETE /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}") delete is UcpResourceDeleteAsync< ResourceTypeResource, ResourceTypeBaseParameters From e5f02dce98ffce6c7dbc7b530b834fb3041523f8 Mon Sep 17 00:00:00 2001 From: lakshmimsft Date: Thu, 7 Nov 2024 08:02:10 -0800 Subject: [PATCH 3/9] build/make generate successful Signed-off-by: lakshmimsft --- .../zz_generated_apiversions_client.go | 2 +- .../zz_generated_awscredentials_client.go | 12 +- .../zz_generated_azurecredentials_client.go | 2 +- .../zz_generated_locations_client.go | 2 +- .../v20231001preview/zz_generated_models.go | 90 ++- .../zz_generated_models_serde.go | 284 +++++++- .../zz_generated_planes_client.go | 2 +- .../zz_generated_resourcegroups_client.go | 2 +- .../zz_generated_resourceproviders_client.go | 2 +- .../zz_generated_resources_client.go | 2 +- .../zz_generated_resourcetypes_client.go | 8 +- .../zz_generated_response_types.go | 36 +- .../preview/2023-10-01-preview/openapi.json | 633 +++++++++++------- typespec/UCP/aws-credentials.tsp | 1 + typespec/UCP/resourceproviders.tsp | 6 +- typespec/UCP/ucp-operations.tsp | 11 +- 16 files changed, 796 insertions(+), 299 deletions(-) diff --git a/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go b/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go index 0e11e28293..d5e1ca6866 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go @@ -324,7 +324,7 @@ func (client *APIVersionsClient) listCreateRequest(ctx context.Context, planeNam // listHandleResponse handles the List response. func (client *APIVersionsClient) listHandleResponse(resp *http.Response) (APIVersionsClientListResponse, error) { result := APIVersionsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.APIVersionResourceListResult); err != nil { return APIVersionsClientListResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go b/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go index cfd8a20d87..e529cfb714 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go @@ -196,8 +196,9 @@ func (client *AwsCredentialsClient) getHandleResponse(resp *http.Response) (AwsC // NewListPager - List AWS credentials // // Generated from API version 2023-10-01-preview +// - planeName - The name of AWS plane // - options - AwsCredentialsClientListOptions contains the optional parameters for the AwsCredentialsClient.NewListPager method. -func (client *AwsCredentialsClient) NewListPager(options *AwsCredentialsClientListOptions) (*runtime.Pager[AwsCredentialsClientListResponse]) { +func (client *AwsCredentialsClient) NewListPager(planeName string, options *AwsCredentialsClientListOptions) (*runtime.Pager[AwsCredentialsClientListResponse]) { return runtime.NewPager(runtime.PagingHandler[AwsCredentialsClientListResponse]{ More: func(page AwsCredentialsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -206,7 +207,7 @@ func (client *AwsCredentialsClient) NewListPager(options *AwsCredentialsClientLi var req *policy.Request var err error if page == nil { - req, err = client.listCreateRequest(ctx, options) + req, err = client.listCreateRequest(ctx, planeName, options) } else { req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) } @@ -226,8 +227,9 @@ func (client *AwsCredentialsClient) NewListPager(options *AwsCredentialsClientLi } // listCreateRequest creates the List request. -func (client *AwsCredentialsClient) listCreateRequest(ctx context.Context, options *AwsCredentialsClientListOptions) (*policy.Request, error) { - urlPath := "/GET /planes/aws" +func (client *AwsCredentialsClient) listCreateRequest(ctx context.Context, planeName string, options *AwsCredentialsClientListOptions) (*policy.Request, error) { + urlPath := "/GET /planes/aws/planes/aws/{planeName}" + urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -242,7 +244,7 @@ func (client *AwsCredentialsClient) listCreateRequest(ctx context.Context, optio // listHandleResponse handles the List response. func (client *AwsCredentialsClient) listHandleResponse(resp *http.Response) (AwsCredentialsClientListResponse, error) { result := AwsCredentialsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.AwsCredentialResourceListResult); err != nil { return AwsCredentialsClientListResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go b/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go index eb2d0973ad..4eefcd4372 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go @@ -245,7 +245,7 @@ func (client *AzureCredentialsClient) listCreateRequest(ctx context.Context, pla // listHandleResponse handles the List response. func (client *AzureCredentialsClient) listHandleResponse(resp *http.Response) (AzureCredentialsClientListResponse, error) { result := AzureCredentialsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.AzureCredentialResourceListResult); err != nil { return AzureCredentialsClientListResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go b/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go index 45dac4abfb..d89fd880a7 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go @@ -306,7 +306,7 @@ func (client *LocationsClient) listCreateRequest(ctx context.Context, planeName // listHandleResponse handles the List response. func (client *LocationsClient) listHandleResponse(resp *http.Response) (LocationsClientListResponse, error) { result := LocationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.LocationResourceListResult); err != nil { return LocationsClientListResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_models.go b/pkg/ucp/api/v20231001preview/zz_generated_models.go index 431e90a292..0edd7cf8b4 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_models.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_models.go @@ -34,6 +34,15 @@ type APIVersionResource struct { Type *string } +// APIVersionResourceListResult - The response of a ApiVersionResource list operation. +type APIVersionResourceListResult struct { + // REQUIRED; The ApiVersionResource items on this page + Value []*APIVersionResource + + // The link to the next page of items + NextLink *string +} + // AwsAccessKeyCredentialProperties - AWS credential properties for Access Key type AwsAccessKeyCredentialProperties struct { // REQUIRED; Access key ID for AWS identity @@ -97,6 +106,15 @@ type AwsCredentialResource struct { Type *string } +// AwsCredentialResourceListResult - The response of a AwsCredentialResource list operation. +type AwsCredentialResourceListResult struct { + // REQUIRED; The AwsCredentialResource items on this page + Value []*AwsCredentialResource + + // The link to the next page of items + NextLink *string +} + // AwsCredentialResourceTagsUpdate - The type used for updating tags in AwsCredentialResource resources. type AwsCredentialResourceTagsUpdate struct { // Resource tags. @@ -207,6 +225,15 @@ type AzureCredentialResource struct { Type *string } +// AzureCredentialResourceListResult - The response of a AzureCredentialResource list operation. +type AzureCredentialResourceListResult struct { + // REQUIRED; The AzureCredentialResource items on this page + Value []*AzureCredentialResource + + // The link to the next page of items + NextLink *string +} + // AzureCredentialResourceTagsUpdate - The type used for updating tags in AzureCredentialResource resources. type AzureCredentialResourceTagsUpdate struct { // Resource tags. @@ -402,6 +429,15 @@ type GenericPlaneResource struct { Type *string } +// GenericPlaneResourceListResult - The response of a GenericPlaneResource list operation. +type GenericPlaneResourceListResult struct { + // REQUIRED; The GenericPlaneResource items on this page + Value []*GenericPlaneResource + + // The link to the next page of items + NextLink *string +} + // GenericPlaneResourceProperties - The properties of the generic representation of a plane resource. type GenericPlaneResourceProperties struct { // READ-ONLY; The status of the asynchronous operation. @@ -426,6 +462,15 @@ type GenericResource struct { Type *string } +// GenericResourceListResult - The response of a GenericResource list operation. +type GenericResourceListResult struct { + // REQUIRED; The GenericResource items on this page + Value []*GenericResource + + // The link to the next page of items + NextLink *string +} + // InternalCredentialStorageProperties - Internal credential storage properties type InternalCredentialStorageProperties struct { // REQUIRED; The kind of credential storage @@ -473,6 +518,15 @@ type LocationResource struct { Type *string } +// LocationResourceListResult - The response of a LocationResource list operation. +type LocationResourceListResult struct { + // REQUIRED; The LocationResource items on this page + Value []*LocationResource + + // The link to the next page of items + NextLink *string +} + // LocationResourceType - The configuration for a resource type in a specific location. type LocationResourceType struct { // The configuration for API versions of a resource type supported by the location. @@ -603,21 +657,21 @@ type ResourceGroupResource struct { Type *string } +// ResourceGroupResourceListResult - The response of a ResourceGroupResource list operation. +type ResourceGroupResourceListResult struct { + // REQUIRED; The ResourceGroupResource items on this page + Value []*ResourceGroupResource + + // The link to the next page of items + NextLink *string +} + // ResourceGroupResourceTagsUpdate - The type used for updating tags in ResourceGroupResource resources. type ResourceGroupResourceTagsUpdate struct { // Resource tags. Tags map[string]*string } -// ResourceListResult - The response of a Resource list operation. -type ResourceListResult struct { - // REQUIRED; The Resource items on this page - Value []*Resource - - // The link to the next page of items - NextLink *string -} - // ResourceProviderProperties - The properties of a resource provider. type ResourceProviderProperties struct { // READ-ONLY; The status of the asynchronous operation. @@ -648,6 +702,15 @@ type ResourceProviderResource struct { Type *string } +// ResourceProviderResourceListResult - The response of a ResourceProviderResource list operation. +type ResourceProviderResourceListResult struct { + // REQUIRED; The ResourceProviderResource items on this page + Value []*ResourceProviderResource + + // The link to the next page of items + NextLink *string +} + // ResourceProviderSummary - The summary of a resource provider configuration. This type is optimized for querying resource // providers and supported types. type ResourceProviderSummary struct { @@ -697,6 +760,15 @@ type ResourceTypeResource struct { Type *string } +// ResourceTypeResourceListResult - The response of a ResourceTypeResource list operation. +type ResourceTypeResourceListResult struct { + // REQUIRED; The ResourceTypeResource items on this page + Value []*ResourceTypeResource + + // The link to the next page of items + NextLink *string +} + // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). diff --git a/pkg/ucp/api/v20231001preview/zz_generated_models_serde.go b/pkg/ucp/api/v20231001preview/zz_generated_models_serde.go index d8188fbbcb..f62e590dfd 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_models_serde.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_models_serde.go @@ -84,6 +84,37 @@ func (a *APIVersionResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type APIVersionResourceListResult. +func (a APIVersionResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIVersionResourceListResult. +func (a *APIVersionResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AwsAccessKeyCredentialProperties. func (a AwsAccessKeyCredentialProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -209,6 +240,37 @@ func (a *AwsCredentialResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AwsCredentialResourceListResult. +func (a AwsCredentialResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCredentialResourceListResult. +func (a *AwsCredentialResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AwsCredentialResourceTagsUpdate. func (a AwsCredentialResourceTagsUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -493,6 +555,37 @@ func (a *AzureCredentialResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AzureCredentialResourceListResult. +func (a AzureCredentialResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureCredentialResourceListResult. +func (a *AzureCredentialResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AzureCredentialResourceTagsUpdate. func (a AzureCredentialResourceTagsUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -972,6 +1065,37 @@ func (g *GenericPlaneResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type GenericPlaneResourceListResult. +func (g GenericPlaneResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenericPlaneResourceListResult. +func (g *GenericPlaneResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type GenericPlaneResourceProperties. func (g GenericPlaneResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1042,6 +1166,37 @@ func (g *GenericResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type GenericResourceListResult. +func (g GenericResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GenericResourceListResult. +func (g *GenericResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type InternalCredentialStorageProperties. func (i InternalCredentialStorageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1151,6 +1306,37 @@ func (l *LocationResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type LocationResourceListResult. +func (l LocationResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocationResourceListResult. +func (l *LocationResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &l.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &l.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type LocationResourceType. func (l LocationResourceType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1532,15 +1718,16 @@ func (r *ResourceGroupResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceGroupResourceTagsUpdate. -func (r ResourceGroupResourceTagsUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceGroupResourceListResult. +func (r ResourceGroupResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "tags", r.Tags) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroupResourceTagsUpdate. -func (r *ResourceGroupResourceTagsUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroupResourceListResult. +func (r *ResourceGroupResourceListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -1548,8 +1735,11 @@ func (r *ResourceGroupResourceTagsUpdate) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "tags": - err = unpopulate(val, "Tags", &r.Tags) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -1559,16 +1749,15 @@ func (r *ResourceGroupResourceTagsUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceListResult. -func (r ResourceListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceGroupResourceTagsUpdate. +func (r ResourceGroupResourceTagsUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "tags", r.Tags) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceListResult. -func (r *ResourceListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceGroupResourceTagsUpdate. +func (r *ResourceGroupResourceTagsUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -1576,11 +1765,8 @@ func (r *ResourceListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "tags": + err = unpopulate(val, "Tags", &r.Tags) delete(rawMsg, key) } if err != nil { @@ -1668,6 +1854,37 @@ func (r *ResourceProviderResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ResourceProviderResourceListResult. +func (r ResourceProviderResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProviderResourceListResult. +func (r *ResourceProviderResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ResourceProviderSummary. func (r ResourceProviderSummary) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1808,6 +2025,37 @@ func (r *ResourceTypeResource) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ResourceTypeResourceListResult. +func (r ResourceTypeResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceTypeResourceListResult. +func (r *ResourceTypeResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go b/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go index 6d21643391..db46cbbded 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go @@ -84,7 +84,7 @@ func (client *PlanesClient) listPlanesCreateRequest(ctx context.Context, options // listPlanesHandleResponse handles the ListPlanes response. func (client *PlanesClient) listPlanesHandleResponse(resp *http.Response) (PlanesClientListPlanesResponse, error) { result := PlanesClientListPlanesResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.GenericPlaneResourceListResult); err != nil { return PlanesClientListPlanesResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go index 484fc23d38..60443c47af 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go @@ -256,7 +256,7 @@ func (client *ResourceGroupsClient) listCreateRequest(ctx context.Context, plane // listHandleResponse handles the List response. func (client *ResourceGroupsClient) listHandleResponse(resp *http.Response) (ResourceGroupsClientListResponse, error) { result := ResourceGroupsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGroupResourceListResult); err != nil { return ResourceGroupsClientListResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go index c2de34cfe5..919c27dfe2 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go @@ -344,7 +344,7 @@ func (client *ResourceProvidersClient) listCreateRequest(ctx context.Context, pl // listHandleResponse handles the List response. func (client *ResourceProvidersClient) listHandleResponse(resp *http.Response) (ResourceProvidersClientListResponse, error) { result := ResourceProvidersClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceProviderResourceListResult); err != nil { return ResourceProvidersClientListResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go index 9a9d767e8a..3dcd6e66e6 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go @@ -98,7 +98,7 @@ func (client *ResourcesClient) listCreateRequest(ctx context.Context, planeName // listHandleResponse handles the List response. func (client *ResourcesClient) listHandleResponse(resp *http.Response) (ResourcesClientListResponse, error) { result := ResourcesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.GenericResourceListResult); err != nil { return ResourcesClientListResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go index 615dddbe96..f05ffc235a 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go @@ -87,7 +87,7 @@ func (client *ResourceTypesClient) createOrUpdate(ctx context.Context, planeName // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *ResourceTypesClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, resource ResourceTypeResource, options *ResourceTypesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/PUT /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" + urlPath := "/PUT /planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -161,7 +161,7 @@ func (client *ResourceTypesClient) deleteOperation(ctx context.Context, planeNam // deleteCreateRequest creates the Delete request. func (client *ResourceTypesClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *ResourceTypesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/DELETE /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" + urlPath := "/DELETE /planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -213,7 +213,7 @@ func (client *ResourceTypesClient) Get(ctx context.Context, planeName string, re // getCreateRequest creates the Get request. func (client *ResourceTypesClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *ResourceTypesClientGetOptions) (*policy.Request, error) { - urlPath := "/GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" + urlPath := "/GET /planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -305,7 +305,7 @@ func (client *ResourceTypesClient) listCreateRequest(ctx context.Context, planeN // listHandleResponse handles the List response. func (client *ResourceTypesClient) listHandleResponse(resp *http.Response) (ResourceTypesClientListResponse, error) { result := ResourceTypesClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ResourceTypeResourceListResult); err != nil { return ResourceTypesClientListResponse{}, err } return result, nil diff --git a/pkg/ucp/api/v20231001preview/zz_generated_response_types.go b/pkg/ucp/api/v20231001preview/zz_generated_response_types.go index 13b65e65a0..c5e912f122 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_response_types.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_response_types.go @@ -26,8 +26,8 @@ type APIVersionsClientGetResponse struct { // APIVersionsClientListResponse contains the response from method APIVersionsClient.NewListPager. type APIVersionsClientListResponse struct { - // The response of a Resource list operation. - ResourceListResult + // The response of a ApiVersionResource list operation. + APIVersionResourceListResult } // AwsCredentialsClientCreateOrUpdateResponse contains the response from method AwsCredentialsClient.CreateOrUpdate. @@ -49,8 +49,8 @@ type AwsCredentialsClientGetResponse struct { // AwsCredentialsClientListResponse contains the response from method AwsCredentialsClient.NewListPager. type AwsCredentialsClientListResponse struct { - // The response of a Resource list operation. - ResourceListResult + // The response of a AwsCredentialResource list operation. + AwsCredentialResourceListResult } // AwsCredentialsClientUpdateResponse contains the response from method AwsCredentialsClient.Update. @@ -107,8 +107,8 @@ type AzureCredentialsClientGetResponse struct { // AzureCredentialsClientListResponse contains the response from method AzureCredentialsClient.NewListPager. type AzureCredentialsClientListResponse struct { - // The response of a Resource list operation. - ResourceListResult + // The response of a AzureCredentialResource list operation. + AzureCredentialResourceListResult } // AzureCredentialsClientUpdateResponse contains the response from method AzureCredentialsClient.Update. @@ -167,14 +167,14 @@ type LocationsClientGetResponse struct { // LocationsClientListResponse contains the response from method LocationsClient.NewListPager. type LocationsClientListResponse struct { - // The response of a Resource list operation. - ResourceListResult + // The response of a LocationResource list operation. + LocationResourceListResult } // PlanesClientListPlanesResponse contains the response from method PlanesClient.NewListPlanesPager. type PlanesClientListPlanesResponse struct { - // The response of a Resource list operation. - ResourceListResult + // The response of a GenericPlaneResource list operation. + GenericPlaneResourceListResult } // RadiusPlanesClientCreateOrUpdateResponse contains the response from method RadiusPlanesClient.BeginCreateOrUpdate. @@ -225,8 +225,8 @@ type ResourceGroupsClientGetResponse struct { // ResourceGroupsClientListResponse contains the response from method ResourceGroupsClient.NewListPager. type ResourceGroupsClientListResponse struct { - // The response of a Resource list operation. - ResourceListResult + // The response of a ResourceGroupResource list operation. + ResourceGroupResourceListResult } // ResourceGroupsClientUpdateResponse contains the response from method ResourceGroupsClient.Update. @@ -267,8 +267,8 @@ type ResourceProvidersClientListProviderSummariesResponse struct { // ResourceProvidersClientListResponse contains the response from method ResourceProvidersClient.NewListPager. type ResourceProvidersClientListResponse struct { - // The response of a Resource list operation. - ResourceListResult + // The response of a ResourceProviderResource list operation. + ResourceProviderResourceListResult } // ResourceTypesClientCreateOrUpdateResponse contains the response from method ResourceTypesClient.BeginCreateOrUpdate. @@ -290,13 +290,13 @@ type ResourceTypesClientGetResponse struct { // ResourceTypesClientListResponse contains the response from method ResourceTypesClient.NewListPager. type ResourceTypesClientListResponse struct { - // The response of a Resource list operation. - ResourceListResult + // The response of a ResourceTypeResource list operation. + ResourceTypeResourceListResult } // ResourcesClientListResponse contains the response from method ResourcesClient.NewListPager. type ResourcesClientListResponse struct { - // The response of a Resource list operation. - ResourceListResult + // The response of a GenericResource list operation. + GenericResourceListResult } diff --git a/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json b/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json index c853245ffe..b3087064b3 100644 --- a/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json +++ b/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json @@ -93,7 +93,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceListResult" + "$ref": "#/definitions/GenericPlaneResourceListResult" } }, "default": { @@ -182,55 +182,7 @@ "x-ms-long-running-operation": true } }, - "/DELETE /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { - "delete": { - "operationId": "AwsCredentials_Delete", - "tags": [ - "AwsCredentials" - ], - "description": "Delete an AWS credential", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/AwsPlaneNameParameter" - }, - { - "name": "credentialName", - "in": "path", - "description": "The AWS credential name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - } - ], - "responses": { - "200": { - "description": "Resource deleted successfully." - }, - "204": { - "description": "Resource does not exist." - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Delete an AWS AccessKey credential": { - "$ref": "./examples/AWSCredential_AccessKey_Delete.json" - }, - "Delete an AWS IRSA credential": { - "$ref": "./examples/AWSCredential_IRSA_Delete.json" - } - } - } - }, - "/DELETE /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { + "/DELETE /planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { "delete": { "operationId": "ResourceTypes_Delete", "tags": [ @@ -308,6 +260,54 @@ "x-ms-long-running-operation": true } }, + "/DELETE /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { + "delete": { + "operationId": "AwsCredentials_Delete", + "tags": [ + "AwsCredentials" + ], + "description": "Delete an AWS credential", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/AwsPlaneNameParameter" + }, + { + "name": "credentialName", + "in": "path", + "description": "The AWS credential name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + } + ], + "responses": { + "200": { + "description": "Resource deleted successfully." + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Delete an AWS AccessKey credential": { + "$ref": "./examples/AWSCredential_AccessKey_Delete.json" + }, + "Delete an AWS IRSA credential": { + "$ref": "./examples/AWSCredential_IRSA_Delete.json" + } + } + } + }, "/DELETE /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}": { "delete": { "operationId": "ResourceGroups_Delete", @@ -410,23 +410,50 @@ } } }, - "/GET /planes/aws": { + "/GET /planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { "get": { - "operationId": "AwsCredentials_List", + "operationId": "ResourceTypes_Get", "tags": [ - "AwsCredentials" + "ResourceTypes" ], - "description": "List AWS credentials", + "description": "Get the specified resource type.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, + { + "name": "resourceTypeName", + "in": "path", + "description": "The resource type name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceListResult" + "$ref": "#/definitions/ResourceTypeResource" } }, "default": { @@ -437,15 +464,9 @@ } }, "x-ms-examples": { - "List AWS AccessKey credential": { - "$ref": "./examples/AWSCredential_AccessKey_List.json" - }, - "List AWS IRSA credentials": { - "$ref": "./examples/AWSCredential_IRSA_List.json" + "Gets a resource type defined by a resource provider.": { + "$ref": "./examples/ResourceTypes_Get.json" } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" } } }, @@ -497,6 +518,48 @@ } } }, + "/GET /planes/aws/planes/aws/{planeName}": { + "get": { + "operationId": "AwsCredentials_List", + "tags": [ + "AwsCredentials" + ], + "description": "List AWS credentials", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/AwsPlaneNameParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/AwsCredentialResourceListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List AWS AccessKey credential": { + "$ref": "./examples/AWSCredential_AccessKey_List.json" + }, + "List AWS IRSA credentials": { + "$ref": "./examples/AWSCredential_IRSA_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, "/GET /planes/azure/{planeName}/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}": { "get": { "operationId": "AzureCredentials_Get", @@ -564,7 +627,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceListResult" + "$ref": "#/definitions/AzureCredentialResourceListResult" } }, "default": { @@ -587,66 +650,6 @@ } } }, - "/GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { - "get": { - "operationId": "ResourceTypes_Get", - "tags": [ - "ResourceTypes" - ], - "description": "Get the specified resource type.", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - }, - { - "name": "resourceTypeName", - "in": "path", - "description": "The resource type name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/ResourceTypeResource" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Gets a resource type defined by a resource provider.": { - "$ref": "./examples/ResourceTypes_Get.json" - } - } - } - }, "/GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { "get": { "operationId": "ResourceTypes_List", @@ -681,7 +684,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceListResult" + "$ref": "#/definitions/ResourceTypeResourceListResult" } }, "default": { @@ -726,7 +729,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceListResult" + "$ref": "#/definitions/ResourceProviderResourceListResult" } }, "default": { @@ -822,7 +825,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceListResult" + "$ref": "#/definitions/ResourceGroupResourceListResult" } }, "default": { @@ -986,78 +989,7 @@ "required": true, "type": "string", "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - }, - { - "name": "resource", - "in": "body", - "description": "Resource create parameters.", - "required": true, - "schema": { - "$ref": "#/definitions/ResourceProviderResource" - } - } - ], - "responses": { - "200": { - "description": "Resource 'ResourceProviderResource' update operation succeeded", - "schema": { - "$ref": "#/definitions/ResourceProviderResource" - } - }, - "201": { - "description": "Resource 'ResourceProviderResource' create operation succeeded", - "schema": { - "$ref": "#/definitions/ResourceProviderResource" - }, - "headers": { - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Create or update a resource provider": { - "$ref": "./examples/ResourceProviders_CreateOrUpdate.json" - } - }, - "x-ms-long-running-operation-options": { - "final-state-via": "azure-async-operation" - }, - "x-ms-long-running-operation": true - } - }, - "/PUT /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { - "put": { - "operationId": "AwsCredentials_CreateOrUpdate", - "tags": [ - "AwsCredentials" - ], - "description": "Create or update an AWS credential", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/AwsPlaneNameParameter" - }, - { - "name": "credentialName", - "in": "path", - "description": "The AWS credential name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" }, { "name": "resource", @@ -1065,21 +997,28 @@ "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/AwsCredentialResource" + "$ref": "#/definitions/ResourceProviderResource" } } ], "responses": { "200": { - "description": "Resource 'AwsCredentialResource' update operation succeeded", + "description": "Resource 'ResourceProviderResource' update operation succeeded", "schema": { - "$ref": "#/definitions/AwsCredentialResource" + "$ref": "#/definitions/ResourceProviderResource" } }, "201": { - "description": "Resource 'AwsCredentialResource' create operation succeeded", + "description": "Resource 'ResourceProviderResource' create operation succeeded", "schema": { - "$ref": "#/definitions/AwsCredentialResource" + "$ref": "#/definitions/ResourceProviderResource" + }, + "headers": { + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } } }, "default": { @@ -1090,16 +1029,17 @@ } }, "x-ms-examples": { - "Create or update an AWS AccessKey credential": { - "$ref": "./examples/AWSCredential_AccessKey_CreateOrUpdate.json" - }, - "Create or update an AWS IRSA credential": { - "$ref": "./examples/AWSCredential_IRSA_CreateOrUpdate.json" + "Create or update a resource provider": { + "$ref": "./examples/ResourceProviders_CreateOrUpdate.json" } - } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "azure-async-operation" + }, + "x-ms-long-running-operation": true } }, - "/PUT /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { + "/PUT /planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { "put": { "operationId": "ResourceTypes_CreateOrUpdate", "tags": [ @@ -1185,6 +1125,69 @@ "x-ms-long-running-operation": true } }, + "/PUT /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { + "put": { + "operationId": "AwsCredentials_CreateOrUpdate", + "tags": [ + "AwsCredentials" + ], + "description": "Create or update an AWS credential", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/AwsPlaneNameParameter" + }, + { + "name": "credentialName", + "in": "path", + "description": "The AWS credential name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/AwsCredentialResource" + } + } + ], + "responses": { + "200": { + "description": "Resource 'AwsCredentialResource' update operation succeeded", + "schema": { + "$ref": "#/definitions/AwsCredentialResource" + } + }, + "201": { + "description": "Resource 'AwsCredentialResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/AwsCredentialResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Create or update an AWS AccessKey credential": { + "$ref": "./examples/AWSCredential_AccessKey_CreateOrUpdate.json" + }, + "Create or update an AWS IRSA credential": { + "$ref": "./examples/AWSCredential_IRSA_CreateOrUpdate.json" + } + } + } + }, "/PUT /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}": { "put": { "operationId": "ResourceGroups_CreateOrUpdate", @@ -2181,7 +2184,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceListResult" + "$ref": "#/definitions/LocationResourceListResult" } }, "default": { @@ -2464,7 +2467,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceListResult" + "$ref": "#/definitions/ApiVersionResourceListResult" } }, "default": { @@ -2765,7 +2768,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceListResult" + "$ref": "#/definitions/GenericResourceListResult" } }, "default": { @@ -2939,6 +2942,27 @@ } ] }, + "ApiVersionResourceListResult": { + "type": "object", + "description": "The response of a ApiVersionResource list operation.", + "properties": { + "value": { + "type": "array", + "description": "The ApiVersionResource items on this page", + "items": { + "$ref": "#/definitions/ApiVersionResource" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, "AwsAccessKeyCredentialProperties": { "type": "object", "description": "AWS credential properties for Access Key", @@ -3014,6 +3038,27 @@ } ] }, + "AwsCredentialResourceListResult": { + "type": "object", + "description": "The response of a AwsCredentialResource list operation.", + "properties": { + "value": { + "type": "array", + "description": "The AwsCredentialResource items on this page", + "items": { + "$ref": "#/definitions/AwsCredentialResource" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, "AwsCredentialResourceTagsUpdate": { "type": "object", "description": "The type used for updating tags in AwsCredentialResource resources.", @@ -3185,6 +3230,27 @@ } ] }, + "AzureCredentialResourceListResult": { + "type": "object", + "description": "The response of a AzureCredentialResource list operation.", + "properties": { + "value": { + "type": "array", + "description": "The AzureCredentialResource items on this page", + "items": { + "$ref": "#/definitions/AzureCredentialResource" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, "AzureCredentialResourceTagsUpdate": { "type": "object", "description": "The type used for updating tags in AzureCredentialResource resources.", @@ -3397,6 +3463,27 @@ } ] }, + "GenericPlaneResourceListResult": { + "type": "object", + "description": "The response of a GenericPlaneResource list operation.", + "properties": { + "value": { + "type": "array", + "description": "The GenericPlaneResource items on this page", + "items": { + "$ref": "#/definitions/GenericPlaneResource" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, "GenericPlaneResourceProperties": { "type": "object", "description": "The properties of the generic representation of a plane resource.", @@ -3439,6 +3526,27 @@ } ] }, + "GenericResourceListResult": { + "type": "object", + "description": "The response of a GenericResource list operation.", + "properties": { + "value": { + "type": "array", + "description": "The GenericResource items on this page", + "items": { + "$ref": "#/definitions/GenericResource" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, "InternalCredentialStorageProperties": { "type": "object", "description": "Internal credential storage properties", @@ -3502,6 +3610,27 @@ } ] }, + "LocationResourceListResult": { + "type": "object", + "description": "The response of a LocationResource list operation.", + "properties": { + "value": { + "type": "array", + "description": "The LocationResource items on this page", + "items": { + "$ref": "#/definitions/LocationResource" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, "LocationResourceType": { "type": "object", "description": "The configuration for a resource type in a specific location.", @@ -3721,28 +3850,15 @@ } ] }, - "ResourceGroupResourceTagsUpdate": { - "type": "object", - "description": "The type used for updating tags in ResourceGroupResource resources.", - "properties": { - "tags": { - "type": "object", - "description": "Resource tags.", - "additionalProperties": { - "type": "string" - } - } - } - }, - "ResourceListResult": { + "ResourceGroupResourceListResult": { "type": "object", - "description": "The response of a Resource list operation.", + "description": "The response of a ResourceGroupResource list operation.", "properties": { "value": { "type": "array", - "description": "The Resource items on this page", + "description": "The ResourceGroupResource items on this page", "items": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/Resource" + "$ref": "#/definitions/ResourceGroupResource" } }, "nextLink": { @@ -3755,6 +3871,19 @@ "value" ] }, + "ResourceGroupResourceTagsUpdate": { + "type": "object", + "description": "The type used for updating tags in ResourceGroupResource resources.", + "properties": { + "tags": { + "type": "object", + "description": "Resource tags.", + "additionalProperties": { + "type": "string" + } + } + } + }, "ResourceNameString": { "type": "string", "description": "The resource name", @@ -3797,6 +3926,27 @@ } ] }, + "ResourceProviderResourceListResult": { + "type": "object", + "description": "The response of a ResourceProviderResource list operation.", + "properties": { + "value": { + "type": "array", + "description": "The ResourceProviderResource items on this page", + "items": { + "$ref": "#/definitions/ResourceProviderResource" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, "ResourceProviderSummary": { "type": "object", "description": "The summary of a resource provider configuration. This type is optimized for querying resource providers and supported types.", @@ -3886,6 +4036,27 @@ } ] }, + "ResourceTypeResourceListResult": { + "type": "object", + "description": "The response of a ResourceTypeResource list operation.", + "properties": { + "value": { + "type": "array", + "description": "The ResourceTypeResource items on this page", + "items": { + "$ref": "#/definitions/ResourceTypeResource" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, "ResourceTypeSummaryResultApiVersion": { "type": "object", "description": "The configuration of a resource type API version." diff --git a/typespec/UCP/aws-credentials.tsp b/typespec/UCP/aws-credentials.tsp index 619070ca37..e4e198fb78 100644 --- a/typespec/UCP/aws-credentials.tsp +++ b/typespec/UCP/aws-credentials.tsp @@ -121,6 +121,7 @@ interface AwsCredentials { AwsCredentialResource, { ...ApiVersionParameter; + ...AwsPlaneNameParameter; } >; diff --git a/typespec/UCP/resourceproviders.tsp b/typespec/UCP/resourceproviders.tsp index 4c18304b29..26a904ce7b 100644 --- a/typespec/UCP/resourceproviders.tsp +++ b/typespec/UCP/resourceproviders.tsp @@ -255,21 +255,21 @@ interface ResourceTypes { >; @doc("Get the specified resource type.") - @route("GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}") + @route("GET /planes/{resourceTypeName}") get is UcpResourceRead< ResourceTypeResource, ResourceTypeBaseParameters >; @doc("Create or update a resource type") - @route("PUT /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}") + @route("PUT /planes/{resourceTypeName}") createOrUpdate is UcpResourceCreateOrUpdateAsync< ResourceTypeResource, ResourceTypeBaseParameters >; @doc("Delete a resource type") - @route("DELETE /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}") + @route("DELETE /planes/{resourceTypeName}") delete is UcpResourceDeleteAsync< ResourceTypeResource, ResourceTypeBaseParameters diff --git a/typespec/UCP/ucp-operations.tsp b/typespec/UCP/ucp-operations.tsp index b557198ca5..4ad89f1cfd 100644 --- a/typespec/UCP/ucp-operations.tsp +++ b/typespec/UCP/ucp-operations.tsp @@ -36,17 +36,20 @@ using OpenAPI; @doc("List {name}", Azure.ResourceManager.CommonTypes.Resource) @segmentOf(Azure.ResourceManager.CommonTypes.Resource) @armResourceList(Azure.ResourceManager.CommonTypes.Resource) -op UcpResourceList( +op UcpResourceList< + ResourceType extends Azure.ResourceManager.CommonTypes.Resource, + TBaseParameters>( ...TBaseParameters, - ...ParentKeysOf, -): ArmResponse> | ErrorResponse; + ...ParentKeysOf, +): ArmResponse> | ErrorResponse; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute @doc("Get a {name}", Resource) @get @armResourceRead(Resource) -op UcpResourceRead( +op UcpResourceRead< + Resource extends Foundations.Resource, TBaseParameters>( ...TBaseParameters, ): ArmResponse | ErrorResponse; From bfd0cc28b12ff9a06323fc9da422d413d1404650 Mon Sep 17 00:00:00 2001 From: lakshmimsft Date: Thu, 7 Nov 2024 10:26:09 -0800 Subject: [PATCH 4/9] update routes Signed-off-by: lakshmimsft --- .../zz_generated_awscredentials_client.go | 10 +- .../zz_generated_azurecredentials_client.go | 4 +- .../zz_generated_locations_client.go | 2 +- .../zz_generated_resourcegroups_client.go | 10 +- .../zz_generated_resourceproviders_client.go | 12 +- .../zz_generated_resourcetypes_client.go | 8 +- .../preview/2023-10-01-preview/openapi.json | 2012 ++++++++--------- typespec/UCP/aws-credentials.tsp | 10 +- typespec/UCP/azure-credentials.tsp | 4 +- typespec/UCP/resourcegroups.tsp | 10 +- typespec/UCP/resourceproviders.tsp | 19 +- typespec/UCP/ucp-operations.tsp | 3 +- 12 files changed, 1043 insertions(+), 1061 deletions(-) diff --git a/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go b/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go index e529cfb714..b547af4b84 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go @@ -68,7 +68,7 @@ func (client *AwsCredentialsClient) CreateOrUpdate(ctx context.Context, planeNam // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *AwsCredentialsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, credentialName string, resource AwsCredentialResource, options *AwsCredentialsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/PUT /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" + urlPath := "/planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") @@ -123,7 +123,7 @@ func (client *AwsCredentialsClient) Delete(ctx context.Context, planeName string // deleteCreateRequest creates the Delete request. func (client *AwsCredentialsClient) deleteCreateRequest(ctx context.Context, planeName string, credentialName string, options *AwsCredentialsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/DELETE /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" + urlPath := "/planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") @@ -167,7 +167,7 @@ func (client *AwsCredentialsClient) Get(ctx context.Context, planeName string, c // getCreateRequest creates the Get request. func (client *AwsCredentialsClient) getCreateRequest(ctx context.Context, planeName string, credentialName string, options *AwsCredentialsClientGetOptions) (*policy.Request, error) { - urlPath := "/GET /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" + urlPath := "/planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") @@ -228,7 +228,7 @@ func (client *AwsCredentialsClient) NewListPager(planeName string, options *AwsC // listCreateRequest creates the List request. func (client *AwsCredentialsClient) listCreateRequest(ctx context.Context, planeName string, options *AwsCredentialsClientListOptions) (*policy.Request, error) { - urlPath := "/GET /planes/aws/planes/aws/{planeName}" + urlPath := "/planes/aws/planes/aws/{planeName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -278,7 +278,7 @@ func (client *AwsCredentialsClient) Update(ctx context.Context, planeName string // updateCreateRequest creates the Update request. func (client *AwsCredentialsClient) updateCreateRequest(ctx context.Context, planeName string, credentialName string, properties AwsCredentialResourceTagsUpdate, options *AwsCredentialsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/PATCH /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" + urlPath := "/planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") diff --git a/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go b/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go index 4eefcd4372..b86f564204 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go @@ -167,7 +167,7 @@ func (client *AzureCredentialsClient) Get(ctx context.Context, planeName string, // getCreateRequest creates the Get request. func (client *AzureCredentialsClient) getCreateRequest(ctx context.Context, planeName string, credentialName string, options *AzureCredentialsClientGetOptions) (*policy.Request, error) { - urlPath := "/GET /planes/azure/{planeName}/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}" + urlPath := "/planes/azure/{planeName}/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") @@ -229,7 +229,7 @@ func (client *AzureCredentialsClient) NewListPager(planeName string, options *Az // listCreateRequest creates the List request. func (client *AzureCredentialsClient) listCreateRequest(ctx context.Context, planeName string, options *AzureCredentialsClientListOptions) (*policy.Request, error) { - urlPath := "/GET /planes/azure/planes/azure/{planeName}" + urlPath := "/planes/azure/planes/azure/{planeName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go b/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go index d89fd880a7..3320364e64 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go @@ -283,7 +283,7 @@ func (client *LocationsClient) NewListPager(planeName string, resourceProviderNa // listCreateRequest creates the List request. func (client *LocationsClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *LocationsClientListOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" + urlPath := "/planes/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go index 60443c47af..d9b28615bc 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go @@ -68,7 +68,7 @@ func (client *ResourceGroupsClient) CreateOrUpdate(ctx context.Context, planeNam // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *ResourceGroupsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceGroupName string, resource ResourceGroupResource, options *ResourceGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/PUT /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" + urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -126,7 +126,7 @@ func (client *ResourceGroupsClient) Delete(ctx context.Context, planeName string // deleteCreateRequest creates the Delete request. func (client *ResourceGroupsClient) deleteCreateRequest(ctx context.Context, planeName string, resourceGroupName string, options *ResourceGroupsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/DELETE /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" + urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -173,7 +173,7 @@ func (client *ResourceGroupsClient) Get(ctx context.Context, planeName string, r // getCreateRequest creates the Get request. func (client *ResourceGroupsClient) getCreateRequest(ctx context.Context, planeName string, resourceGroupName string, options *ResourceGroupsClientGetOptions) (*policy.Request, error) { - urlPath := "/GET /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" + urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -237,7 +237,7 @@ func (client *ResourceGroupsClient) NewListPager(planeName string, options *Reso // listCreateRequest creates the List request. func (client *ResourceGroupsClient) listCreateRequest(ctx context.Context, planeName string, options *ResourceGroupsClientListOptions) (*policy.Request, error) { - urlPath := "/GET /planes/radius/{planeName}/resourcegroups/radius/{planeName}" + urlPath := "/planes/radius/{planeName}/resourcegroups/radius/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -290,7 +290,7 @@ func (client *ResourceGroupsClient) Update(ctx context.Context, planeName string // updateCreateRequest creates the Update request. func (client *ResourceGroupsClient) updateCreateRequest(ctx context.Context, planeName string, resourceGroupName string, properties ResourceGroupResourceTagsUpdate, options *ResourceGroupsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/PATCH /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" + urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go index 919c27dfe2..fc58943f30 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go @@ -86,7 +86,7 @@ func (client *ResourceProvidersClient) createOrUpdate(ctx context.Context, plane // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *ResourceProvidersClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resource ResourceProviderResource, options *ResourceProvidersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/PUT /planes/{resourceProviderName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" + urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -155,7 +155,7 @@ func (client *ResourceProvidersClient) deleteOperation(ctx context.Context, plan // deleteCreateRequest creates the Delete request. func (client *ResourceProvidersClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *ResourceProvidersClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/DELETE /planes/{resourceProviderName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" + urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -202,7 +202,7 @@ func (client *ResourceProvidersClient) Get(ctx context.Context, planeName string // getCreateRequest creates the Get request. func (client *ResourceProvidersClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *ResourceProvidersClientGetOptions) (*policy.Request, error) { - urlPath := "/GET /planes/{resourceProviderName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" + urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -260,7 +260,7 @@ func (client *ResourceProvidersClient) GetProviderSummary(ctx context.Context, p // getProviderSummaryCreateRequest creates the GetProviderSummary request. func (client *ResourceProvidersClient) getProviderSummaryCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *ResourceProvidersClientGetProviderSummaryOptions) (*policy.Request, error) { - urlPath := "/radius/{planeName}/providers/{resourceProviderName}" + urlPath := "/planes/radius/{planeName}/providers/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -325,7 +325,7 @@ func (client *ResourceProvidersClient) NewListPager(planeName string, options *R // listCreateRequest creates the List request. func (client *ResourceProvidersClient) listCreateRequest(ctx context.Context, planeName string, options *ResourceProvidersClientListOptions) (*policy.Request, error) { - urlPath := "/GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/radius/{planeName}" + urlPath := "/planes/planes/radius/{planeName}/providers/System.Resources/resourceproviders/radius/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -387,7 +387,7 @@ func (client *ResourceProvidersClient) NewListProviderSummariesPager(planeName s // listProviderSummariesCreateRequest creates the ListProviderSummaries request. func (client *ResourceProvidersClient) listProviderSummariesCreateRequest(ctx context.Context, planeName string, options *ResourceProvidersClientListProviderSummariesOptions) (*policy.Request, error) { - urlPath := "/radius/{planeName}/providers" + urlPath := "/planes/radius/{planeName}/providers" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go index f05ffc235a..fdc38a551c 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go @@ -87,7 +87,7 @@ func (client *ResourceTypesClient) createOrUpdate(ctx context.Context, planeName // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *ResourceTypesClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, resource ResourceTypeResource, options *ResourceTypesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/PUT /planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" + urlPath := "/planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -161,7 +161,7 @@ func (client *ResourceTypesClient) deleteOperation(ctx context.Context, planeNam // deleteCreateRequest creates the Delete request. func (client *ResourceTypesClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *ResourceTypesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/DELETE /planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" + urlPath := "/planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -213,7 +213,7 @@ func (client *ResourceTypesClient) Get(ctx context.Context, planeName string, re // getCreateRequest creates the Get request. func (client *ResourceTypesClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *ResourceTypesClientGetOptions) (*policy.Request, error) { - urlPath := "/GET /planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" + urlPath := "/planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -282,7 +282,7 @@ func (client *ResourceTypesClient) NewListPager(planeName string, resourceProvid // listCreateRequest creates the List request. func (client *ResourceTypesClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *ResourceTypesClientListOptions) (*policy.Request, error) { - urlPath := "/GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" + urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } diff --git a/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json b/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json index b3087064b3..49fa5510cf 100644 --- a/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json +++ b/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json @@ -113,13 +113,13 @@ } } }, - "/DELETE /planes/{resourceProviderName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { - "delete": { - "operationId": "ResourceProviders_Delete", + "/planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { + "get": { + "operationId": "ResourceTypes_Get", "tags": [ - "ResourceProviders" + "ResourceTypes" ], - "description": "Delete a resource provider", + "description": "Get the specified resource type.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -141,19 +141,97 @@ "type": "string", "maxLength": 63, "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, + { + "name": "resourceTypeName", + "in": "path", + "description": "The resource type name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" } ], "responses": { "200": { - "description": "Resource deleted successfully." + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/ResourceTypeResource" + } }, - "202": { - "description": "Resource deletion accepted.", + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Gets a resource type defined by a resource provider.": { + "$ref": "./examples/ResourceTypes_Get.json" + } + } + }, + "put": { + "operationId": "ResourceTypes_CreateOrUpdate", + "tags": [ + "ResourceTypes" + ], + "description": "Create or update a resource type", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, + { + "name": "resourceTypeName", + "in": "path", + "description": "The resource type name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/ResourceTypeResource" + } + } + ], + "responses": { + "200": { + "description": "Resource 'ResourceTypeResource' update operation succeeded", + "schema": { + "$ref": "#/definitions/ResourceTypeResource" + } + }, + "201": { + "description": "Resource 'ResourceTypeResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/ResourceTypeResource" + }, "headers": { - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." - }, "Retry-After": { "type": "integer", "format": "int32", @@ -161,9 +239,6 @@ } } }, - "204": { - "description": "Resource does not exist." - }, "default": { "description": "An unexpected error response.", "schema": { @@ -172,17 +247,15 @@ } }, "x-ms-examples": { - "Delete a resource resource": { - "$ref": "./examples/ResourceProviders_Delete.json" + "Create or update a resource type defined by a resource provider.": { + "$ref": "./examples/ResourceTypes_CreateOrUpdate.json" } }, "x-ms-long-running-operation-options": { - "final-state-via": "location" + "final-state-via": "azure-async-operation" }, "x-ms-long-running-operation": true - } - }, - "/DELETE /planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { + }, "delete": { "operationId": "ResourceTypes_Delete", "tags": [ @@ -260,36 +333,24 @@ "x-ms-long-running-operation": true } }, - "/DELETE /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { - "delete": { - "operationId": "AwsCredentials_Delete", + "/planes/aws": { + "get": { + "operationId": "AwsPlanes_List", "tags": [ - "AwsCredentials" + "AwsPlanes" ], - "description": "Delete an AWS credential", + "description": "List AWS planes", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/AwsPlaneNameParameter" - }, - { - "name": "credentialName", - "in": "path", - "description": "The AWS credential name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { - "description": "Resource deleted successfully." - }, - "204": { - "description": "Resource does not exist." + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/AwsPlaneResourceListResult" + } }, "default": { "description": "An unexpected error response.", @@ -298,23 +359,18 @@ } } }, - "x-ms-examples": { - "Delete an AWS AccessKey credential": { - "$ref": "./examples/AWSCredential_AccessKey_Delete.json" - }, - "Delete an AWS IRSA credential": { - "$ref": "./examples/AWSCredential_IRSA_Delete.json" - } + "x-ms-pageable": { + "nextLinkName": "nextLink" } } }, - "/DELETE /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}": { - "delete": { - "operationId": "ResourceGroups_Delete", + "/planes/aws/{planeName}": { + "get": { + "operationId": "AwsPlanes_Get", "tags": [ - "ResourceGroups" + "AwsPlanes" ], - "description": "Delete a resource group", + "description": "Get a plane by name", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -327,23 +383,14 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceGroupName", - "in": "path", - "description": "The name of resource group", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { - "description": "Resource deleted successfully." - }, - "204": { - "description": "Resource does not exist." + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/AwsPlaneResource" + } }, "default": { "description": "An unexpected error response.", @@ -351,21 +398,14 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } - }, - "x-ms-examples": { - "Delete a resource group": { - "$ref": "./examples/ResourceGroups_Delete.json" - } } - } - }, - "/GET /planes/{resourceProviderName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { - "get": { - "operationId": "ResourceProviders_Get", + }, + "put": { + "operationId": "AwsPlanes_CreateOrUpdate", "tags": [ - "ResourceProviders" + "AwsPlanes" ], - "description": "Get the specified resource provider.", + "description": "Create or update a plane", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -380,20 +420,33 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "name": "resource", + "in": "body", + "description": "Resource create parameters.", "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + "schema": { + "$ref": "#/definitions/AwsPlaneResource" + } } ], "responses": { "200": { - "description": "Azure operation completed successfully.", + "description": "Resource 'AwsPlaneResource' update operation succeeded", "schema": { - "$ref": "#/definitions/ResourceProviderResource" + "$ref": "#/definitions/AwsPlaneResource" + } + }, + "201": { + "description": "Resource 'AwsPlaneResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/AwsPlaneResource" + }, + "headers": { + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } } }, "default": { @@ -403,20 +456,17 @@ } } }, - "x-ms-examples": { - "Gets a resource provider.": { - "$ref": "./examples/ResourceProviders_Get.json" - } - } - } - }, - "/GET /planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { - "get": { - "operationId": "ResourceTypes_Get", + "x-ms-long-running-operation-options": { + "final-state-via": "azure-async-operation" + }, + "x-ms-long-running-operation": true + }, + "patch": { + "operationId": "AwsPlanes_Update", "tags": [ - "ResourceTypes" + "AwsPlanes" ], - "description": "Get the specified resource type.", + "description": "Update a plane", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -431,29 +481,34 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - }, - { - "name": "resourceTypeName", - "in": "path", - "description": "The resource type name.", + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" + "schema": { + "$ref": "#/definitions/AwsPlaneResourceTagsUpdate" + } } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceTypeResource" + "$ref": "#/definitions/AwsPlaneResource" + } + }, + "202": { + "description": "Resource update request accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } } }, "default": { @@ -463,14 +518,66 @@ } } }, - "x-ms-examples": { - "Gets a resource type defined by a resource provider.": { - "$ref": "./examples/ResourceTypes_Get.json" + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + }, + "delete": { + "operationId": "AwsPlanes_Delete", + "tags": [ + "AwsPlanes" + ], + "description": "Delete a plane", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } - } + ], + "responses": { + "200": { + "description": "Resource deleted successfully." + }, + "202": { + "description": "Resource deletion accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true } }, - "/GET /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { + "/planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { "get": { "operationId": "AwsCredentials_Get", "tags": [ @@ -516,28 +623,50 @@ "$ref": "./examples/AWSCredential_IRSA_Get.json" } } - } - }, - "/GET /planes/aws/planes/aws/{planeName}": { - "get": { - "operationId": "AwsCredentials_List", + }, + "put": { + "operationId": "AwsCredentials_CreateOrUpdate", "tags": [ "AwsCredentials" ], - "description": "List AWS credentials", + "description": "Create or update an AWS credential", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { "$ref": "#/parameters/AwsPlaneNameParameter" + }, + { + "name": "credentialName", + "in": "path", + "description": "The AWS credential name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/AwsCredentialResource" + } } ], "responses": { "200": { - "description": "Azure operation completed successfully.", + "description": "Resource 'AwsCredentialResource' update operation succeeded", "schema": { - "$ref": "#/definitions/AwsCredentialResourceListResult" + "$ref": "#/definitions/AwsCredentialResource" + } + }, + "201": { + "description": "Resource 'AwsCredentialResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/AwsCredentialResource" } }, "default": { @@ -548,47 +677,51 @@ } }, "x-ms-examples": { - "List AWS AccessKey credential": { - "$ref": "./examples/AWSCredential_AccessKey_List.json" + "Create or update an AWS AccessKey credential": { + "$ref": "./examples/AWSCredential_AccessKey_CreateOrUpdate.json" }, - "List AWS IRSA credentials": { - "$ref": "./examples/AWSCredential_IRSA_List.json" + "Create or update an AWS IRSA credential": { + "$ref": "./examples/AWSCredential_IRSA_CreateOrUpdate.json" } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" } - } - }, - "/GET /planes/azure/{planeName}/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}": { - "get": { - "operationId": "AzureCredentials_Get", + }, + "patch": { + "operationId": "AwsCredentials_Update", "tags": [ - "AzureCredentials" + "AwsCredentials" ], - "description": "Get an Azure credential", + "description": "Update an AWS credential", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/AzurePlaneNameParameter" + "$ref": "#/parameters/AwsPlaneNameParameter" }, { "name": "credentialName", "in": "path", - "description": "The Azure credential name.", + "description": "The AWS credential name.", "required": true, "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/AwsCredentialResourceTagsUpdate" + } } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AzureCredentialResource" + "$ref": "#/definitions/AwsCredentialResource" } }, "default": { @@ -599,36 +732,43 @@ } }, "x-ms-examples": { - "Get an Azure Service Principal credential": { - "$ref": "./examples/AzureCredential_ServicePrincipal_Get.json" + "Update an AWS AccessKey credential": { + "$ref": "./examples/AWSCredential_AccessKey_Update.json" }, - "Get an Azure Workload Identity credential": { - "$ref": "./examples/AzureCredential_WorkloadIdentity_Get.json" + "Update an AWS IRSA credential": { + "$ref": "./examples/AWSCredential_IRSA_Update.json" } } - } - }, - "/GET /planes/azure/planes/azure/{planeName}": { - "get": { - "operationId": "AzureCredentials_List", + }, + "delete": { + "operationId": "AwsCredentials_Delete", "tags": [ - "AzureCredentials" + "AwsCredentials" ], - "description": "List Azure credentials", + "description": "Delete an AWS credential", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/AzurePlaneNameParameter" + "$ref": "#/parameters/AwsPlaneNameParameter" + }, + { + "name": "credentialName", + "in": "path", + "description": "The AWS credential name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/AzureCredentialResourceListResult" - } + "description": "Resource deleted successfully." + }, + "204": { + "description": "Resource does not exist." }, "default": { "description": "An unexpected error response.", @@ -638,53 +778,35 @@ } }, "x-ms-examples": { - "List Azure Service Principal credentials": { - "$ref": "./examples/AzureCredential_ServicePrincipal_List.json" + "Delete an AWS AccessKey credential": { + "$ref": "./examples/AWSCredential_AccessKey_Delete.json" }, - "List Azure Workload Identity credentials": { - "$ref": "./examples/AzureCredential_WorkloadIdentity_List.json" + "Delete an AWS IRSA credential": { + "$ref": "./examples/AWSCredential_IRSA_Delete.json" } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" } } }, - "/GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { + "/planes/aws/planes/aws/{planeName}": { "get": { - "operationId": "ResourceTypes_List", + "operationId": "AwsCredentials_List", "tags": [ - "ResourceTypes" + "AwsCredentials" ], - "description": "List resource types.", + "description": "List AWS credentials", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + "$ref": "#/parameters/AwsPlaneNameParameter" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceTypeResourceListResult" + "$ref": "#/definitions/AwsCredentialResourceListResult" } }, "default": { @@ -695,8 +817,11 @@ } }, "x-ms-examples": { - "List resource types defined by a resource provider.": { - "$ref": "./examples/ResourceTypes_List.json" + "List AWS AccessKey credential": { + "$ref": "./examples/AWSCredential_AccessKey_List.json" + }, + "List AWS IRSA credentials": { + "$ref": "./examples/AWSCredential_IRSA_List.json" } }, "x-ms-pageable": { @@ -704,32 +829,23 @@ } } }, - "/GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/radius/{planeName}": { + "/planes/azure": { "get": { - "operationId": "ResourceProviders_List", + "operationId": "AzurePlanes_List", "tags": [ - "ResourceProviders" + "AzurePlanes" ], - "description": "List resource providers.", + "description": "List azure planes", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceProviderResourceListResult" + "$ref": "#/definitions/AzurePlaneResourceListResult" } }, "default": { @@ -739,23 +855,18 @@ } } }, - "x-ms-examples": { - "List resource providers.": { - "$ref": "./examples/ResourceProviders_List.json" - } - }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, - "/GET /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}": { + "/planes/azure/{planeName}": { "get": { - "operationId": "ResourceGroups_Get", + "operationId": "AzurePlanes_Get", "tags": [ - "ResourceGroups" + "AzurePlanes" ], - "description": "Get a resource group", + "description": "Get a plane by name", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -768,22 +879,13 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceGroupName", - "in": "path", - "description": "The name of resource group", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceGroupResource" + "$ref": "#/definitions/AzurePlaneResource" } }, "default": { @@ -792,21 +894,14 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } - }, - "x-ms-examples": { - "Get a resource group": { - "$ref": "./examples/ResourceGroups_Get.json" - } } - } - }, - "/GET /planes/radius/{planeName}/resourcegroups/radius/{planeName}": { - "get": { - "operationId": "ResourceGroups_List", + }, + "put": { + "operationId": "AzurePlanes_CreateOrUpdate", "tags": [ - "ResourceGroups" + "AzurePlanes" ], - "description": "List resource groups", + "description": "Create or update a plane", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -819,13 +914,35 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/AzurePlaneResource" + } } ], "responses": { "200": { - "description": "Azure operation completed successfully.", + "description": "Resource 'AzurePlaneResource' update operation succeeded", "schema": { - "$ref": "#/definitions/ResourceGroupResourceListResult" + "$ref": "#/definitions/AzurePlaneResource" + } + }, + "201": { + "description": "Resource 'AzurePlaneResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/AzurePlaneResource" + }, + "headers": { + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } } }, "default": { @@ -835,34 +952,25 @@ } } }, - "x-ms-examples": { - "List resource groups": { - "$ref": "./examples/ResourceGroups_List.json" - } + "x-ms-long-running-operation-options": { + "final-state-via": "azure-async-operation" }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/PATCH /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { + "x-ms-long-running-operation": true + }, "patch": { - "operationId": "AwsCredentials_Update", + "operationId": "AzurePlanes_Update", "tags": [ - "AwsCredentials" + "AzurePlanes" ], - "description": "Update an AWS credential", + "description": "Update a plane", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/AwsPlaneNameParameter" - }, - { - "name": "credentialName", + "name": "planeName", "in": "path", - "description": "The AWS credential name.", + "description": "The plane name.", "required": true, "type": "string", "maxLength": 63, @@ -874,7 +982,7 @@ "description": "The resource properties to be updated.", "required": true, "schema": { - "$ref": "#/definitions/AwsCredentialResourceTagsUpdate" + "$ref": "#/definitions/AzurePlaneResourceTagsUpdate" } } ], @@ -882,7 +990,21 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AwsCredentialResource" + "$ref": "#/definitions/AzurePlaneResource" + } + }, + "202": { + "description": "Resource update request accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } } }, "default": { @@ -892,23 +1014,17 @@ } } }, - "x-ms-examples": { - "Update an AWS AccessKey credential": { - "$ref": "./examples/AWSCredential_AccessKey_Update.json" - }, - "Update an AWS IRSA credential": { - "$ref": "./examples/AWSCredential_IRSA_Update.json" - } - } - } - }, - "/PATCH /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}": { - "patch": { - "operationId": "ResourceGroups_Update", + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + }, + "delete": { + "operationId": "AzurePlanes_Delete", "tags": [ - "ResourceGroups" + "AzurePlanes" ], - "description": "Update a resource group", + "description": "Delete a plane", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -921,31 +1037,71 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + } + ], + "responses": { + "200": { + "description": "Resource deleted successfully." + }, + "202": { + "description": "Resource deletion accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + } + }, + "/planes/azure/{planeName}/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}": { + "get": { + "operationId": "AzureCredentials_Get", + "tags": [ + "AzureCredentials" + ], + "description": "Get an Azure credential", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "name": "resourceGroupName", + "$ref": "#/parameters/AzurePlaneNameParameter" + }, + { + "name": "credentialName", "in": "path", - "description": "The name of resource group", + "description": "The Azure credential name.", "required": true, "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "properties", - "in": "body", - "description": "The resource properties to be updated.", - "required": true, - "schema": { - "$ref": "#/definitions/ResourceGroupResourceTagsUpdate" - } } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceGroupResource" + "$ref": "#/definitions/AzureCredentialResource" } }, "default": { @@ -956,40 +1112,37 @@ } }, "x-ms-examples": { - "Update a resource group": { - "$ref": "./examples/ResourceGroups_Update.json" + "Get an Azure Service Principal credential": { + "$ref": "./examples/AzureCredential_ServicePrincipal_Get.json" + }, + "Get an Azure Workload Identity credential": { + "$ref": "./examples/AzureCredential_WorkloadIdentity_Get.json" } } } }, - "/PUT /planes/{resourceProviderName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { + "/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}": { "put": { - "operationId": "ResourceProviders_CreateOrUpdate", + "operationId": "AzureCredentials_CreateOrUpdate", "tags": [ - "ResourceProviders" + "AzureCredentials" ], - "description": "Create or update a resource provider", + "description": "Create or update an Azure credential", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + "$ref": "#/parameters/AzurePlaneNameParameter" }, { - "name": "resourceProviderName", + "name": "credentialName", "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "description": "The Azure credential name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { "name": "resource", @@ -997,28 +1150,21 @@ "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/ResourceProviderResource" + "$ref": "#/definitions/AzureCredentialResource" } } ], "responses": { "200": { - "description": "Resource 'ResourceProviderResource' update operation succeeded", + "description": "Resource 'AzureCredentialResource' update operation succeeded", "schema": { - "$ref": "#/definitions/ResourceProviderResource" + "$ref": "#/definitions/AzureCredentialResource" } }, "201": { - "description": "Resource 'ResourceProviderResource' create operation succeeded", + "description": "Resource 'AzureCredentialResource' create operation succeeded", "schema": { - "$ref": "#/definitions/ResourceProviderResource" - }, - "headers": { - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } + "$ref": "#/definitions/AzureCredentialResource" } }, "default": { @@ -1029,82 +1175,51 @@ } }, "x-ms-examples": { - "Create or update a resource provider": { - "$ref": "./examples/ResourceProviders_CreateOrUpdate.json" + "Create or update an Azure Service Principal credential": { + "$ref": "./examples/AzureCredential_ServicePrincipal_CreateOrUpdate.json" + }, + "Create or update an Azure Workload Identity credential": { + "$ref": "./examples/AzureCredential_WorkloadIdentity_CreateOrUpdate.json" } - }, - "x-ms-long-running-operation-options": { - "final-state-via": "azure-async-operation" - }, - "x-ms-long-running-operation": true - } - }, - "/PUT /planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { - "put": { - "operationId": "ResourceTypes_CreateOrUpdate", - "tags": [ - "ResourceTypes" + } + }, + "patch": { + "operationId": "AzureCredentials_Update", + "tags": [ + "AzureCredentials" ], - "description": "Create or update a resource type", + "description": "Update an Azure credential", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + "$ref": "#/parameters/AzurePlaneNameParameter" }, { - "name": "resourceTypeName", + "name": "credentialName", "in": "path", - "description": "The resource type name.", + "description": "The Azure credential name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resource", + "name": "properties", "in": "body", - "description": "Resource create parameters.", + "description": "The resource properties to be updated.", "required": true, "schema": { - "$ref": "#/definitions/ResourceTypeResource" + "$ref": "#/definitions/AzureCredentialResourceTagsUpdate" } } ], "responses": { "200": { - "description": "Resource 'ResourceTypeResource' update operation succeeded", - "schema": { - "$ref": "#/definitions/ResourceTypeResource" - } - }, - "201": { - "description": "Resource 'ResourceTypeResource' create operation succeeded", + "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceTypeResource" - }, - "headers": { - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } + "$ref": "#/definitions/AzureCredentialResource" } }, "default": { @@ -1115,60 +1230,81 @@ } }, "x-ms-examples": { - "Create or update a resource type defined by a resource provider.": { - "$ref": "./examples/ResourceTypes_CreateOrUpdate.json" + "Update an Azure Service Principal credential": { + "$ref": "./examples/AzureCredential_ServicePrincipal_Update.json" + }, + "Update an Azure Workload Identity credential": { + "$ref": "./examples/AzureCredential_WorkloadIdentity_Update.json" } - }, - "x-ms-long-running-operation-options": { - "final-state-via": "azure-async-operation" - }, - "x-ms-long-running-operation": true - } - }, - "/PUT /planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { - "put": { - "operationId": "AwsCredentials_CreateOrUpdate", + } + }, + "delete": { + "operationId": "AzureCredentials_Delete", "tags": [ - "AwsCredentials" + "AzureCredentials" ], - "description": "Create or update an AWS credential", + "description": "Delete an Azure credential", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/AwsPlaneNameParameter" + "$ref": "#/parameters/AzurePlaneNameParameter" }, { "name": "credentialName", "in": "path", - "description": "The AWS credential name.", + "description": "The Azure credential name.", "required": true, "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resource", - "in": "body", - "description": "Resource create parameters.", - "required": true, - "schema": { - "$ref": "#/definitions/AwsCredentialResource" - } } ], "responses": { "200": { - "description": "Resource 'AwsCredentialResource' update operation succeeded", + "description": "Resource deleted successfully." + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", "schema": { - "$ref": "#/definitions/AwsCredentialResource" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } + } + }, + "x-ms-examples": { + "Delete an Azure Service Principal credential": { + "$ref": "./examples/AzureCredential_ServicePrincipal_Delete.json" }, - "201": { - "description": "Resource 'AwsCredentialResource' create operation succeeded", + "Delete an Azure Workload Identity credential": { + "$ref": "./examples/AzureCredential_WorkloadIdentity_Delete.json" + } + } + } + }, + "/planes/azure/planes/azure/{planeName}": { + "get": { + "operationId": "AzureCredentials_List", + "tags": [ + "AzureCredentials" + ], + "description": "List Azure credentials", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/AzurePlaneNameParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AwsCredentialResource" + "$ref": "#/definitions/AzureCredentialResourceListResult" } }, "default": { @@ -1179,22 +1315,25 @@ } }, "x-ms-examples": { - "Create or update an AWS AccessKey credential": { - "$ref": "./examples/AWSCredential_AccessKey_CreateOrUpdate.json" + "List Azure Service Principal credentials": { + "$ref": "./examples/AzureCredential_ServicePrincipal_List.json" }, - "Create or update an AWS IRSA credential": { - "$ref": "./examples/AWSCredential_IRSA_CreateOrUpdate.json" + "List Azure Workload Identity credentials": { + "$ref": "./examples/AzureCredential_WorkloadIdentity_List.json" } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" } } }, - "/PUT /planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}": { - "put": { - "operationId": "ResourceGroups_CreateOrUpdate", + "/planes/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { + "get": { + "operationId": "Locations_List", "tags": [ - "ResourceGroups" + "Locations" ], - "description": "Create or update a resource group", + "description": "List available locations for the specified resource provider.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1209,35 +1348,65 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resourceGroupName", + "name": "resourceProviderName", "in": "path", - "description": "The name of resource group", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resource", - "in": "body", - "description": "Resource create parameters.", - "required": true, - "schema": { - "$ref": "#/definitions/ResourceGroupResource" - } + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" } ], "responses": { "200": { - "description": "Resource 'ResourceGroupResource' update operation succeeded", + "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceGroupResource" + "$ref": "#/definitions/LocationResourceListResult" } }, - "201": { - "description": "Resource 'ResourceGroupResource' create operation succeeded", + "default": { + "description": "An unexpected error response.", "schema": { - "$ref": "#/definitions/ResourceGroupResource" + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List locations supported by a resource provider.": { + "$ref": "./examples/Locations_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/planes/planes/radius/{planeName}/providers/System.Resources/resourceproviders/radius/{planeName}": { + "get": { + "operationId": "ResourceProviders_List", + "tags": [ + "ResourceProviders" + ], + "description": "List resource providers.", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/ResourceProviderResourceListResult" } }, "default": { @@ -1248,19 +1417,22 @@ } }, "x-ms-examples": { - "Create or update a resource group": { - "$ref": "./examples/ResourceGroups_CreateOrUpdate.json" + "List resource providers.": { + "$ref": "./examples/ResourceProviders_List.json" } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" } } }, - "/planes/aws": { + "/planes/radius": { "get": { - "operationId": "AwsPlanes_List", + "operationId": "RadiusPlanes_List", "tags": [ - "AwsPlanes" + "RadiusPlanes" ], - "description": "List AWS planes", + "description": "List Radius planes", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1270,7 +1442,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AwsPlaneResourceListResult" + "$ref": "#/definitions/RadiusPlaneResourceListResult" } }, "default": { @@ -1285,11 +1457,11 @@ } } }, - "/planes/aws/{planeName}": { + "/planes/radius/{planeName}": { "get": { - "operationId": "AwsPlanes_Get", + "operationId": "RadiusPlanes_Get", "tags": [ - "AwsPlanes" + "RadiusPlanes" ], "description": "Get a plane by name", "parameters": [ @@ -1310,7 +1482,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AwsPlaneResource" + "$ref": "#/definitions/RadiusPlaneResource" } }, "default": { @@ -1322,9 +1494,9 @@ } }, "put": { - "operationId": "AwsPlanes_CreateOrUpdate", + "operationId": "RadiusPlanes_CreateOrUpdate", "tags": [ - "AwsPlanes" + "RadiusPlanes" ], "description": "Create or update a plane", "parameters": [ @@ -1346,21 +1518,21 @@ "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/AwsPlaneResource" + "$ref": "#/definitions/RadiusPlaneResource" } } ], "responses": { "200": { - "description": "Resource 'AwsPlaneResource' update operation succeeded", + "description": "Resource 'RadiusPlaneResource' update operation succeeded", "schema": { - "$ref": "#/definitions/AwsPlaneResource" + "$ref": "#/definitions/RadiusPlaneResource" } }, "201": { - "description": "Resource 'AwsPlaneResource' create operation succeeded", + "description": "Resource 'RadiusPlaneResource' create operation succeeded", "schema": { - "$ref": "#/definitions/AwsPlaneResource" + "$ref": "#/definitions/RadiusPlaneResource" }, "headers": { "Retry-After": { @@ -1383,9 +1555,9 @@ "x-ms-long-running-operation": true }, "patch": { - "operationId": "AwsPlanes_Update", + "operationId": "RadiusPlanes_Update", "tags": [ - "AwsPlanes" + "RadiusPlanes" ], "description": "Update a plane", "parameters": [ @@ -1407,7 +1579,7 @@ "description": "The resource properties to be updated.", "required": true, "schema": { - "$ref": "#/definitions/AwsPlaneResourceTagsUpdate" + "$ref": "#/definitions/RadiusPlaneResourceTagsUpdate" } } ], @@ -1415,7 +1587,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AwsPlaneResource" + "$ref": "#/definitions/RadiusPlaneResource" } }, "202": { @@ -1445,9 +1617,9 @@ "x-ms-long-running-operation": true }, "delete": { - "operationId": "AwsPlanes_Delete", + "operationId": "RadiusPlanes_Delete", "tags": [ - "AwsPlanes" + "RadiusPlanes" ], "description": "Delete a plane", "parameters": [ @@ -1498,23 +1670,32 @@ "x-ms-long-running-operation": true } }, - "/planes/azure": { + "/planes/radius/{planeName}/providers": { "get": { - "operationId": "AzurePlanes_List", + "operationId": "ResourceProviders_ListProviderSummaries", "tags": [ - "AzurePlanes" + "ResourceProviders" ], - "description": "List azure planes", + "description": "List resource provider summaries. The resource provider summary aggregates the most commonly used information including locations, api versions and resource types.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { - "description": "Azure operation completed successfully.", + "description": "The request has succeeded.", "schema": { - "$ref": "#/definitions/AzurePlaneResourceListResult" + "$ref": "#/definitions/PagedResourceProviderSummary" } }, "default": { @@ -1524,18 +1705,23 @@ } } }, + "x-ms-examples": { + "List resource provider summaries. The resource provider summary aggregates common information about resource types, api versions, and locations.": { + "$ref": "./examples/ResourceProviders_ListProviderSummaries.json" + } + }, "x-ms-pageable": { "nextLinkName": "nextLink" } } }, - "/planes/azure/{planeName}": { + "/planes/radius/{planeName}/providers/{resourceProviderName}": { "get": { - "operationId": "AzurePlanes_Get", + "operationId": "ResourceProviders_GetProviderSummary", "tags": [ - "AzurePlanes" + "ResourceProviders" ], - "description": "Get a plane by name", + "description": "Get the specified resource provider summary. The resource provider summary aggregates the most commonly used information including locations, api versions and resource types.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1548,13 +1734,22 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AzurePlaneResource" + "$ref": "#/definitions/ResourceProviderSummary" } }, "default": { @@ -1563,14 +1758,21 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } + }, + "x-ms-examples": { + "Get a resoure provider summary. The resource provider summary aggregates common information about resource types, api versions, and locations.": { + "$ref": "./examples/ResourceProviders_GetProviderSummary.json" + } } - }, - "put": { - "operationId": "AzurePlanes_CreateOrUpdate", + } + }, + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { + "get": { + "operationId": "ResourceProviders_Get", "tags": [ - "AzurePlanes" + "ResourceProviders" ], - "description": "Create or update a plane", + "description": "Get the specified resource provider.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1585,33 +1787,20 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resource", - "in": "body", - "description": "Resource create parameters.", + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", "required": true, - "schema": { - "$ref": "#/definitions/AzurePlaneResource" - } + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" } ], "responses": { "200": { - "description": "Resource 'AzurePlaneResource' update operation succeeded", - "schema": { - "$ref": "#/definitions/AzurePlaneResource" - } - }, - "201": { - "description": "Resource 'AzurePlaneResource' create operation succeeded", + "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AzurePlaneResource" - }, - "headers": { - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } + "$ref": "#/definitions/ResourceProviderResource" } }, "default": { @@ -1621,17 +1810,18 @@ } } }, - "x-ms-long-running-operation-options": { - "final-state-via": "azure-async-operation" - }, - "x-ms-long-running-operation": true + "x-ms-examples": { + "Gets a resource provider.": { + "$ref": "./examples/ResourceProviders_Get.json" + } + } }, - "patch": { - "operationId": "AzurePlanes_Update", + "put": { + "operationId": "ResourceProviders_CreateOrUpdate", "tags": [ - "AzurePlanes" + "ResourceProviders" ], - "description": "Update a plane", + "description": "Create or update a resource provider", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1646,29 +1836,37 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "properties", + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, + { + "name": "resource", "in": "body", - "description": "The resource properties to be updated.", + "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/AzurePlaneResourceTagsUpdate" + "$ref": "#/definitions/ResourceProviderResource" } } ], "responses": { "200": { - "description": "Azure operation completed successfully.", + "description": "Resource 'ResourceProviderResource' update operation succeeded", "schema": { - "$ref": "#/definitions/AzurePlaneResource" + "$ref": "#/definitions/ResourceProviderResource" } }, - "202": { - "description": "Resource update request accepted.", + "201": { + "description": "Resource 'ResourceProviderResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/ResourceProviderResource" + }, "headers": { - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." - }, "Retry-After": { "type": "integer", "format": "int32", @@ -1683,17 +1881,22 @@ } } }, + "x-ms-examples": { + "Create or update a resource provider": { + "$ref": "./examples/ResourceProviders_CreateOrUpdate.json" + } + }, "x-ms-long-running-operation-options": { - "final-state-via": "location" + "final-state-via": "azure-async-operation" }, "x-ms-long-running-operation": true }, "delete": { - "operationId": "AzurePlanes_Delete", + "operationId": "ResourceProviders_Delete", "tags": [ - "AzurePlanes" + "ResourceProviders" ], - "description": "Delete a plane", + "description": "Delete a resource provider", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1706,6 +1909,15 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" } ], "responses": { @@ -1736,290 +1948,61 @@ } } }, + "x-ms-examples": { + "Delete a resource resource": { + "$ref": "./examples/ResourceProviders_Delete.json" + } + }, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-long-running-operation": true } }, - "/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}": { - "put": { - "operationId": "AzureCredentials_CreateOrUpdate", - "tags": [ - "AzureCredentials" - ], - "description": "Create or update an Azure credential", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/AzurePlaneNameParameter" - }, - { - "name": "credentialName", - "in": "path", - "description": "The Azure credential name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resource", - "in": "body", - "description": "Resource create parameters.", - "required": true, - "schema": { - "$ref": "#/definitions/AzureCredentialResource" - } - } - ], - "responses": { - "200": { - "description": "Resource 'AzureCredentialResource' update operation succeeded", - "schema": { - "$ref": "#/definitions/AzureCredentialResource" - } - }, - "201": { - "description": "Resource 'AzureCredentialResource' create operation succeeded", - "schema": { - "$ref": "#/definitions/AzureCredentialResource" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Create or update an Azure Service Principal credential": { - "$ref": "./examples/AzureCredential_ServicePrincipal_CreateOrUpdate.json" - }, - "Create or update an Azure Workload Identity credential": { - "$ref": "./examples/AzureCredential_WorkloadIdentity_CreateOrUpdate.json" - } - } - }, - "patch": { - "operationId": "AzureCredentials_Update", + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations/{locationName}": { + "get": { + "operationId": "Locations_Get", "tags": [ - "AzureCredentials" + "Locations" ], - "description": "Update an Azure credential", + "description": "Get the specified location. The location resource represents a logical location where the resource provider operates.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/AzurePlaneNameParameter" - }, - { - "name": "credentialName", + "name": "planeName", "in": "path", - "description": "The Azure credential name.", + "description": "The plane name.", "required": true, "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "properties", - "in": "body", - "description": "The resource properties to be updated.", - "required": true, - "schema": { - "$ref": "#/definitions/AzureCredentialResourceTagsUpdate" - } - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/AzureCredentialResource" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Update an Azure Service Principal credential": { - "$ref": "./examples/AzureCredential_ServicePrincipal_Update.json" - }, - "Update an Azure Workload Identity credential": { - "$ref": "./examples/AzureCredential_WorkloadIdentity_Update.json" - } - } - }, - "delete": { - "operationId": "AzureCredentials_Delete", - "tags": [ - "AzureCredentials" - ], - "description": "Delete an Azure credential", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/AzurePlaneNameParameter" - }, - { - "name": "credentialName", + "name": "resourceProviderName", "in": "path", - "description": "The Azure credential name.", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - } - ], - "responses": { - "200": { - "description": "Resource deleted successfully." - }, - "204": { - "description": "Resource does not exist." - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Delete an Azure Service Principal credential": { - "$ref": "./examples/AzureCredential_ServicePrincipal_Delete.json" - }, - "Delete an Azure Workload Identity credential": { - "$ref": "./examples/AzureCredential_WorkloadIdentity_Delete.json" - } - } - } - }, - "/planes/radius": { - "get": { - "operationId": "RadiusPlanes_List", - "tags": [ - "RadiusPlanes" - ], - "description": "List Radius planes", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/RadiusPlaneResourceListResult" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/planes/radius/{planeName}": { - "get": { - "operationId": "RadiusPlanes_Get", - "tags": [ - "RadiusPlanes" - ], - "description": "Get a plane by name", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" }, { - "name": "planeName", + "name": "locationName", "in": "path", - "description": "The plane name.", + "description": "The location name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + "pattern": "^[A-Za-z][A-Za-z0-9]*$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/RadiusPlaneResource" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - } - }, - "put": { - "operationId": "RadiusPlanes_CreateOrUpdate", - "tags": [ - "RadiusPlanes" - ], - "description": "Create or update a plane", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resource", - "in": "body", - "description": "Resource create parameters.", - "required": true, - "schema": { - "$ref": "#/definitions/RadiusPlaneResource" - } - } - ], - "responses": { - "200": { - "description": "Resource 'RadiusPlaneResource' update operation succeeded", - "schema": { - "$ref": "#/definitions/RadiusPlaneResource" - } - }, - "201": { - "description": "Resource 'RadiusPlaneResource' create operation succeeded", - "schema": { - "$ref": "#/definitions/RadiusPlaneResource" - }, - "headers": { - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } + "$ref": "#/definitions/LocationResource" } }, "default": { @@ -2029,17 +2012,18 @@ } } }, - "x-ms-long-running-operation-options": { - "final-state-via": "azure-async-operation" - }, - "x-ms-long-running-operation": true + "x-ms-examples": { + "Gets a location supported by a resource provider.": { + "$ref": "./examples/Locations_Get.json" + } + } }, - "patch": { - "operationId": "RadiusPlanes_Update", + "put": { + "operationId": "Locations_CreateOrUpdate", "tags": [ - "RadiusPlanes" + "Locations" ], - "description": "Update a plane", + "description": "Create or update a location. The location resource represents a logical location where the resource provider operates.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2054,29 +2038,46 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "properties", + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, + { + "name": "locationName", + "in": "path", + "description": "The location name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z][A-Za-z0-9]*$" + }, + { + "name": "resource", "in": "body", - "description": "The resource properties to be updated.", + "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/RadiusPlaneResourceTagsUpdate" + "$ref": "#/definitions/LocationResource" } } ], "responses": { "200": { - "description": "Azure operation completed successfully.", + "description": "Resource 'LocationResource' update operation succeeded", "schema": { - "$ref": "#/definitions/RadiusPlaneResource" + "$ref": "#/definitions/LocationResource" } }, - "202": { - "description": "Resource update request accepted.", + "201": { + "description": "Resource 'LocationResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/LocationResource" + }, "headers": { - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." - }, "Retry-After": { "type": "integer", "format": "int32", @@ -2091,17 +2092,22 @@ } } }, + "x-ms-examples": { + "Create or update a location supported by a resource provider.": { + "$ref": "./examples/Locations_CreateOrUpdate.json" + } + }, "x-ms-long-running-operation-options": { - "final-state-via": "location" + "final-state-via": "azure-async-operation" }, "x-ms-long-running-operation": true }, "delete": { - "operationId": "RadiusPlanes_Delete", + "operationId": "Locations_Delete", "tags": [ - "RadiusPlanes" + "Locations" ], - "description": "Delete a plane", + "description": "Delete a location. The location resource represents a logical location where the resource provider operates.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2114,6 +2120,24 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, + { + "name": "locationName", + "in": "path", + "description": "The location name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z][A-Za-z0-9]*$" } ], "responses": { @@ -2144,19 +2168,24 @@ } } }, + "x-ms-examples": { + "Delete a location supported by a resource provider.": { + "$ref": "./examples/Locations_Delete.json" + } + }, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-long-running-operation": true } }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { "get": { - "operationId": "Locations_List", + "operationId": "ApiVersions_List", "tags": [ - "Locations" + "ApiVersions" ], - "description": "List available locations for the specified resource provider.", + "description": "List API versions.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2178,13 +2207,22 @@ "type": "string", "maxLength": 63, "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, + { + "name": "resourceTypeName", + "in": "path", + "description": "The resource type name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/LocationResourceListResult" + "$ref": "#/definitions/ApiVersionResourceListResult" } }, "default": { @@ -2195,8 +2233,8 @@ } }, "x-ms-examples": { - "List locations supported by a resource provider.": { - "$ref": "./examples/Locations_List.json" + "List api versions defined by a resource type supported by a resource provider.": { + "$ref": "./examples/ApiVersions_List.json" } }, "x-ms-pageable": { @@ -2204,13 +2242,13 @@ } } }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations/{locationName}": { + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/apiversions/{apiVersionName}": { "get": { - "operationId": "Locations_Get", + "operationId": "ApiVersions_Get", "tags": [ - "Locations" + "ApiVersions" ], - "description": "Get the specified location. The location resource represents a logical location where the resource provider operates.", + "description": "Get the specified API version.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2234,20 +2272,29 @@ "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" }, { - "name": "locationName", + "name": "resourceTypeName", "in": "path", - "description": "The location name.", + "description": "The resource type name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^[A-Za-z][A-Za-z0-9]*$" + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" + }, + { + "name": "apiVersionName", + "in": "path", + "description": "The API version name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^\\d{4}-\\d{2}-\\d{2}(-preview)?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/LocationResource" + "$ref": "#/definitions/ApiVersionResource" } }, "default": { @@ -2258,17 +2305,17 @@ } }, "x-ms-examples": { - "Gets a location supported by a resource provider.": { - "$ref": "./examples/Locations_Get.json" + "Get an api version defined by a resource type supported by a resource provider.": { + "$ref": "./examples/ApiVersions_Get.json" } } }, "put": { - "operationId": "Locations_CreateOrUpdate", + "operationId": "ApiVersions_CreateOrUpdate", "tags": [ - "Locations" + "ApiVersions" ], - "description": "Create or update a location. The location resource represents a logical location where the resource provider operates.", + "description": "Create or update an API version.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2292,13 +2339,22 @@ "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" }, { - "name": "locationName", + "name": "resourceTypeName", "in": "path", - "description": "The location name.", + "description": "The resource type name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^[A-Za-z][A-Za-z0-9]*$" + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" + }, + { + "name": "apiVersionName", + "in": "path", + "description": "The API version name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^\\d{4}-\\d{2}-\\d{2}(-preview)?$" }, { "name": "resource", @@ -2306,21 +2362,21 @@ "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/LocationResource" + "$ref": "#/definitions/ApiVersionResource" } } ], "responses": { "200": { - "description": "Resource 'LocationResource' update operation succeeded", + "description": "Resource 'ApiVersionResource' update operation succeeded", "schema": { - "$ref": "#/definitions/LocationResource" + "$ref": "#/definitions/ApiVersionResource" } }, "201": { - "description": "Resource 'LocationResource' create operation succeeded", + "description": "Resource 'ApiVersionResource' create operation succeeded", "schema": { - "$ref": "#/definitions/LocationResource" + "$ref": "#/definitions/ApiVersionResource" }, "headers": { "Retry-After": { @@ -2338,8 +2394,8 @@ } }, "x-ms-examples": { - "Create or update a location supported by a resource provider.": { - "$ref": "./examples/Locations_CreateOrUpdate.json" + "Create or update an api version defined by a resource type supported by a resource provider.": { + "$ref": "./examples/ApiVersions_CreateOrUpdate.json" } }, "x-ms-long-running-operation-options": { @@ -2348,11 +2404,11 @@ "x-ms-long-running-operation": true }, "delete": { - "operationId": "Locations_Delete", + "operationId": "ApiVersions_Delete", "tags": [ - "Locations" + "ApiVersions" ], - "description": "Delete a location. The location resource represents a logical location where the resource provider operates.", + "description": "Delete an API version.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2376,13 +2432,22 @@ "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" }, { - "name": "locationName", + "name": "resourceTypeName", "in": "path", - "description": "The location name.", + "description": "The resource type name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^[A-Za-z][A-Za-z0-9]*$" + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" + }, + { + "name": "apiVersionName", + "in": "path", + "description": "The API version name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^\\d{4}-\\d{2}-\\d{2}(-preview)?$" } ], "responses": { @@ -2414,8 +2479,8 @@ } }, "x-ms-examples": { - "Delete a location supported by a resource provider.": { - "$ref": "./examples/Locations_Delete.json" + "Delete an api version of a resource type supported by a resource provider.": { + "$ref": "./examples/ApiVersions_Delete.json" } }, "x-ms-long-running-operation-options": { @@ -2424,13 +2489,13 @@ "x-ms-long-running-operation": true } }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { "get": { - "operationId": "ApiVersions_List", + "operationId": "ResourceTypes_List", "tags": [ - "ApiVersions" + "ResourceTypes" ], - "description": "List API versions.", + "description": "List resource types.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2452,22 +2517,67 @@ "type": "string", "maxLength": 63, "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/ResourceTypeResourceListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List resource types defined by a resource provider.": { + "$ref": "./examples/ResourceTypes_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}": { + "get": { + "operationId": "Resources_List", + "tags": [ + "Resources" + ], + "description": "List resources in a resource group", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "name": "resourceTypeName", + "name": "planeName", "in": "path", - "description": "The resource type name.", + "description": "The plane name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceGroupName", + "in": "path", + "description": "The name of resource group", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ApiVersionResourceListResult" + "$ref": "#/definitions/GenericResourceListResult" } }, "default": { @@ -2478,8 +2588,8 @@ } }, "x-ms-examples": { - "List api versions defined by a resource type supported by a resource provider.": { - "$ref": "./examples/ApiVersions_List.json" + "List resources in a resource group.": { + "$ref": "./examples/Resources_List.json" } }, "x-ms-pageable": { @@ -2487,13 +2597,13 @@ } } }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/apiversions/{apiVersionName}": { + "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}": { "get": { - "operationId": "ApiVersions_Get", + "operationId": "ResourceGroups_Get", "tags": [ - "ApiVersions" + "ResourceGroups" ], - "description": "Get the specified API version.", + "description": "Get a resource group", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2508,38 +2618,20 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - }, - { - "name": "resourceTypeName", - "in": "path", - "description": "The resource type name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" - }, - { - "name": "apiVersionName", + "name": "resourceGroupName", "in": "path", - "description": "The API version name.", + "description": "The name of resource group", "required": true, "type": "string", "maxLength": 63, - "pattern": "^\\d{4}-\\d{2}-\\d{2}(-preview)?$" + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ApiVersionResource" + "$ref": "#/definitions/ResourceGroupResource" } }, "default": { @@ -2550,17 +2642,17 @@ } }, "x-ms-examples": { - "Get an api version defined by a resource type supported by a resource provider.": { - "$ref": "./examples/ApiVersions_Get.json" + "Get a resource group": { + "$ref": "./examples/ResourceGroups_Get.json" } } }, "put": { - "operationId": "ApiVersions_CreateOrUpdate", + "operationId": "ResourceGroups_CreateOrUpdate", "tags": [ - "ApiVersions" + "ResourceGroups" ], - "description": "Create or update an API version.", + "description": "Create or update a resource group", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2575,31 +2667,13 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - }, - { - "name": "resourceTypeName", - "in": "path", - "description": "The resource type name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" - }, - { - "name": "apiVersionName", + "name": "resourceGroupName", "in": "path", - "description": "The API version name.", + "description": "The name of resource group", "required": true, "type": "string", "maxLength": 63, - "pattern": "^\\d{4}-\\d{2}-\\d{2}(-preview)?$" + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { "name": "resource", @@ -2607,28 +2681,21 @@ "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/ApiVersionResource" + "$ref": "#/definitions/ResourceGroupResource" } } ], "responses": { "200": { - "description": "Resource 'ApiVersionResource' update operation succeeded", + "description": "Resource 'ResourceGroupResource' update operation succeeded", "schema": { - "$ref": "#/definitions/ApiVersionResource" + "$ref": "#/definitions/ResourceGroupResource" } }, "201": { - "description": "Resource 'ApiVersionResource' create operation succeeded", + "description": "Resource 'ResourceGroupResource' create operation succeeded", "schema": { - "$ref": "#/definitions/ApiVersionResource" - }, - "headers": { - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } + "$ref": "#/definitions/ResourceGroupResource" } }, "default": { @@ -2639,21 +2706,17 @@ } }, "x-ms-examples": { - "Create or update an api version defined by a resource type supported by a resource provider.": { - "$ref": "./examples/ApiVersions_CreateOrUpdate.json" + "Create or update a resource group": { + "$ref": "./examples/ResourceGroups_CreateOrUpdate.json" } - }, - "x-ms-long-running-operation-options": { - "final-state-via": "azure-async-operation" - }, - "x-ms-long-running-operation": true + } }, - "delete": { - "operationId": "ApiVersions_Delete", + "patch": { + "operationId": "ResourceGroups_Update", "tags": [ - "ApiVersions" + "ResourceGroups" ], - "description": "Delete an API version.", + "description": "Update a resource group", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2668,54 +2731,31 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - }, - { - "name": "resourceTypeName", + "name": "resourceGroupName", "in": "path", - "description": "The resource type name.", + "description": "The name of resource group", "required": true, "type": "string", "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "apiVersionName", - "in": "path", - "description": "The API version name.", + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^\\d{4}-\\d{2}-\\d{2}(-preview)?$" + "schema": { + "$ref": "#/definitions/ResourceGroupResourceTagsUpdate" + } } ], "responses": { "200": { - "description": "Resource deleted successfully." - }, - "202": { - "description": "Resource deletion accepted.", - "headers": { - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." - }, - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/ResourceGroupResource" } }, - "204": { - "description": "Resource does not exist." - }, "default": { "description": "An unexpected error response.", "schema": { @@ -2724,23 +2764,17 @@ } }, "x-ms-examples": { - "Delete an api version of a resource type supported by a resource provider.": { - "$ref": "./examples/ApiVersions_Delete.json" + "Update a resource group": { + "$ref": "./examples/ResourceGroups_Update.json" } - }, - "x-ms-long-running-operation-options": { - "final-state-via": "location" - }, - "x-ms-long-running-operation": true - } - }, - "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}": { - "get": { - "operationId": "Resources_List", + } + }, + "delete": { + "operationId": "ResourceGroups_Delete", "tags": [ - "Resources" + "ResourceGroups" ], - "description": "List resources in a resource group", + "description": "Delete a resource group", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2766,10 +2800,10 @@ ], "responses": { "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/GenericResourceListResult" - } + "description": "Resource deleted successfully." + }, + "204": { + "description": "Resource does not exist." }, "default": { "description": "An unexpected error response.", @@ -2779,22 +2813,19 @@ } }, "x-ms-examples": { - "List resources in a resource group.": { - "$ref": "./examples/Resources_List.json" + "Delete a resource group": { + "$ref": "./examples/ResourceGroups_Delete.json" } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" } } }, - "/radius/{planeName}/providers": { + "/planes/radius/{planeName}/resourcegroups/radius/{planeName}": { "get": { - "operationId": "ResourceProviders_ListProviderSummaries", + "operationId": "ResourceGroups_List", "tags": [ - "ResourceProviders" + "ResourceGroups" ], - "description": "List resource provider summaries. The resource provider summary aggregates the most commonly used information including locations, api versions and resource types.", + "description": "List resource groups", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2811,9 +2842,9 @@ ], "responses": { "200": { - "description": "The request has succeeded.", + "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/PagedResourceProviderSummary" + "$ref": "#/definitions/ResourceGroupResourceListResult" } }, "default": { @@ -2824,65 +2855,14 @@ } }, "x-ms-examples": { - "List resource provider summaries. The resource provider summary aggregates common information about resource types, api versions, and locations.": { - "$ref": "./examples/ResourceProviders_ListProviderSummaries.json" + "List resource groups": { + "$ref": "./examples/ResourceGroups_List.json" } }, "x-ms-pageable": { "nextLinkName": "nextLink" } } - }, - "/radius/{planeName}/providers/{resourceProviderName}": { - "get": { - "operationId": "ResourceProviders_GetProviderSummary", - "tags": [ - "ResourceProviders" - ], - "description": "Get the specified resource provider summary. The resource provider summary aggregates the most commonly used information including locations, api versions and resource types.", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/ResourceProviderSummary" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Get a resoure provider summary. The resource provider summary aggregates common information about resource types, api versions, and locations.": { - "$ref": "./examples/ResourceProviders_GetProviderSummary.json" - } - } - } } }, "definitions": { diff --git a/typespec/UCP/aws-credentials.tsp b/typespec/UCP/aws-credentials.tsp index e4e198fb78..5d19412884 100644 --- a/typespec/UCP/aws-credentials.tsp +++ b/typespec/UCP/aws-credentials.tsp @@ -116,7 +116,7 @@ alias AwsCredentialBaseParameter = CredentialBaseParameters< @armResourceOperations interface AwsCredentials { @doc("List AWS credentials") - @route("GET /planes/aws") + @route("planes/aws") list is UcpResourceList< AwsCredentialResource, { @@ -126,28 +126,28 @@ interface AwsCredentials { >; @doc("Get an AWS credential") - @route("GET /planes/aws/{planeName}") + @route("planes/aws/{planeName}") get is UcpResourceRead< AwsCredentialResource, AwsCredentialBaseParameter >; @doc("Create or update an AWS credential") - @route("PUT /planes/aws/{planeName}") + @route("planes/aws/{planeName}") createOrUpdate is UcpResourceCreateOrUpdateSync< AwsCredentialResource, AwsCredentialBaseParameter >; @doc("Update an AWS credential") - @route("PATCH /planes/aws/{planeName}") + @route("planes/aws/{planeName}") update is UcpCustomPatchSync< AwsCredentialResource, AwsCredentialBaseParameter >; @doc("Delete an AWS credential") - @route("DELETE /planes/aws/{planeName}") + @route("planes/aws/{planeName}") delete is UcpResourceDeleteSync< AwsCredentialResource, AwsCredentialBaseParameter diff --git a/typespec/UCP/azure-credentials.tsp b/typespec/UCP/azure-credentials.tsp index d6e9c49dfc..e60b3e1c28 100644 --- a/typespec/UCP/azure-credentials.tsp +++ b/typespec/UCP/azure-credentials.tsp @@ -123,7 +123,7 @@ alias AzureCredentialBaseParameter = CredentialBaseParameters< @armResourceOperations interface AzureCredentials { @doc("List Azure credentials") - @route("GET /planes/azure") + @route("planes/azure") list is UcpResourceList< AzureCredentialResource, { @@ -133,7 +133,7 @@ interface AzureCredentials { >; @doc("Get an Azure credential") - @route("GET /planes/azure/{planeName}") + @route("planes/azure/{planeName}") get is UcpResourceRead< AzureCredentialResource, AzureCredentialBaseParameter diff --git a/typespec/UCP/resourcegroups.tsp b/typespec/UCP/resourcegroups.tsp index 85c140c966..1541cdaba6 100644 --- a/typespec/UCP/resourcegroups.tsp +++ b/typespec/UCP/resourcegroups.tsp @@ -76,35 +76,35 @@ model ResourceGroupBaseParameters { @armResourceOperations interface ResourceGroups { @doc("List resource groups") - @route("GET /planes/radius/{planeName}/resourcegroups") + @route("planes/radius/{planeName}/resourcegroups") list is UcpResourceList< ResourceGroupResource, PlaneBaseParameters >; @doc("Get a resource group") - @route("GET /planes/radius/{planeName}/resourcegroups/{resourceGroupName}") + @route("planes/radius/{planeName}/resourcegroups/{resourceGroupName}") get is UcpResourceRead< ResourceGroupResource, ResourceGroupBaseParameters >; @doc("Create or update a resource group") - @route("PUT /planes/radius/{planeName}/resourcegroups/{resourceGroupName}") + @route("planes/radius/{planeName}/resourcegroups/{resourceGroupName}") createOrUpdate is UcpResourceCreateOrUpdateSync< ResourceGroupResource, ResourceGroupBaseParameters >; @doc("Update a resource group") - @route("PATCH /planes/radius/{planeName}/resourcegroups/{resourceGroupName}") + @route("planes/radius/{planeName}/resourcegroups/{resourceGroupName}") update is UcpCustomPatchSync< ResourceGroupResource, ResourceGroupBaseParameters >; @doc("Delete a resource group") - @route("DELETE /planes/radius/{planeName}/resourcegroups/{resourceGroupName}") + @route("planes/radius/{planeName}/resourcegroups/{resourceGroupName}") delete is UcpResourceDeleteSync< ResourceGroupResource, ResourceGroupBaseParameters diff --git a/typespec/UCP/resourceproviders.tsp b/typespec/UCP/resourceproviders.tsp index 26a904ce7b..99c863dcda 100644 --- a/typespec/UCP/resourceproviders.tsp +++ b/typespec/UCP/resourceproviders.tsp @@ -198,31 +198,33 @@ model LocationBaseParameters { ...KeysOf; } + +@route("/planes") @armResourceOperations interface ResourceProviders { @doc("List resource providers.") - @route("GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders") + @route("/planes/radius/{planeName}/providers/System.Resources/resourceproviders") list is UcpResourceList< ResourceProviderResource, PlaneBaseParameters >; @doc("Get the specified resource provider.") - @route("GET /planes/{resourceProviderName}") + //@route("planes/{resourceProviderName}") get is UcpResourceRead< ResourceProviderResource, ResourceProviderBaseParameters >; @doc("Create or update a resource provider") - @route("PUT /planes/{resourceProviderName}") + //@route("planes/{resourceProviderName}") createOrUpdate is UcpResourceCreateOrUpdateAsync< ResourceProviderResource, ResourceProviderBaseParameters >; @doc("Delete a resource provider") - @route("DELETE /planes/{resourceProviderName}") + //@route("planes/{resourceProviderName}") delete is UcpResourceDeleteAsync< ResourceProviderResource, ResourceProviderBaseParameters @@ -248,28 +250,28 @@ interface ResourceProviders { @armResourceOperations interface ResourceTypes { @doc("List resource types.") - @route("GET /planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes") + @route("planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes") list is UcpResourceList< ResourceTypeResource, ResourceProviderBaseParameters >; @doc("Get the specified resource type.") - @route("GET /planes/{resourceTypeName}") + @route("planes/{resourceTypeName}") get is UcpResourceRead< ResourceTypeResource, ResourceTypeBaseParameters >; @doc("Create or update a resource type") - @route("PUT /planes/{resourceTypeName}") + @route("planes/{resourceTypeName}") createOrUpdate is UcpResourceCreateOrUpdateAsync< ResourceTypeResource, ResourceTypeBaseParameters >; @doc("Delete a resource type") - @route("DELETE /planes/{resourceTypeName}") + @route("planes/{resourceTypeName}") delete is UcpResourceDeleteAsync< ResourceTypeResource, ResourceTypeBaseParameters @@ -308,6 +310,7 @@ interface ApiVersions { @armResourceOperations interface Locations { @doc("List available locations for the specified resource provider.") + @route("planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations") list is UcpResourceList< LocationResource, ResourceProviderBaseParameters diff --git a/typespec/UCP/ucp-operations.tsp b/typespec/UCP/ucp-operations.tsp index 4ad89f1cfd..f39533e98a 100644 --- a/typespec/UCP/ucp-operations.tsp +++ b/typespec/UCP/ucp-operations.tsp @@ -34,7 +34,6 @@ using OpenAPI; @get @autoRoute @doc("List {name}", Azure.ResourceManager.CommonTypes.Resource) -@segmentOf(Azure.ResourceManager.CommonTypes.Resource) @armResourceList(Azure.ResourceManager.CommonTypes.Resource) op UcpResourceList< ResourceType extends Azure.ResourceManager.CommonTypes.Resource, @@ -43,7 +42,7 @@ op UcpResourceList< ...ParentKeysOf, ): ArmResponse> | ErrorResponse; -#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-xoutside-interface" @autoRoute @doc("Get a {name}", Resource) @get From 87326d6bccfd2e8b11ac09b853fb935225e93d53 Mon Sep 17 00:00:00 2001 From: lakshmimsft Date: Thu, 7 Nov 2024 19:13:31 -0800 Subject: [PATCH 5/9] updating datastoresrp Signed-off-by: lakshmimsft --- pkg/datastoresrp/api/README.md | 3 +- .../fake/zz_generated_internal.go | 66 + .../zz_generated_mongodatabases_server.go | 353 +++++ .../fake/zz_generated_operations_server.go | 118 ++ .../fake/zz_generated_rediscaches_server.go | 353 +++++ .../fake/zz_generated_server_factory.go | 94 ++ .../fake/zz_generated_sqldatabases_server.go | 353 +++++ .../fake/zz_generated_time_rfc3339.go | 114 ++ .../zz_generated_client_factory.go | 39 +- .../zz_generated_constants.go | 29 +- .../zz_generated_interfaces.go | 3 - .../v20231001preview/zz_generated_models.go | 311 +++-- .../zz_generated_models_serde.go | 13 +- .../zz_generated_mongodatabases_client.go | 81 +- .../zz_generated_operations_client.go | 30 +- .../v20231001preview/zz_generated_options.go | 21 +- .../zz_generated_polymorphic_helpers.go | 5 +- .../zz_generated_rediscaches_client.go | 81 +- ...nse_types.go => zz_generated_responses.go} | 35 +- .../zz_generated_sqldatabases_client.go | 81 +- .../zz_generated_time_rfc3339.go | 76 +- .../zz_generated_apiversions_client.go | 2 +- .../zz_generated_awscredentials_client.go | 10 +- .../zz_generated_azurecredentials_client.go | 4 +- .../zz_generated_locations_client.go | 2 +- .../zz_generated_planes_client.go | 3 +- .../zz_generated_resourcegroups_client.go | 10 +- .../zz_generated_resourceproviders_client.go | 2 +- .../zz_generated_resources_client.go | 2 +- .../zz_generated_resourcetypes_client.go | 8 +- .../preview/2023-10-01-preview/openapi.json | 1196 ++++++++--------- typespec/UCP/aws-credentials.tsp | 9 +- typespec/UCP/azure-credentials.tsp | 6 +- typespec/UCP/common.tsp | 4 +- typespec/UCP/planes.tsp | 4 +- typespec/UCP/resourcegroups.tsp | 10 +- typespec/UCP/resourceproviders.tsp | 27 +- typespec/UCP/ucp-operations.tsp | 76 +- typespec/radius/v1/ucprootscope.tsp | 2 +- 39 files changed, 2566 insertions(+), 1070 deletions(-) create mode 100644 pkg/datastoresrp/api/v20231001preview/fake/zz_generated_internal.go create mode 100644 pkg/datastoresrp/api/v20231001preview/fake/zz_generated_mongodatabases_server.go create mode 100644 pkg/datastoresrp/api/v20231001preview/fake/zz_generated_operations_server.go create mode 100644 pkg/datastoresrp/api/v20231001preview/fake/zz_generated_rediscaches_server.go create mode 100644 pkg/datastoresrp/api/v20231001preview/fake/zz_generated_server_factory.go create mode 100644 pkg/datastoresrp/api/v20231001preview/fake/zz_generated_sqldatabases_server.go create mode 100644 pkg/datastoresrp/api/v20231001preview/fake/zz_generated_time_rfc3339.go rename pkg/datastoresrp/api/v20231001preview/{zz_generated_response_types.go => zz_generated_responses.go} (82%) diff --git a/pkg/datastoresrp/api/README.md b/pkg/datastoresrp/api/README.md index 462b8cd415..754c8ff045 100644 --- a/pkg/datastoresrp/api/README.md +++ b/pkg/datastoresrp/api/README.md @@ -44,7 +44,8 @@ The following configuration generates track2 go models and client. ```yaml $(tag) != '' version: 3.*.* -use: "@autorest/go@4.0.0-preview.55" +use: "@autorest/go@4.0.0-preview.69" +module: "github.com/radius-project/radius/pkg/datastoresrp/api" module-version: 0.0.1 file-prefix: zz_generated_ license-header: "Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information.\nCode generated by Microsoft (R) AutoRest Code Generator.\nChanges may cause incorrect behavior and will be lost if the code is regenerated." diff --git a/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_internal.go b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_internal.go new file mode 100644 index 0000000000..0c62457a83 --- /dev/null +++ b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_internal.go @@ -0,0 +1,66 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_mongodatabases_server.go b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_mongodatabases_server.go new file mode 100644 index 0000000000..ce5402d9c9 --- /dev/null +++ b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_mongodatabases_server.go @@ -0,0 +1,353 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/datastoresrp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// MongoDatabasesServer is a fake server for instances of the v20231001preview.MongoDatabasesClient type. +type MongoDatabasesServer struct{ + // BeginCreateOrUpdate is the fake for method MongoDatabasesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, mongoDatabaseName string, resource v20231001preview.MongoDatabaseResource, options *v20231001preview.MongoDatabasesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.MongoDatabasesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method MongoDatabasesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, mongoDatabaseName string, options *v20231001preview.MongoDatabasesClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.MongoDatabasesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method MongoDatabasesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, mongoDatabaseName string, options *v20231001preview.MongoDatabasesClientGetOptions) (resp azfake.Responder[v20231001preview.MongoDatabasesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method MongoDatabasesClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.MongoDatabasesClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.MongoDatabasesClientListByScopeResponse]) + + // ListSecrets is the fake for method MongoDatabasesClient.ListSecrets + // HTTP status codes to indicate success: http.StatusOK + ListSecrets func(ctx context.Context, mongoDatabaseName string, body map[string]any, options *v20231001preview.MongoDatabasesClientListSecretsOptions) (resp azfake.Responder[v20231001preview.MongoDatabasesClientListSecretsResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method MongoDatabasesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, mongoDatabaseName string, properties v20231001preview.MongoDatabaseResourceUpdate, options *v20231001preview.MongoDatabasesClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.MongoDatabasesClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewMongoDatabasesServerTransport creates a new instance of MongoDatabasesServerTransport with the provided implementation. +// The returned MongoDatabasesServerTransport instance is connected to an instance of v20231001preview.MongoDatabasesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMongoDatabasesServerTransport(srv *MongoDatabasesServer) *MongoDatabasesServerTransport { + return &MongoDatabasesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.MongoDatabasesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.MongoDatabasesClientDeleteResponse]](), + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.MongoDatabasesClientListByScopeResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.MongoDatabasesClientUpdateResponse]](), + } +} + +// MongoDatabasesServerTransport connects instances of v20231001preview.MongoDatabasesClient to instances of MongoDatabasesServer. +// Don't use this type directly, use NewMongoDatabasesServerTransport instead. +type MongoDatabasesServerTransport struct { + srv *MongoDatabasesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.MongoDatabasesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.MongoDatabasesClientDeleteResponse]] + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.MongoDatabasesClientListByScopeResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.MongoDatabasesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for MongoDatabasesServerTransport. +func (m *MongoDatabasesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return m.dispatchToMethodFake(req, method) +} + +func (m *MongoDatabasesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if mongoDatabasesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = mongoDatabasesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MongoDatabasesClient.BeginCreateOrUpdate": + res.resp, res.err = m.dispatchBeginCreateOrUpdate(req) + case "MongoDatabasesClient.BeginDelete": + res.resp, res.err = m.dispatchBeginDelete(req) + case "MongoDatabasesClient.Get": + res.resp, res.err = m.dispatchGet(req) + case "MongoDatabasesClient.NewListByScopePager": + res.resp, res.err = m.dispatchNewListByScopePager(req) + case "MongoDatabasesClient.ListSecrets": + res.resp, res.err = m.dispatchListSecrets(req) + case "MongoDatabasesClient.BeginUpdate": + res.resp, res.err = m.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (m *MongoDatabasesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if m.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := m.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/mongoDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.MongoDatabaseResource](req) + if err != nil { + return nil, err + } + mongoDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoDatabaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginCreateOrUpdate(req.Context(), mongoDatabaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + m.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + m.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + m.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (m *MongoDatabasesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if m.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := m.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/mongoDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + mongoDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoDatabaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginDelete(req.Context(), mongoDatabaseNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + m.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + m.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + m.beginDelete.remove(req) + } + + return resp, nil +} + +func (m *MongoDatabasesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/mongoDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + mongoDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoDatabaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), mongoDatabaseNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MongoDatabaseResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MongoDatabasesServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if m.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := m.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/mongoDatabases` + 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 := m.srv.NewListByScopePager(nil) + newListByScopePager = &resp + m.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.MongoDatabasesClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + m.newListByScopePager.remove(req) + } + return resp, nil +} + +func (m *MongoDatabasesServerTransport) dispatchListSecrets(req *http.Request) (*http.Response, error) { + if m.srv.ListSecrets == nil { + return nil, &nonRetriableError{errors.New("fake for method ListSecrets not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/mongoDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listSecrets` + 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) + } + body, err := server.UnmarshalRequestAsJSON[map[string]any](req) + if err != nil { + return nil, err + } + mongoDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoDatabaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.ListSecrets(req.Context(), mongoDatabaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MongoDatabaseListSecretsResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MongoDatabasesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if m.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := m.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/mongoDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.MongoDatabaseResourceUpdate](req) + if err != nil { + return nil, err + } + mongoDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("mongoDatabaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.BeginUpdate(req.Context(), mongoDatabaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + m.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + m.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + m.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to MongoDatabasesServerTransport +var mongoDatabasesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_operations_server.go b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_operations_server.go new file mode 100644 index 0000000000..f535e3d1d5 --- /dev/null +++ b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_operations_server.go @@ -0,0 +1,118 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + 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/radius-project/radius/pkg/datastoresrp/api/v20231001preview" + "net/http" +) + +// OperationsServer is a fake server for instances of the v20231001preview.OperationsClient type. +type OperationsServer struct{ + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *v20231001preview.OperationsClientListOptions) (resp azfake.PagerResponder[v20231001preview.OperationsClientListResponse]) + +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of v20231001preview.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[v20231001preview.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of v20231001preview.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[v20231001preview.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { +resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_rediscaches_server.go b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_rediscaches_server.go new file mode 100644 index 0000000000..1505a738be --- /dev/null +++ b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_rediscaches_server.go @@ -0,0 +1,353 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/datastoresrp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// RedisCachesServer is a fake server for instances of the v20231001preview.RedisCachesClient type. +type RedisCachesServer struct{ + // BeginCreateOrUpdate is the fake for method RedisCachesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, redisCacheName string, resource v20231001preview.RedisCacheResource, options *v20231001preview.RedisCachesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.RedisCachesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method RedisCachesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, redisCacheName string, options *v20231001preview.RedisCachesClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.RedisCachesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method RedisCachesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, redisCacheName string, options *v20231001preview.RedisCachesClientGetOptions) (resp azfake.Responder[v20231001preview.RedisCachesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method RedisCachesClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.RedisCachesClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.RedisCachesClientListByScopeResponse]) + + // ListSecrets is the fake for method RedisCachesClient.ListSecrets + // HTTP status codes to indicate success: http.StatusOK + ListSecrets func(ctx context.Context, redisCacheName string, body map[string]any, options *v20231001preview.RedisCachesClientListSecretsOptions) (resp azfake.Responder[v20231001preview.RedisCachesClientListSecretsResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method RedisCachesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, redisCacheName string, properties v20231001preview.RedisCacheResourceUpdate, options *v20231001preview.RedisCachesClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.RedisCachesClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewRedisCachesServerTransport creates a new instance of RedisCachesServerTransport with the provided implementation. +// The returned RedisCachesServerTransport instance is connected to an instance of v20231001preview.RedisCachesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewRedisCachesServerTransport(srv *RedisCachesServer) *RedisCachesServerTransport { + return &RedisCachesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.RedisCachesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.RedisCachesClientDeleteResponse]](), + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.RedisCachesClientListByScopeResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.RedisCachesClientUpdateResponse]](), + } +} + +// RedisCachesServerTransport connects instances of v20231001preview.RedisCachesClient to instances of RedisCachesServer. +// Don't use this type directly, use NewRedisCachesServerTransport instead. +type RedisCachesServerTransport struct { + srv *RedisCachesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.RedisCachesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.RedisCachesClientDeleteResponse]] + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.RedisCachesClientListByScopeResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.RedisCachesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for RedisCachesServerTransport. +func (r *RedisCachesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return r.dispatchToMethodFake(req, method) +} + +func (r *RedisCachesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if redisCachesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = redisCachesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RedisCachesClient.BeginCreateOrUpdate": + res.resp, res.err = r.dispatchBeginCreateOrUpdate(req) + case "RedisCachesClient.BeginDelete": + res.resp, res.err = r.dispatchBeginDelete(req) + case "RedisCachesClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RedisCachesClient.NewListByScopePager": + res.resp, res.err = r.dispatchNewListByScopePager(req) + case "RedisCachesClient.ListSecrets": + res.resp, res.err = r.dispatchListSecrets(req) + case "RedisCachesClient.BeginUpdate": + res.resp, res.err = r.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (r *RedisCachesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := r.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/redisCaches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.RedisCacheResource](req) + if err != nil { + return nil, err + } + redisCacheNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("redisCacheName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginCreateOrUpdate(req.Context(), redisCacheNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + r.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + r.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + r.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (r *RedisCachesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if r.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := r.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/redisCaches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + redisCacheNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("redisCacheName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginDelete(req.Context(), redisCacheNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + r.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + r.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + r.beginDelete.remove(req) + } + + return resp, nil +} + +func (r *RedisCachesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if r.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/redisCaches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + redisCacheNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("redisCacheName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Get(req.Context(), redisCacheNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RedisCacheResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *RedisCachesServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if r.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := r.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/redisCaches` + 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 := r.srv.NewListByScopePager(nil) + newListByScopePager = &resp + r.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.RedisCachesClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + r.newListByScopePager.remove(req) + } + return resp, nil +} + +func (r *RedisCachesServerTransport) dispatchListSecrets(req *http.Request) (*http.Response, error) { + if r.srv.ListSecrets == nil { + return nil, &nonRetriableError{errors.New("fake for method ListSecrets not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/redisCaches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listSecrets` + 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) + } + body, err := server.UnmarshalRequestAsJSON[map[string]any](req) + if err != nil { + return nil, err + } + redisCacheNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("redisCacheName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.ListSecrets(req.Context(), redisCacheNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RedisCacheListSecretsResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *RedisCachesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := r.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/redisCaches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.RedisCacheResourceUpdate](req) + if err != nil { + return nil, err + } + redisCacheNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("redisCacheName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginUpdate(req.Context(), redisCacheNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + r.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + r.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + r.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to RedisCachesServerTransport +var redisCachesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_server_factory.go b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_server_factory.go new file mode 100644 index 0000000000..1d335be1ff --- /dev/null +++ b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_server_factory.go @@ -0,0 +1,94 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the v20231001preview.ClientFactory type. +type ServerFactory struct { + // MongoDatabasesServer contains the fakes for client MongoDatabasesClient + MongoDatabasesServer MongoDatabasesServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // RedisCachesServer contains the fakes for client RedisCachesClient + RedisCachesServer RedisCachesServer + + // SQLDatabasesServer contains the fakes for client SQLDatabasesClient + SQLDatabasesServer SQLDatabasesServer + +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of v20231001preview.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of v20231001preview.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trMongoDatabasesServer *MongoDatabasesServerTransport + trOperationsServer *OperationsServerTransport + trRedisCachesServer *RedisCachesServerTransport + trSQLDatabasesServer *SQLDatabasesServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "MongoDatabasesClient": + initServer(s, &s.trMongoDatabasesServer, func() *MongoDatabasesServerTransport { return NewMongoDatabasesServerTransport(&s.srv.MongoDatabasesServer) }) + resp, err = s.trMongoDatabasesServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "RedisCachesClient": + initServer(s, &s.trRedisCachesServer, func() *RedisCachesServerTransport { return NewRedisCachesServerTransport(&s.srv.RedisCachesServer) }) + resp, err = s.trRedisCachesServer.Do(req) + case "SQLDatabasesClient": + initServer(s, &s.trSQLDatabasesServer, func() *SQLDatabasesServerTransport { return NewSQLDatabasesServerTransport(&s.srv.SQLDatabasesServer) }) + resp, err = s.trSQLDatabasesServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_sqldatabases_server.go b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_sqldatabases_server.go new file mode 100644 index 0000000000..ee0ec3d6a1 --- /dev/null +++ b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_sqldatabases_server.go @@ -0,0 +1,353 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/datastoresrp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// SQLDatabasesServer is a fake server for instances of the v20231001preview.SQLDatabasesClient type. +type SQLDatabasesServer struct{ + // BeginCreateOrUpdate is the fake for method SQLDatabasesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, sqlDatabaseName string, resource v20231001preview.SQLDatabaseResource, options *v20231001preview.SQLDatabasesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.SQLDatabasesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SQLDatabasesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, sqlDatabaseName string, options *v20231001preview.SQLDatabasesClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.SQLDatabasesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SQLDatabasesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, sqlDatabaseName string, options *v20231001preview.SQLDatabasesClientGetOptions) (resp azfake.Responder[v20231001preview.SQLDatabasesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method SQLDatabasesClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.SQLDatabasesClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.SQLDatabasesClientListByScopeResponse]) + + // ListSecrets is the fake for method SQLDatabasesClient.ListSecrets + // HTTP status codes to indicate success: http.StatusOK + ListSecrets func(ctx context.Context, sqlDatabaseName string, body map[string]any, options *v20231001preview.SQLDatabasesClientListSecretsOptions) (resp azfake.Responder[v20231001preview.SQLDatabasesClientListSecretsResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method SQLDatabasesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, sqlDatabaseName string, properties v20231001preview.SQLDatabaseResourceUpdate, options *v20231001preview.SQLDatabasesClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.SQLDatabasesClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewSQLDatabasesServerTransport creates a new instance of SQLDatabasesServerTransport with the provided implementation. +// The returned SQLDatabasesServerTransport instance is connected to an instance of v20231001preview.SQLDatabasesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSQLDatabasesServerTransport(srv *SQLDatabasesServer) *SQLDatabasesServerTransport { + return &SQLDatabasesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.SQLDatabasesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.SQLDatabasesClientDeleteResponse]](), + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.SQLDatabasesClientListByScopeResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.SQLDatabasesClientUpdateResponse]](), + } +} + +// SQLDatabasesServerTransport connects instances of v20231001preview.SQLDatabasesClient to instances of SQLDatabasesServer. +// Don't use this type directly, use NewSQLDatabasesServerTransport instead. +type SQLDatabasesServerTransport struct { + srv *SQLDatabasesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.SQLDatabasesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.SQLDatabasesClientDeleteResponse]] + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.SQLDatabasesClientListByScopeResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.SQLDatabasesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for SQLDatabasesServerTransport. +func (s *SQLDatabasesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *SQLDatabasesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if sqlDatabasesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sqlDatabasesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SQLDatabasesClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "SQLDatabasesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SQLDatabasesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SQLDatabasesClient.NewListByScopePager": + res.resp, res.err = s.dispatchNewListByScopePager(req) + case "SQLDatabasesClient.ListSecrets": + res.resp, res.err = s.dispatchListSecrets(req) + case "SQLDatabasesClient.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SQLDatabasesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/sqlDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.SQLDatabaseResource](req) + if err != nil { + return nil, err + } + sqlDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlDatabaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), sqlDatabaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SQLDatabasesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/sqlDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + sqlDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlDatabaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), sqlDatabaseNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + s.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SQLDatabasesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/sqlDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + sqlDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlDatabaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), sqlDatabaseNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLDatabaseResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLDatabasesServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := s.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/sqlDatabases` + 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 := s.srv.NewListByScopePager(nil) + newListByScopePager = &resp + s.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.SQLDatabasesClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + s.newListByScopePager.remove(req) + } + return resp, nil +} + +func (s *SQLDatabasesServerTransport) dispatchListSecrets(req *http.Request) (*http.Response, error) { + if s.srv.ListSecrets == nil { + return nil, &nonRetriableError{errors.New("fake for method ListSecrets not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/sqlDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listSecrets` + 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) + } + body, err := server.UnmarshalRequestAsJSON[map[string]any](req) + if err != nil { + return nil, err + } + sqlDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlDatabaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.ListSecrets(req.Context(), sqlDatabaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLDatabaseListSecretsResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLDatabasesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := s.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Datastores/sqlDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.SQLDatabaseResourceUpdate](req) + if err != nil { + return nil, err + } + sqlDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sqlDatabaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdate(req.Context(), sqlDatabaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + s.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + s.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to SQLDatabasesServerTransport +var sqlDatabasesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_time_rfc3339.go b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_time_rfc3339.go new file mode 100644 index 0000000000..83c75cddc6 --- /dev/null +++ b/pkg/datastoresrp/api/v20231001preview/fake/zz_generated_time_rfc3339.go @@ -0,0 +1,114 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + + + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + + + +// 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+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +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 + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_client_factory.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_client_factory.go index 9768965460..23f70c1eaa 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_client_factory.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_client_factory.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -16,8 +13,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { rootScope string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -28,33 +24,44 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - rootScope: rootScope, credential: credential, - options: options.Clone(), + rootScope: rootScope, + internal: internal, }, nil } +// NewMongoDatabasesClient creates a new instance of MongoDatabasesClient. func (c *ClientFactory) NewMongoDatabasesClient() *MongoDatabasesClient { - subClient, _ := NewMongoDatabasesClient(c.rootScope, c.credential, c.options) - return subClient + return &MongoDatabasesClient{ + rootScope: c.rootScope, + internal: c.internal, + } } +// NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } +// NewRedisCachesClient creates a new instance of RedisCachesClient. func (c *ClientFactory) NewRedisCachesClient() *RedisCachesClient { - subClient, _ := NewRedisCachesClient(c.rootScope, c.credential, c.options) - return subClient + return &RedisCachesClient{ + rootScope: c.rootScope, + internal: c.internal, + } } +// NewSQLDatabasesClient creates a new instance of SQLDatabasesClient. func (c *ClientFactory) NewSQLDatabasesClient() *SQLDatabasesClient { - subClient, _ := NewSQLDatabasesClient(c.rootScope, c.credential, c.options) - return subClient + return &SQLDatabasesClient{ + rootScope: c.rootScope, + internal: c.internal, + } } diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_constants.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_constants.go index dee57fba78..28c7d1dbff 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_constants.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_constants.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -8,7 +5,7 @@ package v20231001preview const ( - moduleName = "v20231001preview" + moduleName = "github.com/radius-project/radius/pkg/datastoresrp/api" moduleVersion = "v0.0.1" ) @@ -50,9 +47,9 @@ func PossibleCreatedByTypeValues() []CreatedByType { type IdentitySettingKind string const ( - // IdentitySettingKindAzureComWorkload - azure ad workload identity +// IdentitySettingKindAzureComWorkload - azure ad workload identity IdentitySettingKindAzureComWorkload IdentitySettingKind = "azure.com.workload" - // IdentitySettingKindUndefined - undefined identity +// IdentitySettingKindUndefined - undefined identity IdentitySettingKindUndefined IdentitySettingKind = "undefined" ) @@ -87,21 +84,21 @@ func PossibleOriginValues() []Origin { type ProvisioningState string const ( - // ProvisioningStateAccepted - The resource create request has been accepted +// ProvisioningStateAccepted - The resource create request has been accepted ProvisioningStateAccepted ProvisioningState = "Accepted" - // ProvisioningStateCanceled - The resource provisioning has been canceled +// ProvisioningStateCanceled - The resource provisioning has been canceled ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreating - The resource is being created +// ProvisioningStateCreating - The resource is being created ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting - The resource is being deleted +// ProvisioningStateDeleting - The resource is being deleted ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed - The resource provisioning has failed +// ProvisioningStateFailed - The resource provisioning has failed ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateProvisioning - The resource is being provisioned +// ProvisioningStateProvisioning - The resource is being provisioned ProvisioningStateProvisioning ProvisioningState = "Provisioning" - // ProvisioningStateSucceeded - The resource has been successfully provisioned +// ProvisioningStateSucceeded - The resource has been successfully provisioned ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating - The resource is being updated +// ProvisioningStateUpdating - The resource is being updated ProvisioningStateUpdating ProvisioningState = "Updating" ) @@ -125,9 +122,9 @@ func PossibleProvisioningStateValues() []ProvisioningState { type ResourceProvisioning string const ( - // ResourceProvisioningManual - The resource lifecycle will be managed by the user +// ResourceProvisioningManual - The resource lifecycle will be managed by the user ResourceProvisioningManual ResourceProvisioning = "manual" - // ResourceProvisioningRecipe - The resource lifecycle will be managed by Radius +// ResourceProvisioningRecipe - The resource lifecycle will be managed by Radius ResourceProvisioningRecipe ResourceProvisioning = "recipe" ) diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_interfaces.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_interfaces.go index ff4b623cae..dd034e311a 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_interfaces.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_interfaces.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_models.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_models.go index 824d753f90..9d75cb3319 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_models.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_models.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -12,31 +9,31 @@ import "time" // AzureResourceManagerCommonTypesTrackedResourceUpdate - The resource model definition for an Azure Resource Manager tracked // top level resource which has 'tags' and a 'location' type AzureResourceManagerCommonTypesTrackedResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // EnvironmentCompute - Represents backing compute resource type EnvironmentCompute struct { - // REQUIRED; Discriminator property for EnvironmentCompute. +// REQUIRED; Discriminator property for EnvironmentCompute. Kind *string - // Configuration for supported external identity providers +// Configuration for supported external identity providers Identity *IdentitySettings - // The resource id of the compute resource for application environment. +// The resource id of the compute resource for application environment. ResourceID *string } @@ -45,62 +42,62 @@ func (e *EnvironmentCompute) GetEnvironmentCompute() *EnvironmentCompute { retur // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. +// READ-ONLY; The additional info. Info map[string]any - // READ-ONLY; The additional info type. +// READ-ONLY; The additional info type. Type *string } // ErrorDetail - The error detail. type ErrorDetail struct { - // READ-ONLY; The error additional info. +// READ-ONLY; The error additional info. AdditionalInfo []*ErrorAdditionalInfo - // READ-ONLY; The error code. +// READ-ONLY; The error code. Code *string - // READ-ONLY; The error details. +// READ-ONLY; The error details. Details []*ErrorDetail - // READ-ONLY; The error message. +// READ-ONLY; The error message. Message *string - // READ-ONLY; The error target. +// READ-ONLY; The error target. Target *string } // ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. // (This also follows the OData error response format.). type ErrorResponse struct { - // The error object. +// The error object. Error *ErrorDetail } // IdentitySettings is the external identity setting. type IdentitySettings struct { - // REQUIRED; kind of identity setting +// REQUIRED; kind of identity setting Kind *IdentitySettingKind - // The URI for your compute platform's OIDC issuer +// The URI for your compute platform's OIDC issuer OidcIssuer *string - // The resource ID of the provisioned identity +// The resource ID of the provisioned identity Resource *string } // KubernetesCompute - The Kubernetes compute configuration type KubernetesCompute struct { - // REQUIRED; Discriminator property for EnvironmentCompute. +// REQUIRED; Discriminator property for EnvironmentCompute. Kind *string - // REQUIRED; The namespace to use for the environment. +// REQUIRED; The namespace to use for the environment. Namespace *string - // Configuration for supported external identity providers +// Configuration for supported external identity providers Identity *IdentitySettings - // The resource id of the compute resource for application environment. +// The resource id of the compute resource for application environment. ResourceID *string } @@ -115,147 +112,147 @@ func (k *KubernetesCompute) GetEnvironmentCompute() *EnvironmentCompute { // MongoDatabaseListSecretsResult - The secret values for the given MongoDatabase resource type MongoDatabaseListSecretsResult struct { - // Connection string used to connect to the target Mongo database +// Connection string used to connect to the target Mongo database ConnectionString *string - // Password to use when connecting to the target Mongo database +// Password to use when connecting to the target Mongo database Password *string } // MongoDatabaseProperties - MongoDatabase portable resource properties type MongoDatabaseProperties struct { - // REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to +// REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to Environment *string - // Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) +// Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) Application *string - // Database name of the target Mongo database +// Database name of the target Mongo database Database *string - // Host name of the target Mongo database +// Host name of the target Mongo database Host *string - // Port value of the target Mongo database +// Port value of the target Mongo database Port *int32 - // The recipe used to automatically deploy underlying infrastructure for the resource +// The recipe used to automatically deploy underlying infrastructure for the resource Recipe *Recipe - // Specifies how the underlying service/resource is provisioned and managed. +// Specifies how the underlying service/resource is provisioned and managed. ResourceProvisioning *ResourceProvisioning - // List of the resource IDs that support the MongoDB resource +// List of the resource IDs that support the MongoDB resource Resources []*ResourceReference - // Secret values provided for the resource +// Secret values provided for the resource Secrets *MongoDatabaseSecrets - // Username to use when connecting to the target Mongo database +// Username to use when connecting to the target Mongo database Username *string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } // MongoDatabaseResource - MongoDatabase portable resource type MongoDatabaseResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *MongoDatabaseProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // MongoDatabaseResourceListResult - The response of a MongoDatabaseResource list operation. type MongoDatabaseResourceListResult struct { - // REQUIRED; The MongoDatabaseResource items on this page +// REQUIRED; The MongoDatabaseResource items on this page Value []*MongoDatabaseResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // MongoDatabaseResourceUpdate - MongoDatabase portable resource type MongoDatabaseResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // MongoDatabaseSecrets - The secret values for the given MongoDatabase resource type MongoDatabaseSecrets struct { - // Connection string used to connect to the target Mongo database +// Connection string used to connect to the target Mongo database ConnectionString *string - // Password to use when connecting to the target Mongo database +// Password to use when connecting to the target Mongo database Password *string } // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // Localized display information for this particular operation. +// Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +// READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane +// READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane // operations. IsDataAction *bool - // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", +// READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", // "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 +// READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default // value is "user,system" Origin *Origin } // OperationDisplay - Localized display information for this particular operation. type OperationDisplay struct { - // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. +// READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual +// READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual // Machine", "Restart Virtual Machine". Operation *string - // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft +// READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft // Compute". Provider *string - // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job +// READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job // Schedule Collections". Resource *string } @@ -263,343 +260,343 @@ type OperationDisplay struct { // OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to // get the next set of results. type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). +// READ-ONLY; URL to get the next set of operation list results (if there are any). NextLink *string - // READ-ONLY; List of operations supported by the resource provider +// READ-ONLY; List of operations supported by the resource provider Value []*Operation } // OutputResource - Properties of an output resource. type OutputResource struct { - // The UCP resource ID of the underlying resource. +// The UCP resource ID of the underlying resource. ID *string - // The logical identifier scoped to the owning Radius resource. This is only needed or used when a resource has a dependency +// The logical identifier scoped to the owning Radius resource. This is only needed or used when a resource has a dependency // relationship. LocalIDs do not have any particular format or meaning beyond // being compared to determine dependency relationships. LocalID *string - // Determines whether Radius manages the lifecycle of the underlying resource. +// Determines whether Radius manages the lifecycle of the underlying resource. RadiusManaged *bool } // Recipe - The recipe used to automatically deploy underlying infrastructure for a portable resource type Recipe struct { - // REQUIRED; The name of the recipe within the environment to use +// REQUIRED; The name of the recipe within the environment to use Name *string - // Key/value parameters to pass into the recipe at deployment +// Key/value parameters to pass into the recipe at deployment Parameters map[string]any } // RecipeStatus - Recipe status at deployment time for a resource. type RecipeStatus struct { - // REQUIRED; TemplateKind is the kind of the recipe template used by the portable resource upon deployment. +// REQUIRED; TemplateKind is the kind of the recipe template used by the portable resource upon deployment. TemplateKind *string - // REQUIRED; TemplatePath is the path of the recipe consumed by the portable resource upon deployment. +// REQUIRED; TemplatePath is the path of the recipe consumed by the portable resource upon deployment. TemplatePath *string - // TemplateVersion is the version number of the template. +// TemplateVersion is the version number of the template. TemplateVersion *string } // RedisCacheListSecretsResult - The secret values for the given RedisCache resource type RedisCacheListSecretsResult struct { - // The connection string used to connect to the Redis cache +// The connection string used to connect to the Redis cache ConnectionString *string - // The password for this Redis cache instance +// The password for this Redis cache instance Password *string - // The URL used to connect to the Redis cache +// The URL used to connect to the Redis cache URL *string } // RedisCacheProperties - RedisCache portable resource properties type RedisCacheProperties struct { - // REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to +// REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to Environment *string - // Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) +// Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) Application *string - // The host name of the target Redis cache +// The host name of the target Redis cache Host *string - // The port value of the target Redis cache +// The port value of the target Redis cache Port *int32 - // The recipe used to automatically deploy underlying infrastructure for the resource +// The recipe used to automatically deploy underlying infrastructure for the resource Recipe *Recipe - // Specifies how the underlying service/resource is provisioned and managed. +// Specifies how the underlying service/resource is provisioned and managed. ResourceProvisioning *ResourceProvisioning - // List of the resource IDs that support the Redis resource +// List of the resource IDs that support the Redis resource Resources []*ResourceReference - // Secrets provided by resource +// Secrets provided by resource Secrets *RedisCacheSecrets - // Specifies whether to enable SSL connections to the Redis cache +// Specifies whether to enable SSL connections to the Redis cache TLS *bool - // The username for Redis cache +// The username for Redis cache Username *string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } // RedisCacheResource - RedisCache portable resource type RedisCacheResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *RedisCacheProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // RedisCacheResourceListResult - The response of a RedisCacheResource list operation. type RedisCacheResourceListResult struct { - // REQUIRED; The RedisCacheResource items on this page +// REQUIRED; The RedisCacheResource items on this page Value []*RedisCacheResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // RedisCacheResourceUpdate - RedisCache portable resource type RedisCacheResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // RedisCacheSecrets - The secret values for the given RedisCache resource type RedisCacheSecrets struct { - // The connection string used to connect to the Redis cache +// The connection string used to connect to the Redis cache ConnectionString *string - // The password for this Redis cache instance +// The password for this Redis cache instance Password *string - // The URL used to connect to the Redis cache +// The URL used to connect to the Redis cache URL *string } // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ResourceReference - Describes a reference to an existing resource type ResourceReference struct { - // REQUIRED; Resource id of an existing resource +// REQUIRED; Resource id of an existing resource ID *string } // ResourceStatus - Status of a resource. type ResourceStatus struct { - // The compute resource associated with the resource. +// The compute resource associated with the resource. Compute EnvironmentComputeClassification - // Properties of an output resource +// Properties of an output resource OutputResources []*OutputResource - // READ-ONLY; The recipe data at the time of deployment +// READ-ONLY; The recipe data at the time of deployment Recipe *RecipeStatus } // SQLDatabaseListSecretsResult - The secret values for the given SqlDatabase resource type SQLDatabaseListSecretsResult struct { - // Connection string used to connect to the target Sql database +// Connection string used to connect to the target Sql database ConnectionString *string - // Password to use when connecting to the target Sql database +// Password to use when connecting to the target Sql database Password *string } // SQLDatabaseProperties - SqlDatabase properties type SQLDatabaseProperties struct { - // REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to +// REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to Environment *string - // Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) +// Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) Application *string - // The name of the Sql database. +// The name of the Sql database. Database *string - // Port value of the target Sql database +// Port value of the target Sql database Port *int32 - // The recipe used to automatically deploy underlying infrastructure for the resource +// The recipe used to automatically deploy underlying infrastructure for the resource Recipe *Recipe - // Specifies how the underlying service/resource is provisioned and managed. +// Specifies how the underlying service/resource is provisioned and managed. ResourceProvisioning *ResourceProvisioning - // List of the resource IDs that support the SqlDatabase resource +// List of the resource IDs that support the SqlDatabase resource Resources []*ResourceReference - // Secret values provided for the resource +// Secret values provided for the resource Secrets *SQLDatabaseSecrets - // The fully qualified domain name of the Sql database. +// The fully qualified domain name of the Sql database. Server *string - // Username to use when connecting to the target Sql database +// Username to use when connecting to the target Sql database Username *string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } // SQLDatabaseResource - SqlDatabase portable resource type SQLDatabaseResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *SQLDatabaseProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // SQLDatabaseResourceListResult - The response of a SqlDatabaseResource list operation. type SQLDatabaseResourceListResult struct { - // REQUIRED; The SqlDatabaseResource items on this page +// REQUIRED; The SqlDatabaseResource items on this page Value []*SQLDatabaseResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // SQLDatabaseResourceUpdate - SqlDatabase portable resource type SQLDatabaseResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // SQLDatabaseSecrets - The secret values for the given SqlDatabase resource type SQLDatabaseSecrets struct { - // Connection string used to connect to the target Sql database +// Connection string used to connect to the target Sql database ConnectionString *string - // Password to use when connecting to the target Sql database +// Password to use when connecting to the target Sql database Password *string } // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { - // The timestamp of resource creation (UTC). +// The timestamp of resource creation (UTC). CreatedAt *time.Time - // The identity that created the resource. +// The identity that created the resource. CreatedBy *string - // The type of identity that created the resource. +// The type of identity that created the resource. CreatedByType *CreatedByType - // The timestamp of resource last modification (UTC) +// The timestamp of resource last modification (UTC) LastModifiedAt *time.Time - // The identity that last modified the resource. +// The identity that last modified the resource. LastModifiedBy *string - // The type of identity that last modified the resource. +// The type of identity that last modified the resource. LastModifiedByType *CreatedByType } // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_models_serde.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_models_serde.go index 0c7f4f9cc8..2e35c6796c 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_models_serde.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_models_serde.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -1367,10 +1364,10 @@ func (s *SQLDatabaseSecrets) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -1386,7 +1383,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) @@ -1395,7 +1392,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) @@ -1469,7 +1466,7 @@ func populate(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_mongodatabases_client.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_mongodatabases_client.go index e6f6bd0a75..874f102fda 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_mongodatabases_client.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_mongodatabases_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type MongoDatabasesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewMongoDatabasesClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MongoDatabasesClient, error) { - cl, err := arm.NewClient(moduleName+".MongoDatabasesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -60,10 +57,13 @@ func (client *MongoDatabasesClient) BeginCreateOrUpdate(ctx context.Context, mon } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDatabasesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[MongoDatabasesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MongoDatabasesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -73,6 +73,10 @@ func (client *MongoDatabasesClient) BeginCreateOrUpdate(ctx context.Context, mon // Generated from API version 2023-10-01-preview func (client *MongoDatabasesClient) createOrUpdate(ctx context.Context, mongoDatabaseName string, resource MongoDatabaseResource, options *MongoDatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "MongoDatabasesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, mongoDatabaseName, resource, options) if err != nil { return nil, err @@ -89,7 +93,7 @@ func (client *MongoDatabasesClient) createOrUpdate(ctx context.Context, mongoDat } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *MongoDatabasesClient) createOrUpdateCreateRequest(ctx context.Context, mongoDatabaseName string, resource MongoDatabaseResource, options *MongoDatabasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *MongoDatabasesClient) createOrUpdateCreateRequest(ctx context.Context, mongoDatabaseName string, resource MongoDatabaseResource, _ *MongoDatabasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/mongoDatabases/{mongoDatabaseName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if mongoDatabaseName == "" { @@ -107,7 +111,7 @@ func (client *MongoDatabasesClient) createOrUpdateCreateRequest(ctx context.Cont if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a MongoDatabaseResource @@ -125,10 +129,13 @@ func (client *MongoDatabasesClient) BeginDelete(ctx context.Context, mongoDataba } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDatabasesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[MongoDatabasesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MongoDatabasesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -138,6 +145,10 @@ func (client *MongoDatabasesClient) BeginDelete(ctx context.Context, mongoDataba // Generated from API version 2023-10-01-preview func (client *MongoDatabasesClient) deleteOperation(ctx context.Context, mongoDatabaseName string, options *MongoDatabasesClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "MongoDatabasesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, mongoDatabaseName, options) if err != nil { return nil, err @@ -154,7 +165,7 @@ func (client *MongoDatabasesClient) deleteOperation(ctx context.Context, mongoDa } // deleteCreateRequest creates the Delete request. -func (client *MongoDatabasesClient) deleteCreateRequest(ctx context.Context, mongoDatabaseName string, options *MongoDatabasesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *MongoDatabasesClient) deleteCreateRequest(ctx context.Context, mongoDatabaseName string, _ *MongoDatabasesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/mongoDatabases/{mongoDatabaseName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if mongoDatabaseName == "" { @@ -180,6 +191,10 @@ func (client *MongoDatabasesClient) deleteCreateRequest(ctx context.Context, mon // - options - MongoDatabasesClientGetOptions contains the optional parameters for the MongoDatabasesClient.Get method. func (client *MongoDatabasesClient) Get(ctx context.Context, mongoDatabaseName string, options *MongoDatabasesClientGetOptions) (MongoDatabasesClientGetResponse, error) { var err error + const operationName = "MongoDatabasesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, mongoDatabaseName, options) if err != nil { return MongoDatabasesClientGetResponse{}, err @@ -197,7 +212,7 @@ func (client *MongoDatabasesClient) Get(ctx context.Context, mongoDatabaseName s } // getCreateRequest creates the Get request. -func (client *MongoDatabasesClient) getCreateRequest(ctx context.Context, mongoDatabaseName string, options *MongoDatabasesClientGetOptions) (*policy.Request, error) { +func (client *MongoDatabasesClient) getCreateRequest(ctx context.Context, mongoDatabaseName string, _ *MongoDatabasesClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/mongoDatabases/{mongoDatabaseName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if mongoDatabaseName == "" { @@ -235,30 +250,25 @@ func (client *MongoDatabasesClient) NewListByScopePager(options *MongoDatabasesC return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *MongoDatabasesClientListByScopeResponse) (MongoDatabasesClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return MongoDatabasesClientListByScopeResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MongoDatabasesClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return MongoDatabasesClientListByScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return MongoDatabasesClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *MongoDatabasesClient) listByScopeCreateRequest(ctx context.Context, options *MongoDatabasesClientListByScopeOptions) (*policy.Request, error) { +func (client *MongoDatabasesClient) listByScopeCreateRequest(ctx context.Context, _ *MongoDatabasesClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/mongoDatabases" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -291,6 +301,10 @@ func (client *MongoDatabasesClient) listByScopeHandleResponse(resp *http.Respons // method. func (client *MongoDatabasesClient) ListSecrets(ctx context.Context, mongoDatabaseName string, body map[string]any, options *MongoDatabasesClientListSecretsOptions) (MongoDatabasesClientListSecretsResponse, error) { var err error + const operationName = "MongoDatabasesClient.ListSecrets" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listSecretsCreateRequest(ctx, mongoDatabaseName, body, options) if err != nil { return MongoDatabasesClientListSecretsResponse{}, err @@ -308,7 +322,7 @@ func (client *MongoDatabasesClient) ListSecrets(ctx context.Context, mongoDataba } // listSecretsCreateRequest creates the ListSecrets request. -func (client *MongoDatabasesClient) listSecretsCreateRequest(ctx context.Context, mongoDatabaseName string, body map[string]any, options *MongoDatabasesClientListSecretsOptions) (*policy.Request, error) { +func (client *MongoDatabasesClient) listSecretsCreateRequest(ctx context.Context, mongoDatabaseName string, body map[string]any, _ *MongoDatabasesClientListSecretsOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/mongoDatabases/{mongoDatabaseName}/listSecrets" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if mongoDatabaseName == "" { @@ -326,7 +340,7 @@ func (client *MongoDatabasesClient) listSecretsCreateRequest(ctx context.Context if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err } - return req, nil +; return req, nil } // listSecretsHandleResponse handles the ListSecrets response. @@ -354,10 +368,13 @@ func (client *MongoDatabasesClient) BeginUpdate(ctx context.Context, mongoDataba } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[MongoDatabasesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[MongoDatabasesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[MongoDatabasesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -367,6 +384,10 @@ func (client *MongoDatabasesClient) BeginUpdate(ctx context.Context, mongoDataba // Generated from API version 2023-10-01-preview func (client *MongoDatabasesClient) update(ctx context.Context, mongoDatabaseName string, properties MongoDatabaseResourceUpdate, options *MongoDatabasesClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "MongoDatabasesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, mongoDatabaseName, properties, options) if err != nil { return nil, err @@ -383,7 +404,7 @@ func (client *MongoDatabasesClient) update(ctx context.Context, mongoDatabaseNam } // updateCreateRequest creates the Update request. -func (client *MongoDatabasesClient) updateCreateRequest(ctx context.Context, mongoDatabaseName string, properties MongoDatabaseResourceUpdate, options *MongoDatabasesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *MongoDatabasesClient) updateCreateRequest(ctx context.Context, mongoDatabaseName string, properties MongoDatabaseResourceUpdate, _ *MongoDatabasesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/mongoDatabases/{mongoDatabaseName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if mongoDatabaseName == "" { @@ -401,6 +422,6 @@ func (client *MongoDatabasesClient) updateCreateRequest(ctx context.Context, mon if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_operations_client.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_operations_client.go index 9a85d0a337..0412107bc4 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_operations_client.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_operations_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -26,7 +23,7 @@ type OperationsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -46,30 +43,25 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return OperationsClientListResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return OperationsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Applications.Datastores/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_options.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_options.go index f8675f9c73..5f7d72c902 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_options.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_options.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -10,19 +7,19 @@ package v20231001preview // MongoDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the MongoDatabasesClient.BeginCreateOrUpdate // method. type MongoDatabasesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // MongoDatabasesClientBeginDeleteOptions contains the optional parameters for the MongoDatabasesClient.BeginDelete method. type MongoDatabasesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // MongoDatabasesClientBeginUpdateOptions contains the optional parameters for the MongoDatabasesClient.BeginUpdate method. type MongoDatabasesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -50,19 +47,19 @@ type OperationsClientListOptions struct { // RedisCachesClientBeginCreateOrUpdateOptions contains the optional parameters for the RedisCachesClient.BeginCreateOrUpdate // method. type RedisCachesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // RedisCachesClientBeginDeleteOptions contains the optional parameters for the RedisCachesClient.BeginDelete method. type RedisCachesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // RedisCachesClientBeginUpdateOptions contains the optional parameters for the RedisCachesClient.BeginUpdate method. type RedisCachesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -84,19 +81,19 @@ type RedisCachesClientListSecretsOptions struct { // SQLDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the SQLDatabasesClient.BeginCreateOrUpdate // method. type SQLDatabasesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // SQLDatabasesClientBeginDeleteOptions contains the optional parameters for the SQLDatabasesClient.BeginDelete method. type SQLDatabasesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // SQLDatabasesClientBeginUpdateOptions contains the optional parameters for the SQLDatabasesClient.BeginUpdate method. type SQLDatabasesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_polymorphic_helpers.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_polymorphic_helpers.go index c574dd5eea..7b008f3d80 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_polymorphic_helpers.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_polymorphic_helpers.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -10,7 +7,7 @@ package v20231001preview import "encoding/json" func unmarshalEnvironmentComputeClassification(rawMsg json.RawMessage) (EnvironmentComputeClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_rediscaches_client.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_rediscaches_client.go index a2d154735a..cf8e8895fd 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_rediscaches_client.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_rediscaches_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type RedisCachesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewRedisCachesClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RedisCachesClient, error) { - cl, err := arm.NewClient(moduleName+".RedisCachesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -60,10 +57,13 @@ func (client *RedisCachesClient) BeginCreateOrUpdate(ctx context.Context, redisC } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RedisCachesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[RedisCachesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RedisCachesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -73,6 +73,10 @@ func (client *RedisCachesClient) BeginCreateOrUpdate(ctx context.Context, redisC // Generated from API version 2023-10-01-preview func (client *RedisCachesClient) createOrUpdate(ctx context.Context, redisCacheName string, resource RedisCacheResource, options *RedisCachesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "RedisCachesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, redisCacheName, resource, options) if err != nil { return nil, err @@ -89,7 +93,7 @@ func (client *RedisCachesClient) createOrUpdate(ctx context.Context, redisCacheN } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *RedisCachesClient) createOrUpdateCreateRequest(ctx context.Context, redisCacheName string, resource RedisCacheResource, options *RedisCachesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *RedisCachesClient) createOrUpdateCreateRequest(ctx context.Context, redisCacheName string, resource RedisCacheResource, _ *RedisCachesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/redisCaches/{redisCacheName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if redisCacheName == "" { @@ -107,7 +111,7 @@ func (client *RedisCachesClient) createOrUpdateCreateRequest(ctx context.Context if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a RedisCacheResource @@ -124,10 +128,13 @@ func (client *RedisCachesClient) BeginDelete(ctx context.Context, redisCacheName } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RedisCachesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[RedisCachesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RedisCachesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -137,6 +144,10 @@ func (client *RedisCachesClient) BeginDelete(ctx context.Context, redisCacheName // Generated from API version 2023-10-01-preview func (client *RedisCachesClient) deleteOperation(ctx context.Context, redisCacheName string, options *RedisCachesClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "RedisCachesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, redisCacheName, options) if err != nil { return nil, err @@ -153,7 +164,7 @@ func (client *RedisCachesClient) deleteOperation(ctx context.Context, redisCache } // deleteCreateRequest creates the Delete request. -func (client *RedisCachesClient) deleteCreateRequest(ctx context.Context, redisCacheName string, options *RedisCachesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *RedisCachesClient) deleteCreateRequest(ctx context.Context, redisCacheName string, _ *RedisCachesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/redisCaches/{redisCacheName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if redisCacheName == "" { @@ -179,6 +190,10 @@ func (client *RedisCachesClient) deleteCreateRequest(ctx context.Context, redisC // - options - RedisCachesClientGetOptions contains the optional parameters for the RedisCachesClient.Get method. func (client *RedisCachesClient) Get(ctx context.Context, redisCacheName string, options *RedisCachesClientGetOptions) (RedisCachesClientGetResponse, error) { var err error + const operationName = "RedisCachesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, redisCacheName, options) if err != nil { return RedisCachesClientGetResponse{}, err @@ -196,7 +211,7 @@ func (client *RedisCachesClient) Get(ctx context.Context, redisCacheName string, } // getCreateRequest creates the Get request. -func (client *RedisCachesClient) getCreateRequest(ctx context.Context, redisCacheName string, options *RedisCachesClientGetOptions) (*policy.Request, error) { +func (client *RedisCachesClient) getCreateRequest(ctx context.Context, redisCacheName string, _ *RedisCachesClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/redisCaches/{redisCacheName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if redisCacheName == "" { @@ -234,30 +249,25 @@ func (client *RedisCachesClient) NewListByScopePager(options *RedisCachesClientL return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *RedisCachesClientListByScopeResponse) (RedisCachesClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RedisCachesClientListByScopeResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RedisCachesClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return RedisCachesClientListByScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RedisCachesClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *RedisCachesClient) listByScopeCreateRequest(ctx context.Context, options *RedisCachesClientListByScopeOptions) (*policy.Request, error) { +func (client *RedisCachesClient) listByScopeCreateRequest(ctx context.Context, _ *RedisCachesClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/redisCaches" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -289,6 +299,10 @@ func (client *RedisCachesClient) listByScopeHandleResponse(resp *http.Response) // - options - RedisCachesClientListSecretsOptions contains the optional parameters for the RedisCachesClient.ListSecrets method. func (client *RedisCachesClient) ListSecrets(ctx context.Context, redisCacheName string, body map[string]any, options *RedisCachesClientListSecretsOptions) (RedisCachesClientListSecretsResponse, error) { var err error + const operationName = "RedisCachesClient.ListSecrets" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listSecretsCreateRequest(ctx, redisCacheName, body, options) if err != nil { return RedisCachesClientListSecretsResponse{}, err @@ -306,7 +320,7 @@ func (client *RedisCachesClient) ListSecrets(ctx context.Context, redisCacheName } // listSecretsCreateRequest creates the ListSecrets request. -func (client *RedisCachesClient) listSecretsCreateRequest(ctx context.Context, redisCacheName string, body map[string]any, options *RedisCachesClientListSecretsOptions) (*policy.Request, error) { +func (client *RedisCachesClient) listSecretsCreateRequest(ctx context.Context, redisCacheName string, body map[string]any, _ *RedisCachesClientListSecretsOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/redisCaches/{redisCacheName}/listSecrets" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if redisCacheName == "" { @@ -324,7 +338,7 @@ func (client *RedisCachesClient) listSecretsCreateRequest(ctx context.Context, r if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err } - return req, nil +; return req, nil } // listSecretsHandleResponse handles the ListSecrets response. @@ -351,10 +365,13 @@ func (client *RedisCachesClient) BeginUpdate(ctx context.Context, redisCacheName } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RedisCachesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[RedisCachesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RedisCachesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -364,6 +381,10 @@ func (client *RedisCachesClient) BeginUpdate(ctx context.Context, redisCacheName // Generated from API version 2023-10-01-preview func (client *RedisCachesClient) update(ctx context.Context, redisCacheName string, properties RedisCacheResourceUpdate, options *RedisCachesClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "RedisCachesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, redisCacheName, properties, options) if err != nil { return nil, err @@ -380,7 +401,7 @@ func (client *RedisCachesClient) update(ctx context.Context, redisCacheName stri } // updateCreateRequest creates the Update request. -func (client *RedisCachesClient) updateCreateRequest(ctx context.Context, redisCacheName string, properties RedisCacheResourceUpdate, options *RedisCachesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *RedisCachesClient) updateCreateRequest(ctx context.Context, redisCacheName string, properties RedisCacheResourceUpdate, _ *RedisCachesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/redisCaches/{redisCacheName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if redisCacheName == "" { @@ -398,6 +419,6 @@ func (client *RedisCachesClient) updateCreateRequest(ctx context.Context, redisC if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_response_types.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_responses.go similarity index 82% rename from pkg/datastoresrp/api/v20231001preview/zz_generated_response_types.go rename to pkg/datastoresrp/api/v20231001preview/zz_generated_responses.go index dadf4cf100..9ca03ab7ee 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_response_types.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_responses.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -9,7 +6,7 @@ package v20231001preview // MongoDatabasesClientCreateOrUpdateResponse contains the response from method MongoDatabasesClient.BeginCreateOrUpdate. type MongoDatabasesClientCreateOrUpdateResponse struct { - // MongoDatabase portable resource +// MongoDatabase portable resource MongoDatabaseResource } @@ -20,37 +17,37 @@ type MongoDatabasesClientDeleteResponse struct { // MongoDatabasesClientGetResponse contains the response from method MongoDatabasesClient.Get. type MongoDatabasesClientGetResponse struct { - // MongoDatabase portable resource +// MongoDatabase portable resource MongoDatabaseResource } // MongoDatabasesClientListByScopeResponse contains the response from method MongoDatabasesClient.NewListByScopePager. type MongoDatabasesClientListByScopeResponse struct { - // The response of a MongoDatabaseResource list operation. +// The response of a MongoDatabaseResource list operation. MongoDatabaseResourceListResult } // MongoDatabasesClientListSecretsResponse contains the response from method MongoDatabasesClient.ListSecrets. type MongoDatabasesClientListSecretsResponse struct { - // The secret values for the given MongoDatabase resource +// The secret values for the given MongoDatabase resource MongoDatabaseListSecretsResult } // MongoDatabasesClientUpdateResponse contains the response from method MongoDatabasesClient.BeginUpdate. type MongoDatabasesClientUpdateResponse struct { - // MongoDatabase portable resource +// MongoDatabase portable resource MongoDatabaseResource } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. 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. +// 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 } // RedisCachesClientCreateOrUpdateResponse contains the response from method RedisCachesClient.BeginCreateOrUpdate. type RedisCachesClientCreateOrUpdateResponse struct { - // RedisCache portable resource +// RedisCache portable resource RedisCacheResource } @@ -61,31 +58,31 @@ type RedisCachesClientDeleteResponse struct { // RedisCachesClientGetResponse contains the response from method RedisCachesClient.Get. type RedisCachesClientGetResponse struct { - // RedisCache portable resource +// RedisCache portable resource RedisCacheResource } // RedisCachesClientListByScopeResponse contains the response from method RedisCachesClient.NewListByScopePager. type RedisCachesClientListByScopeResponse struct { - // The response of a RedisCacheResource list operation. +// The response of a RedisCacheResource list operation. RedisCacheResourceListResult } // RedisCachesClientListSecretsResponse contains the response from method RedisCachesClient.ListSecrets. type RedisCachesClientListSecretsResponse struct { - // The secret values for the given RedisCache resource +// The secret values for the given RedisCache resource RedisCacheListSecretsResult } // RedisCachesClientUpdateResponse contains the response from method RedisCachesClient.BeginUpdate. type RedisCachesClientUpdateResponse struct { - // RedisCache portable resource +// RedisCache portable resource RedisCacheResource } // SQLDatabasesClientCreateOrUpdateResponse contains the response from method SQLDatabasesClient.BeginCreateOrUpdate. type SQLDatabasesClientCreateOrUpdateResponse struct { - // SqlDatabase portable resource +// SqlDatabase portable resource SQLDatabaseResource } @@ -96,25 +93,25 @@ type SQLDatabasesClientDeleteResponse struct { // SQLDatabasesClientGetResponse contains the response from method SQLDatabasesClient.Get. type SQLDatabasesClientGetResponse struct { - // SqlDatabase portable resource +// SqlDatabase portable resource SQLDatabaseResource } // SQLDatabasesClientListByScopeResponse contains the response from method SQLDatabasesClient.NewListByScopePager. type SQLDatabasesClientListByScopeResponse struct { - // The response of a SqlDatabaseResource list operation. +// The response of a SqlDatabaseResource list operation. SQLDatabaseResourceListResult } // SQLDatabasesClientListSecretsResponse contains the response from method SQLDatabasesClient.ListSecrets. type SQLDatabasesClientListSecretsResponse struct { - // The secret values for the given SqlDatabase resource +// The secret values for the given SqlDatabase resource SQLDatabaseListSecretsResult } // SQLDatabasesClientUpdateResponse contains the response from method SQLDatabasesClient.BeginUpdate. type SQLDatabasesClientUpdateResponse struct { - // SqlDatabase portable resource +// SqlDatabase portable resource SQLDatabaseResource } diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_sqldatabases_client.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_sqldatabases_client.go index 471ab9c017..aaedf63fb7 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_sqldatabases_client.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_sqldatabases_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type SQLDatabasesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSQLDatabasesClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLDatabasesClient, error) { - cl, err := arm.NewClient(moduleName+".SQLDatabasesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -60,10 +57,13 @@ func (client *SQLDatabasesClient) BeginCreateOrUpdate(ctx context.Context, sqlDa } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLDatabasesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[SQLDatabasesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLDatabasesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -73,6 +73,10 @@ func (client *SQLDatabasesClient) BeginCreateOrUpdate(ctx context.Context, sqlDa // Generated from API version 2023-10-01-preview func (client *SQLDatabasesClient) createOrUpdate(ctx context.Context, sqlDatabaseName string, resource SQLDatabaseResource, options *SQLDatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "SQLDatabasesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, sqlDatabaseName, resource, options) if err != nil { return nil, err @@ -89,7 +93,7 @@ func (client *SQLDatabasesClient) createOrUpdate(ctx context.Context, sqlDatabas } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *SQLDatabasesClient) createOrUpdateCreateRequest(ctx context.Context, sqlDatabaseName string, resource SQLDatabaseResource, options *SQLDatabasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *SQLDatabasesClient) createOrUpdateCreateRequest(ctx context.Context, sqlDatabaseName string, resource SQLDatabaseResource, _ *SQLDatabasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/sqlDatabases/{sqlDatabaseName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if sqlDatabaseName == "" { @@ -107,7 +111,7 @@ func (client *SQLDatabasesClient) createOrUpdateCreateRequest(ctx context.Contex if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a SqlDatabaseResource @@ -125,10 +129,13 @@ func (client *SQLDatabasesClient) BeginDelete(ctx context.Context, sqlDatabaseNa } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLDatabasesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[SQLDatabasesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLDatabasesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -138,6 +145,10 @@ func (client *SQLDatabasesClient) BeginDelete(ctx context.Context, sqlDatabaseNa // Generated from API version 2023-10-01-preview func (client *SQLDatabasesClient) deleteOperation(ctx context.Context, sqlDatabaseName string, options *SQLDatabasesClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "SQLDatabasesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, sqlDatabaseName, options) if err != nil { return nil, err @@ -154,7 +165,7 @@ func (client *SQLDatabasesClient) deleteOperation(ctx context.Context, sqlDataba } // deleteCreateRequest creates the Delete request. -func (client *SQLDatabasesClient) deleteCreateRequest(ctx context.Context, sqlDatabaseName string, options *SQLDatabasesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SQLDatabasesClient) deleteCreateRequest(ctx context.Context, sqlDatabaseName string, _ *SQLDatabasesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/sqlDatabases/{sqlDatabaseName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if sqlDatabaseName == "" { @@ -180,6 +191,10 @@ func (client *SQLDatabasesClient) deleteCreateRequest(ctx context.Context, sqlDa // - options - SQLDatabasesClientGetOptions contains the optional parameters for the SQLDatabasesClient.Get method. func (client *SQLDatabasesClient) Get(ctx context.Context, sqlDatabaseName string, options *SQLDatabasesClientGetOptions) (SQLDatabasesClientGetResponse, error) { var err error + const operationName = "SQLDatabasesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, sqlDatabaseName, options) if err != nil { return SQLDatabasesClientGetResponse{}, err @@ -197,7 +212,7 @@ func (client *SQLDatabasesClient) Get(ctx context.Context, sqlDatabaseName strin } // getCreateRequest creates the Get request. -func (client *SQLDatabasesClient) getCreateRequest(ctx context.Context, sqlDatabaseName string, options *SQLDatabasesClientGetOptions) (*policy.Request, error) { +func (client *SQLDatabasesClient) getCreateRequest(ctx context.Context, sqlDatabaseName string, _ *SQLDatabasesClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/sqlDatabases/{sqlDatabaseName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if sqlDatabaseName == "" { @@ -235,30 +250,25 @@ func (client *SQLDatabasesClient) NewListByScopePager(options *SQLDatabasesClien return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *SQLDatabasesClientListByScopeResponse) (SQLDatabasesClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return SQLDatabasesClientListByScopeResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SQLDatabasesClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return SQLDatabasesClientListByScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SQLDatabasesClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *SQLDatabasesClient) listByScopeCreateRequest(ctx context.Context, options *SQLDatabasesClientListByScopeOptions) (*policy.Request, error) { +func (client *SQLDatabasesClient) listByScopeCreateRequest(ctx context.Context, _ *SQLDatabasesClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/sqlDatabases" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -291,6 +301,10 @@ func (client *SQLDatabasesClient) listByScopeHandleResponse(resp *http.Response) // method. func (client *SQLDatabasesClient) ListSecrets(ctx context.Context, sqlDatabaseName string, body map[string]any, options *SQLDatabasesClientListSecretsOptions) (SQLDatabasesClientListSecretsResponse, error) { var err error + const operationName = "SQLDatabasesClient.ListSecrets" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listSecretsCreateRequest(ctx, sqlDatabaseName, body, options) if err != nil { return SQLDatabasesClientListSecretsResponse{}, err @@ -308,7 +322,7 @@ func (client *SQLDatabasesClient) ListSecrets(ctx context.Context, sqlDatabaseNa } // listSecretsCreateRequest creates the ListSecrets request. -func (client *SQLDatabasesClient) listSecretsCreateRequest(ctx context.Context, sqlDatabaseName string, body map[string]any, options *SQLDatabasesClientListSecretsOptions) (*policy.Request, error) { +func (client *SQLDatabasesClient) listSecretsCreateRequest(ctx context.Context, sqlDatabaseName string, body map[string]any, _ *SQLDatabasesClientListSecretsOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/sqlDatabases/{sqlDatabaseName}/listSecrets" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if sqlDatabaseName == "" { @@ -326,7 +340,7 @@ func (client *SQLDatabasesClient) listSecretsCreateRequest(ctx context.Context, if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err } - return req, nil +; return req, nil } // listSecretsHandleResponse handles the ListSecrets response. @@ -354,10 +368,13 @@ func (client *SQLDatabasesClient) BeginUpdate(ctx context.Context, sqlDatabaseNa } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLDatabasesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[SQLDatabasesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLDatabasesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -367,6 +384,10 @@ func (client *SQLDatabasesClient) BeginUpdate(ctx context.Context, sqlDatabaseNa // Generated from API version 2023-10-01-preview func (client *SQLDatabasesClient) update(ctx context.Context, sqlDatabaseName string, properties SQLDatabaseResourceUpdate, options *SQLDatabasesClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "SQLDatabasesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, sqlDatabaseName, properties, options) if err != nil { return nil, err @@ -383,7 +404,7 @@ func (client *SQLDatabasesClient) update(ctx context.Context, sqlDatabaseName st } // updateCreateRequest creates the Update request. -func (client *SQLDatabasesClient) updateCreateRequest(ctx context.Context, sqlDatabaseName string, properties SQLDatabaseResourceUpdate, options *SQLDatabasesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *SQLDatabasesClient) updateCreateRequest(ctx context.Context, sqlDatabaseName string, properties SQLDatabaseResourceUpdate, _ *SQLDatabasesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Datastores/sqlDatabases/{sqlDatabaseName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if sqlDatabaseName == "" { @@ -401,6 +422,6 @@ func (client *SQLDatabasesClient) updateCreateRequest(ctx context.Context, sqlDa if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_time_rfc3339.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_time_rfc3339.go index 948a6660cd..bbe5fcce12 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_time_rfc3339.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_time_rfc3339.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -21,51 +18,78 @@ import ( +// 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+)*"*$`) + const ( - utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` - utcLayout = "2006-01-02T15:04:05.999999999" - rfc3339JSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) -// 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+)*"*$`) - -type timeRFC3339 time.Time +type dateTimeRFC3339 time.Time -func (t timeRFC3339) MarshalJSON() (json []byte, err error) { +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { tt := time.Time(t) return tt.MarshalJSON() } -func (t timeRFC3339) MarshalText() (text []byte, err error) { +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { tt := time.Time(t) return tt.MarshalText() } -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcLayoutJSON - if tzOffsetRegex.Match(data) { - layout = rfc3339JSON +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { - layout := utcLayout - if tzOffsetRegex.Match(data) { +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) Parse(layout, value string) error { +func (t *dateTimeRFC3339) Parse(layout, value string) error { p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) + *t = dateTimeRFC3339(p) return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { @@ -74,14 +98,14 @@ func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { } else if reflect.ValueOf(t).IsNil() { return } - m[k] = (*timeRFC3339)(t) + m[k] = (*dateTimeRFC3339)(t) } -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { return nil } - var aux timeRFC3339 + var aux dateTimeRFC3339 if err := json.Unmarshal(data, &aux); err != nil { return fmt.Errorf("struct field %s: %v", fn, err) } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go b/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go index d5e1ca6866..213af38bf7 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go @@ -297,7 +297,7 @@ func (client *APIVersionsClient) NewListPager(planeName string, resourceProvider // listCreateRequest creates the List request. func (client *APIVersionsClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *APIVersionsClientListOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" + urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/apiversions" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go b/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go index b547af4b84..c6ec74d5ae 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go @@ -68,7 +68,7 @@ func (client *AwsCredentialsClient) CreateOrUpdate(ctx context.Context, planeNam // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *AwsCredentialsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, credentialName string, resource AwsCredentialResource, options *AwsCredentialsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" + urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") @@ -123,7 +123,7 @@ func (client *AwsCredentialsClient) Delete(ctx context.Context, planeName string // deleteCreateRequest creates the Delete request. func (client *AwsCredentialsClient) deleteCreateRequest(ctx context.Context, planeName string, credentialName string, options *AwsCredentialsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" + urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") @@ -167,7 +167,7 @@ func (client *AwsCredentialsClient) Get(ctx context.Context, planeName string, c // getCreateRequest creates the Get request. func (client *AwsCredentialsClient) getCreateRequest(ctx context.Context, planeName string, credentialName string, options *AwsCredentialsClientGetOptions) (*policy.Request, error) { - urlPath := "/planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" + urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") @@ -228,7 +228,7 @@ func (client *AwsCredentialsClient) NewListPager(planeName string, options *AwsC // listCreateRequest creates the List request. func (client *AwsCredentialsClient) listCreateRequest(ctx context.Context, planeName string, options *AwsCredentialsClientListOptions) (*policy.Request, error) { - urlPath := "/planes/aws/planes/aws/{planeName}" + urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -278,7 +278,7 @@ func (client *AwsCredentialsClient) Update(ctx context.Context, planeName string // updateCreateRequest creates the Update request. func (client *AwsCredentialsClient) updateCreateRequest(ctx context.Context, planeName string, credentialName string, properties AwsCredentialResourceTagsUpdate, options *AwsCredentialsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" + urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") diff --git a/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go b/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go index b86f564204..b9f110905d 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go @@ -167,7 +167,7 @@ func (client *AzureCredentialsClient) Get(ctx context.Context, planeName string, // getCreateRequest creates the Get request. func (client *AzureCredentialsClient) getCreateRequest(ctx context.Context, planeName string, credentialName string, options *AzureCredentialsClientGetOptions) (*policy.Request, error) { - urlPath := "/planes/azure/{planeName}/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}" + urlPath := "/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { return nil, errors.New("parameter credentialName cannot be empty") @@ -229,7 +229,7 @@ func (client *AzureCredentialsClient) NewListPager(planeName string, options *Az // listCreateRequest creates the List request. func (client *AzureCredentialsClient) listCreateRequest(ctx context.Context, planeName string, options *AzureCredentialsClientListOptions) (*policy.Request, error) { - urlPath := "/planes/azure/planes/azure/{planeName}" + urlPath := "/planes/azure/{planeName}/providers/System.Azure/credentials" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go b/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go index 3320364e64..01e75c698f 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go @@ -283,7 +283,7 @@ func (client *LocationsClient) NewListPager(planeName string, resourceProviderNa // listCreateRequest creates the List request. func (client *LocationsClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *LocationsClientListOptions) (*policy.Request, error) { - urlPath := "/planes/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" + urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go b/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go index db46cbbded..56574fd314 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go @@ -70,7 +70,8 @@ func (client *PlanesClient) NewListPlanesPager(options *PlanesClientListPlanesOp // listPlanesCreateRequest creates the ListPlanes request. func (client *PlanesClient) listPlanesCreateRequest(ctx context.Context, options *PlanesClientListPlanesOptions) (*policy.Request, error) { - req, err := runtime.NewRequest(ctx, http.MethodGet, client.internal.Endpoint()) + urlPath := "/planes" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go index d9b28615bc..bcb851c724 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go @@ -68,7 +68,7 @@ func (client *ResourceGroupsClient) CreateOrUpdate(ctx context.Context, planeNam // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *ResourceGroupsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceGroupName string, resource ResourceGroupResource, options *ResourceGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" + urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -126,7 +126,7 @@ func (client *ResourceGroupsClient) Delete(ctx context.Context, planeName string // deleteCreateRequest creates the Delete request. func (client *ResourceGroupsClient) deleteCreateRequest(ctx context.Context, planeName string, resourceGroupName string, options *ResourceGroupsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" + urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -173,7 +173,7 @@ func (client *ResourceGroupsClient) Get(ctx context.Context, planeName string, r // getCreateRequest creates the Get request. func (client *ResourceGroupsClient) getCreateRequest(ctx context.Context, planeName string, resourceGroupName string, options *ResourceGroupsClientGetOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" + urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -237,7 +237,7 @@ func (client *ResourceGroupsClient) NewListPager(planeName string, options *Reso // listCreateRequest creates the List request. func (client *ResourceGroupsClient) listCreateRequest(ctx context.Context, planeName string, options *ResourceGroupsClientListOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/resourcegroups/radius/{planeName}" + urlPath := "/planes/radius/{planeName}/resourcegroups" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -290,7 +290,7 @@ func (client *ResourceGroupsClient) Update(ctx context.Context, planeName string // updateCreateRequest creates the Update request. func (client *ResourceGroupsClient) updateCreateRequest(ctx context.Context, planeName string, resourceGroupName string, properties ResourceGroupResourceTagsUpdate, options *ResourceGroupsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}" + urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go index fc58943f30..dd8f52981f 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go @@ -325,7 +325,7 @@ func (client *ResourceProvidersClient) NewListPager(planeName string, options *R // listCreateRequest creates the List request. func (client *ResourceProvidersClient) listCreateRequest(ctx context.Context, planeName string, options *ResourceProvidersClientListOptions) (*policy.Request, error) { - urlPath := "/planes/planes/radius/{planeName}/providers/System.Resources/resourceproviders/radius/{planeName}" + urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go index 3dcd6e66e6..f9ade005f0 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go @@ -75,7 +75,7 @@ func (client *ResourcesClient) NewListPager(planeName string, resourceGroupName // listCreateRequest creates the List request. func (client *ResourcesClient) listCreateRequest(ctx context.Context, planeName string, resourceGroupName string, options *ResourcesClientListOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" + urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/resources" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go index fdc38a551c..e1e8e2cfcb 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go @@ -87,7 +87,7 @@ func (client *ResourceTypesClient) createOrUpdate(ctx context.Context, planeName // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *ResourceTypesClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, resource ResourceTypeResource, options *ResourceTypesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" + urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -161,7 +161,7 @@ func (client *ResourceTypesClient) deleteOperation(ctx context.Context, planeNam // deleteCreateRequest creates the Delete request. func (client *ResourceTypesClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *ResourceTypesClientBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" + urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -213,7 +213,7 @@ func (client *ResourceTypesClient) Get(ctx context.Context, planeName string, re // getCreateRequest creates the Get request. func (client *ResourceTypesClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *ResourceTypesClientGetOptions) (*policy.Request, error) { - urlPath := "/planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" + urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } @@ -282,7 +282,7 @@ func (client *ResourceTypesClient) NewListPager(planeName string, resourceProvid // listCreateRequest creates the List request. func (client *ResourceTypesClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *ResourceTypesClientListOptions) (*policy.Request, error) { - urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" + urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") } diff --git a/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json b/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json index 49fa5510cf..089957ee01 100644 --- a/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json +++ b/swagger/specification/ucp/resource-manager/UCP/preview/2023-10-01-preview/openapi.json @@ -77,7 +77,7 @@ } ], "paths": { - "/": { + "/planes": { "get": { "operationId": "Planes_ListPlanes", "tags": [ @@ -113,226 +113,6 @@ } } }, - "/planes/{resourceTypeName}/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { - "get": { - "operationId": "ResourceTypes_Get", - "tags": [ - "ResourceTypes" - ], - "description": "Get the specified resource type.", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - }, - { - "name": "resourceTypeName", - "in": "path", - "description": "The resource type name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/ResourceTypeResource" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Gets a resource type defined by a resource provider.": { - "$ref": "./examples/ResourceTypes_Get.json" - } - } - }, - "put": { - "operationId": "ResourceTypes_CreateOrUpdate", - "tags": [ - "ResourceTypes" - ], - "description": "Create or update a resource type", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - }, - { - "name": "resourceTypeName", - "in": "path", - "description": "The resource type name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" - }, - { - "name": "resource", - "in": "body", - "description": "Resource create parameters.", - "required": true, - "schema": { - "$ref": "#/definitions/ResourceTypeResource" - } - } - ], - "responses": { - "200": { - "description": "Resource 'ResourceTypeResource' update operation succeeded", - "schema": { - "$ref": "#/definitions/ResourceTypeResource" - } - }, - "201": { - "description": "Resource 'ResourceTypeResource' create operation succeeded", - "schema": { - "$ref": "#/definitions/ResourceTypeResource" - }, - "headers": { - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Create or update a resource type defined by a resource provider.": { - "$ref": "./examples/ResourceTypes_CreateOrUpdate.json" - } - }, - "x-ms-long-running-operation-options": { - "final-state-via": "azure-async-operation" - }, - "x-ms-long-running-operation": true - }, - "delete": { - "operationId": "ResourceTypes_Delete", - "tags": [ - "ResourceTypes" - ], - "description": "Delete a resource type", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" - }, - { - "name": "resourceTypeName", - "in": "path", - "description": "The resource type name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" - } - ], - "responses": { - "200": { - "description": "Resource deleted successfully." - }, - "202": { - "description": "Resource deletion accepted.", - "headers": { - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." - }, - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } - } - }, - "204": { - "description": "Resource does not exist." - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "Delete a resource type defined by a resource provider.": { - "$ref": "./examples/ResourceTypes_Delete.json" - } - }, - "x-ms-long-running-operation-options": { - "final-state-via": "location" - }, - "x-ms-long-running-operation": true - } - }, "/planes/aws": { "get": { "operationId": "AwsPlanes_List", @@ -577,35 +357,26 @@ "x-ms-long-running-operation": true } }, - "/planes/aws/{planeName}/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { + "/planes/aws/{planeName}/providers/System.AWS/credentials": { "get": { - "operationId": "AwsCredentials_Get", + "operationId": "AwsCredentials_List", "tags": [ "AwsCredentials" ], - "description": "Get an AWS credential", + "description": "List AWS credentials", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { "$ref": "#/parameters/AwsPlaneNameParameter" - }, - { - "name": "credentialName", - "in": "path", - "description": "The AWS credential name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AwsCredentialResource" + "$ref": "#/definitions/AwsCredentialResourceListResult" } }, "default": { @@ -616,20 +387,25 @@ } }, "x-ms-examples": { - "Get an AWS AccessKey credential": { - "$ref": "./examples/AWSCredential_AccessKey_Get.json" + "List AWS AccessKey credential": { + "$ref": "./examples/AWSCredential_AccessKey_List.json" }, - "Get an AWS IRSA credential": { - "$ref": "./examples/AWSCredential_IRSA_Get.json" + "List AWS IRSA credentials": { + "$ref": "./examples/AWSCredential_IRSA_List.json" } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" } - }, - "put": { - "operationId": "AwsCredentials_CreateOrUpdate", + } + }, + "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}": { + "get": { + "operationId": "AwsCredentials_Get", "tags": [ "AwsCredentials" ], - "description": "Create or update an AWS credential", + "description": "Get an AWS credential", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -645,8 +421,54 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/AwsCredentialResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "Get an AWS AccessKey credential": { + "$ref": "./examples/AWSCredential_AccessKey_Get.json" + }, + "Get an AWS IRSA credential": { + "$ref": "./examples/AWSCredential_IRSA_Get.json" + } + } + }, + "put": { + "operationId": "AwsCredentials_CreateOrUpdate", + "tags": [ + "AwsCredentials" + ], + "description": "Create or update an AWS credential", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/AwsPlaneNameParameter" + }, + { + "name": "credentialName", + "in": "path", + "description": "The AWS credential name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { "name": "resource", "in": "body", "description": "Resource create parameters.", @@ -787,48 +609,6 @@ } } }, - "/planes/aws/planes/aws/{planeName}": { - "get": { - "operationId": "AwsCredentials_List", - "tags": [ - "AwsCredentials" - ], - "description": "List AWS credentials", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "$ref": "#/parameters/AwsPlaneNameParameter" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/AwsCredentialResourceListResult" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "List AWS AccessKey credential": { - "$ref": "./examples/AWSCredential_AccessKey_List.json" - }, - "List AWS IRSA credentials": { - "$ref": "./examples/AWSCredential_IRSA_List.json" - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, "/planes/azure": { "get": { "operationId": "AzurePlanes_List", @@ -1073,7 +853,49 @@ "x-ms-long-running-operation": true } }, - "/planes/azure/{planeName}/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}": { + "/planes/azure/{planeName}/providers/System.Azure/credentials": { + "get": { + "operationId": "AzureCredentials_List", + "tags": [ + "AzureCredentials" + ], + "description": "List Azure credentials", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/AzurePlaneNameParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/AzureCredentialResourceListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List Azure Service Principal credentials": { + "$ref": "./examples/AzureCredential_ServicePrincipal_List.json" + }, + "List Azure Workload Identity credentials": { + "$ref": "./examples/AzureCredential_WorkloadIdentity_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}": { "get": { "operationId": "AzureCredentials_Get", "tags": [ @@ -1119,9 +941,7 @@ "$ref": "./examples/AzureCredential_WorkloadIdentity_Get.json" } } - } - }, - "/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}": { + }, "put": { "operationId": "AzureCredentials_CreateOrUpdate", "tags": [ @@ -1285,26 +1105,120 @@ } } }, - "/planes/azure/planes/azure/{planeName}": { + "/planes/radius": { "get": { - "operationId": "AzureCredentials_List", + "operationId": "RadiusPlanes_List", "tags": [ - "AzureCredentials" + "RadiusPlanes" ], - "description": "List Azure credentials", + "description": "List Radius planes", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/RadiusPlaneResourceListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/planes/radius/{planeName}": { + "get": { + "operationId": "RadiusPlanes_Get", + "tags": [ + "RadiusPlanes" + ], + "description": "Get a plane by name", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, { - "$ref": "#/parameters/AzurePlaneNameParameter" + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/AzureCredentialResourceListResult" + "$ref": "#/definitions/RadiusPlaneResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + } + }, + "put": { + "operationId": "RadiusPlanes_CreateOrUpdate", + "tags": [ + "RadiusPlanes" + ], + "description": "Create or update a plane", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/RadiusPlaneResource" + } + } + ], + "responses": { + "200": { + "description": "Resource 'RadiusPlaneResource' update operation succeeded", + "schema": { + "$ref": "#/definitions/RadiusPlaneResource" + } + }, + "201": { + "description": "Resource 'RadiusPlaneResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/RadiusPlaneResource" + }, + "headers": { + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } } }, "default": { @@ -1314,12 +1228,165 @@ } } }, - "x-ms-examples": { - "List Azure Service Principal credentials": { - "$ref": "./examples/AzureCredential_ServicePrincipal_List.json" + "x-ms-long-running-operation-options": { + "final-state-via": "azure-async-operation" + }, + "x-ms-long-running-operation": true + }, + "patch": { + "operationId": "RadiusPlanes_Update", + "tags": [ + "RadiusPlanes" + ], + "description": "Update a plane", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" }, - "List Azure Workload Identity credentials": { - "$ref": "./examples/AzureCredential_WorkloadIdentity_List.json" + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/RadiusPlaneResourceTagsUpdate" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/RadiusPlaneResource" + } + }, + "202": { + "description": "Resource update request accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + }, + "delete": { + "operationId": "RadiusPlanes_Delete", + "tags": [ + "RadiusPlanes" + ], + "description": "Delete a plane", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + } + ], + "responses": { + "200": { + "description": "Resource deleted successfully." + }, + "202": { + "description": "Resource deletion accepted.", + "headers": { + "Location": { + "type": "string", + "description": "The Location header contains the URL where the status of the long running operation can be checked." + }, + "Retry-After": { + "type": "integer", + "format": "int32", + "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." + } + } + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-long-running-operation-options": { + "final-state-via": "location" + }, + "x-ms-long-running-operation": true + } + }, + "/planes/radius/{planeName}/providers": { + "get": { + "operationId": "ResourceProviders_ListProviderSummaries", + "tags": [ + "ResourceProviders" + ], + "description": "List resource provider summaries. The resource provider summary aggregates the most commonly used information including locations, api versions and resource types.", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + } + ], + "responses": { + "200": { + "description": "The request has succeeded.", + "schema": { + "$ref": "#/definitions/PagedResourceProviderSummary" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List resource provider summaries. The resource provider summary aggregates common information about resource types, api versions, and locations.": { + "$ref": "./examples/ResourceProviders_ListProviderSummaries.json" } }, "x-ms-pageable": { @@ -1327,13 +1394,13 @@ } } }, - "/planes/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { + "/planes/radius/{planeName}/providers/{resourceProviderName}": { "get": { - "operationId": "Locations_List", + "operationId": "ResourceProviders_GetProviderSummary", "tags": [ - "Locations" + "ResourceProviders" ], - "description": "List available locations for the specified resource provider.", + "description": "Get the specified resource provider summary. The resource provider summary aggregates the most commonly used information including locations, api versions and resource types.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1361,7 +1428,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/LocationResourceListResult" + "$ref": "#/definitions/ResourceProviderSummary" } }, "default": { @@ -1372,16 +1439,13 @@ } }, "x-ms-examples": { - "List locations supported by a resource provider.": { - "$ref": "./examples/Locations_List.json" + "Get a resoure provider summary. The resource provider summary aggregates common information about resource types, api versions, and locations.": { + "$ref": "./examples/ResourceProviders_GetProviderSummary.json" } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" } } }, - "/planes/planes/radius/{planeName}/providers/System.Resources/resourceproviders/radius/{planeName}": { + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders": { "get": { "operationId": "ResourceProviders_List", "tags": [ @@ -1426,44 +1490,13 @@ } } }, - "/planes/radius": { - "get": { - "operationId": "RadiusPlanes_List", - "tags": [ - "RadiusPlanes" - ], - "description": "List Radius planes", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/RadiusPlaneResourceListResult" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/planes/radius/{planeName}": { + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { "get": { - "operationId": "RadiusPlanes_Get", + "operationId": "ResourceProviders_Get", "tags": [ - "RadiusPlanes" + "ResourceProviders" ], - "description": "Get a plane by name", + "description": "Get the specified resource provider.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1476,13 +1509,22 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/RadiusPlaneResource" + "$ref": "#/definitions/ResourceProviderResource" } }, "default": { @@ -1491,14 +1533,19 @@ "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" } } + }, + "x-ms-examples": { + "Gets a resource provider.": { + "$ref": "./examples/ResourceProviders_Get.json" + } } }, "put": { - "operationId": "RadiusPlanes_CreateOrUpdate", + "operationId": "ResourceProviders_CreateOrUpdate", "tags": [ - "RadiusPlanes" + "ResourceProviders" ], - "description": "Create or update a plane", + "description": "Create or update a resource provider", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1512,27 +1559,36 @@ "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, + { + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, { "name": "resource", "in": "body", "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/RadiusPlaneResource" + "$ref": "#/definitions/ResourceProviderResource" } } ], "responses": { "200": { - "description": "Resource 'RadiusPlaneResource' update operation succeeded", + "description": "Resource 'ResourceProviderResource' update operation succeeded", "schema": { - "$ref": "#/definitions/RadiusPlaneResource" + "$ref": "#/definitions/ResourceProviderResource" } }, "201": { - "description": "Resource 'RadiusPlaneResource' create operation succeeded", + "description": "Resource 'ResourceProviderResource' create operation succeeded", "schema": { - "$ref": "#/definitions/RadiusPlaneResource" + "$ref": "#/definitions/ResourceProviderResource" }, "headers": { "Retry-After": { @@ -1549,17 +1605,22 @@ } } }, + "x-ms-examples": { + "Create or update a resource provider": { + "$ref": "./examples/ResourceProviders_CreateOrUpdate.json" + } + }, "x-ms-long-running-operation-options": { "final-state-via": "azure-async-operation" }, "x-ms-long-running-operation": true }, - "patch": { - "operationId": "RadiusPlanes_Update", + "delete": { + "operationId": "ResourceProviders_Delete", "tags": [ - "RadiusPlanes" + "ResourceProviders" ], - "description": "Update a plane", + "description": "Delete a resource provider", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1574,66 +1635,13 @@ "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" }, { - "name": "properties", - "in": "body", - "description": "The resource properties to be updated.", - "required": true, - "schema": { - "$ref": "#/definitions/RadiusPlaneResourceTagsUpdate" - } - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/RadiusPlaneResource" - } - }, - "202": { - "description": "Resource update request accepted.", - "headers": { - "Location": { - "type": "string", - "description": "The Location header contains the URL where the status of the long running operation can be checked." - }, - "Retry-After": { - "type": "integer", - "format": "int32", - "description": "The Retry-After header can indicate how long the client should wait before polling the operation status." - } - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-long-running-operation-options": { - "final-state-via": "location" - }, - "x-ms-long-running-operation": true - }, - "delete": { - "operationId": "RadiusPlanes_Delete", - "tags": [ - "RadiusPlanes" - ], - "description": "Delete a plane", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", + "name": "resourceProviderName", "in": "path", - "description": "The plane name.", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" } ], "responses": { @@ -1664,64 +1672,24 @@ } } }, + "x-ms-examples": { + "Delete a resource resource": { + "$ref": "./examples/ResourceProviders_Delete.json" + } + }, "x-ms-long-running-operation-options": { "final-state-via": "location" }, "x-ms-long-running-operation": true } }, - "/planes/radius/{planeName}/providers": { - "get": { - "operationId": "ResourceProviders_ListProviderSummaries", - "tags": [ - "ResourceProviders" - ], - "description": "List resource provider summaries. The resource provider summary aggregates the most commonly used information including locations, api versions and resource types.", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - } - ], - "responses": { - "200": { - "description": "The request has succeeded.", - "schema": { - "$ref": "#/definitions/PagedResourceProviderSummary" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "List resource provider summaries. The resource provider summary aggregates common information about resource types, api versions, and locations.": { - "$ref": "./examples/ResourceProviders_ListProviderSummaries.json" - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/planes/radius/{planeName}/providers/{resourceProviderName}": { + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations": { "get": { - "operationId": "ResourceProviders_GetProviderSummary", + "operationId": "Locations_List", "tags": [ - "ResourceProviders" + "Locations" ], - "description": "Get the specified resource provider summary. The resource provider summary aggregates the most commonly used information including locations, api versions and resource types.", + "description": "List available locations for the specified resource provider.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1749,7 +1717,7 @@ "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceProviderSummary" + "$ref": "#/definitions/LocationResourceListResult" } }, "default": { @@ -1760,19 +1728,22 @@ } }, "x-ms-examples": { - "Get a resoure provider summary. The resource provider summary aggregates common information about resource types, api versions, and locations.": { - "$ref": "./examples/ResourceProviders_GetProviderSummary.json" + "List locations supported by a resource provider.": { + "$ref": "./examples/Locations_List.json" } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" } } }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations/{locationName}": { "get": { - "operationId": "ResourceProviders_Get", + "operationId": "Locations_Get", "tags": [ - "ResourceProviders" + "Locations" ], - "description": "Get the specified resource provider.", + "description": "Get the specified location. The location resource represents a logical location where the resource provider operates.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1794,13 +1765,22 @@ "type": "string", "maxLength": 63, "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, + { + "name": "locationName", + "in": "path", + "description": "The location name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z][A-Za-z0-9]*$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceProviderResource" + "$ref": "#/definitions/LocationResource" } }, "default": { @@ -1811,17 +1791,17 @@ } }, "x-ms-examples": { - "Gets a resource provider.": { - "$ref": "./examples/ResourceProviders_Get.json" + "Gets a location supported by a resource provider.": { + "$ref": "./examples/Locations_Get.json" } } }, "put": { - "operationId": "ResourceProviders_CreateOrUpdate", + "operationId": "Locations_CreateOrUpdate", "tags": [ - "ResourceProviders" + "Locations" ], - "description": "Create or update a resource provider", + "description": "Create or update a location. The location resource represents a logical location where the resource provider operates.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1844,27 +1824,36 @@ "maxLength": 63, "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" }, + { + "name": "locationName", + "in": "path", + "description": "The location name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z][A-Za-z0-9]*$" + }, { "name": "resource", "in": "body", "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/ResourceProviderResource" + "$ref": "#/definitions/LocationResource" } } ], "responses": { "200": { - "description": "Resource 'ResourceProviderResource' update operation succeeded", + "description": "Resource 'LocationResource' update operation succeeded", "schema": { - "$ref": "#/definitions/ResourceProviderResource" + "$ref": "#/definitions/LocationResource" } }, "201": { - "description": "Resource 'ResourceProviderResource' create operation succeeded", + "description": "Resource 'LocationResource' create operation succeeded", "schema": { - "$ref": "#/definitions/ResourceProviderResource" + "$ref": "#/definitions/LocationResource" }, "headers": { "Retry-After": { @@ -1882,8 +1871,8 @@ } }, "x-ms-examples": { - "Create or update a resource provider": { - "$ref": "./examples/ResourceProviders_CreateOrUpdate.json" + "Create or update a location supported by a resource provider.": { + "$ref": "./examples/Locations_CreateOrUpdate.json" } }, "x-ms-long-running-operation-options": { @@ -1892,11 +1881,11 @@ "x-ms-long-running-operation": true }, "delete": { - "operationId": "ResourceProviders_Delete", + "operationId": "Locations_Delete", "tags": [ - "ResourceProviders" + "Locations" ], - "description": "Delete a resource provider", + "description": "Delete a location. The location resource represents a logical location where the resource provider operates.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1918,6 +1907,15 @@ "type": "string", "maxLength": 63, "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + }, + { + "name": "locationName", + "in": "path", + "description": "The location name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z][A-Za-z0-9]*$" } ], "responses": { @@ -1949,8 +1947,8 @@ } }, "x-ms-examples": { - "Delete a resource resource": { - "$ref": "./examples/ResourceProviders_Delete.json" + "Delete a location supported by a resource provider.": { + "$ref": "./examples/Locations_Delete.json" } }, "x-ms-long-running-operation-options": { @@ -1959,13 +1957,67 @@ "x-ms-long-running-operation": true } }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations/{locationName}": { + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes": { "get": { - "operationId": "Locations_Get", + "operationId": "ResourceTypes_List", "tags": [ - "Locations" + "ResourceTypes" ], - "description": "Get the specified location. The location resource represents a logical location where the resource provider operates.", + "description": "List resource types.", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "name": "planeName", + "in": "path", + "description": "The plane name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceProviderName", + "in": "path", + "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/ResourceTypeResourceListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-examples": { + "List resource types defined by a resource provider.": { + "$ref": "./examples/ResourceTypes_List.json" + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { + "get": { + "operationId": "ResourceTypes_Get", + "tags": [ + "ResourceTypes" + ], + "description": "Get the specified resource type.", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -1989,20 +2041,20 @@ "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" }, { - "name": "locationName", + "name": "resourceTypeName", "in": "path", - "description": "The location name.", + "description": "The resource type name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^[A-Za-z][A-Za-z0-9]*$" + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/LocationResource" + "$ref": "#/definitions/ResourceTypeResource" } }, "default": { @@ -2013,17 +2065,17 @@ } }, "x-ms-examples": { - "Gets a location supported by a resource provider.": { - "$ref": "./examples/Locations_Get.json" + "Gets a resource type defined by a resource provider.": { + "$ref": "./examples/ResourceTypes_Get.json" } } }, "put": { - "operationId": "Locations_CreateOrUpdate", + "operationId": "ResourceTypes_CreateOrUpdate", "tags": [ - "Locations" + "ResourceTypes" ], - "description": "Create or update a location. The location resource represents a logical location where the resource provider operates.", + "description": "Create or update a resource type", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2047,13 +2099,13 @@ "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" }, { - "name": "locationName", + "name": "resourceTypeName", "in": "path", - "description": "The location name.", + "description": "The resource type name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^[A-Za-z][A-Za-z0-9]*$" + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" }, { "name": "resource", @@ -2061,21 +2113,21 @@ "description": "Resource create parameters.", "required": true, "schema": { - "$ref": "#/definitions/LocationResource" + "$ref": "#/definitions/ResourceTypeResource" } } ], "responses": { "200": { - "description": "Resource 'LocationResource' update operation succeeded", + "description": "Resource 'ResourceTypeResource' update operation succeeded", "schema": { - "$ref": "#/definitions/LocationResource" + "$ref": "#/definitions/ResourceTypeResource" } }, "201": { - "description": "Resource 'LocationResource' create operation succeeded", + "description": "Resource 'ResourceTypeResource' create operation succeeded", "schema": { - "$ref": "#/definitions/LocationResource" + "$ref": "#/definitions/ResourceTypeResource" }, "headers": { "Retry-After": { @@ -2093,8 +2145,8 @@ } }, "x-ms-examples": { - "Create or update a location supported by a resource provider.": { - "$ref": "./examples/Locations_CreateOrUpdate.json" + "Create or update a resource type defined by a resource provider.": { + "$ref": "./examples/ResourceTypes_CreateOrUpdate.json" } }, "x-ms-long-running-operation-options": { @@ -2103,11 +2155,11 @@ "x-ms-long-running-operation": true }, "delete": { - "operationId": "Locations_Delete", + "operationId": "ResourceTypes_Delete", "tags": [ - "Locations" + "ResourceTypes" ], - "description": "Delete a location. The location resource represents a logical location where the resource provider operates.", + "description": "Delete a resource type", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2131,13 +2183,13 @@ "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" }, { - "name": "locationName", + "name": "resourceTypeName", "in": "path", - "description": "The location name.", + "description": "The resource type name.", "required": true, "type": "string", "maxLength": 63, - "pattern": "^[A-Za-z][A-Za-z0-9]*$" + "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))$" } ], "responses": { @@ -2169,8 +2221,8 @@ } }, "x-ms-examples": { - "Delete a location supported by a resource provider.": { - "$ref": "./examples/Locations_Delete.json" + "Delete a resource type defined by a resource provider.": { + "$ref": "./examples/ResourceTypes_Delete.json" } }, "x-ms-long-running-operation-options": { @@ -2179,7 +2231,7 @@ "x-ms-long-running-operation": true } }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}": { + "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/apiversions": { "get": { "operationId": "ApiVersions_List", "tags": [ @@ -2489,13 +2541,13 @@ "x-ms-long-running-operation": true } }, - "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}": { + "/planes/radius/{planeName}/resourcegroups": { "get": { - "operationId": "ResourceTypes_List", + "operationId": "ResourceGroups_List", "tags": [ - "ResourceTypes" + "ResourceGroups" ], - "description": "List resource types.", + "description": "List resource groups", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2508,22 +2560,13 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceProviderName", - "in": "path", - "description": "The resource provider name. This is also the resource provider namespace. Example: 'Applications.Datastores'.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))\\.([A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9]))?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceTypeResourceListResult" + "$ref": "#/definitions/ResourceGroupResourceListResult" } }, "default": { @@ -2534,8 +2577,8 @@ } }, "x-ms-examples": { - "List resource types defined by a resource provider.": { - "$ref": "./examples/ResourceTypes_List.json" + "List resource groups": { + "$ref": "./examples/ResourceGroups_List.json" } }, "x-ms-pageable": { @@ -2544,60 +2587,6 @@ } }, "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}": { - "get": { - "operationId": "Resources_List", - "tags": [ - "Resources" - ], - "description": "List resources in a resource group", - "parameters": [ - { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" - }, - { - "name": "planeName", - "in": "path", - "description": "The plane name.", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - }, - { - "name": "resourceGroupName", - "in": "path", - "description": "The name of resource group", - "required": true, - "type": "string", - "maxLength": 63, - "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" - } - ], - "responses": { - "200": { - "description": "Azure operation completed successfully.", - "schema": { - "$ref": "#/definitions/GenericResourceListResult" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" - } - } - }, - "x-ms-examples": { - "List resources in a resource group.": { - "$ref": "./examples/Resources_List.json" - } - }, - "x-ms-pageable": { - "nextLinkName": "nextLink" - } - } - }, - "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/radius/{planeName}/resourcegroups/{resourceGroupName}": { "get": { "operationId": "ResourceGroups_Get", "tags": [ @@ -2819,13 +2808,13 @@ } } }, - "/planes/radius/{planeName}/resourcegroups/radius/{planeName}": { + "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/resources": { "get": { - "operationId": "ResourceGroups_List", + "operationId": "Resources_List", "tags": [ - "ResourceGroups" + "Resources" ], - "description": "List resource groups", + "description": "List resources in a resource group", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" @@ -2838,13 +2827,22 @@ "type": "string", "maxLength": 63, "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resourceGroupName", + "in": "path", + "description": "The name of resource group", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "#/definitions/ResourceGroupResourceListResult" + "$ref": "#/definitions/GenericResourceListResult" } }, "default": { @@ -2855,8 +2853,8 @@ } }, "x-ms-examples": { - "List resource groups": { - "$ref": "./examples/ResourceGroups_List.json" + "List resources in a resource group.": { + "$ref": "./examples/Resources_List.json" } }, "x-ms-pageable": { diff --git a/typespec/UCP/aws-credentials.tsp b/typespec/UCP/aws-credentials.tsp index 5d19412884..7f4d68ab1f 100644 --- a/typespec/UCP/aws-credentials.tsp +++ b/typespec/UCP/aws-credentials.tsp @@ -108,15 +108,14 @@ model AwsIRSACredentialProperties extends AwsCredentialProperties { storage: CredentialStorageProperties; } -alias AwsCredentialBaseParameter = CredentialBaseParameters< - Resource, +alias AwsCredentialBaseParameter = CredentialBaseParameters< + TResource, AwsPlaneNameParameter >; @armResourceOperations interface AwsCredentials { @doc("List AWS credentials") - @route("planes/aws") list is UcpResourceList< AwsCredentialResource, { @@ -126,28 +125,24 @@ interface AwsCredentials { >; @doc("Get an AWS credential") - @route("planes/aws/{planeName}") get is UcpResourceRead< AwsCredentialResource, AwsCredentialBaseParameter >; @doc("Create or update an AWS credential") - @route("planes/aws/{planeName}") createOrUpdate is UcpResourceCreateOrUpdateSync< AwsCredentialResource, AwsCredentialBaseParameter >; @doc("Update an AWS credential") - @route("planes/aws/{planeName}") update is UcpCustomPatchSync< AwsCredentialResource, AwsCredentialBaseParameter >; @doc("Delete an AWS credential") - @route("planes/aws/{planeName}") delete is UcpResourceDeleteSync< AwsCredentialResource, AwsCredentialBaseParameter diff --git a/typespec/UCP/azure-credentials.tsp b/typespec/UCP/azure-credentials.tsp index e60b3e1c28..ad18ba8150 100644 --- a/typespec/UCP/azure-credentials.tsp +++ b/typespec/UCP/azure-credentials.tsp @@ -114,8 +114,8 @@ model AzureWorkloadIdentityProperties extends AzureCredentialProperties { storage: CredentialStorageProperties; } -alias AzureCredentialBaseParameter = CredentialBaseParameters< - Resource, +alias AzureCredentialBaseParameter = CredentialBaseParameters< + TResource, AzurePlaneNameParameter >; @@ -123,7 +123,6 @@ alias AzureCredentialBaseParameter = CredentialBaseParameters< @armResourceOperations interface AzureCredentials { @doc("List Azure credentials") - @route("planes/azure") list is UcpResourceList< AzureCredentialResource, { @@ -133,7 +132,6 @@ interface AzureCredentials { >; @doc("Get an Azure credential") - @route("planes/azure/{planeName}") get is UcpResourceRead< AzureCredentialResource, AzureCredentialBaseParameter diff --git a/typespec/UCP/common.tsp b/typespec/UCP/common.tsp index 6095a55e70..6e26894eee 100644 --- a/typespec/UCP/common.tsp +++ b/typespec/UCP/common.tsp @@ -36,10 +36,10 @@ using Azure.ResourceManager.Foundations; using OpenAPI; @doc("The UCP HTTP request base parameters.") -model CredentialBaseParameters { +model CredentialBaseParameters { ...ApiVersionParameter; ...TPlaneName; - ...KeysOf; + ...KeysOf; } @doc("Credential store kinds supported.") diff --git a/typespec/UCP/planes.tsp b/typespec/UCP/planes.tsp index 9c22515738..7c6637c5ad 100644 --- a/typespec/UCP/planes.tsp +++ b/typespec/UCP/planes.tsp @@ -48,9 +48,9 @@ model PlaneNameParameter { } @doc("The UCP HTTP request base parameters.") -model PlaneBaseParameters { +model PlaneBaseParameters { ...ApiVersionParameter; - ...KeysOf; + ...KeysOf; } @doc("The generic representation of a plane resource") diff --git a/typespec/UCP/resourcegroups.tsp b/typespec/UCP/resourcegroups.tsp index 1541cdaba6..7a9b6c176a 100644 --- a/typespec/UCP/resourcegroups.tsp +++ b/typespec/UCP/resourcegroups.tsp @@ -68,43 +68,39 @@ model GenericResource extends ProxyResource { model ResourceProperties {} @doc("The UCP HTTP request base parameters.") -model ResourceGroupBaseParameters { +model ResourceGroupBaseParameters { ...PlaneBaseParameters; - ...KeysOf; + ...KeysOf; } +@route("/planes") @armResourceOperations interface ResourceGroups { @doc("List resource groups") - @route("planes/radius/{planeName}/resourcegroups") list is UcpResourceList< ResourceGroupResource, PlaneBaseParameters >; @doc("Get a resource group") - @route("planes/radius/{planeName}/resourcegroups/{resourceGroupName}") get is UcpResourceRead< ResourceGroupResource, ResourceGroupBaseParameters >; @doc("Create or update a resource group") - @route("planes/radius/{planeName}/resourcegroups/{resourceGroupName}") createOrUpdate is UcpResourceCreateOrUpdateSync< ResourceGroupResource, ResourceGroupBaseParameters >; @doc("Update a resource group") - @route("planes/radius/{planeName}/resourcegroups/{resourceGroupName}") update is UcpCustomPatchSync< ResourceGroupResource, ResourceGroupBaseParameters >; @doc("Delete a resource group") - @route("planes/radius/{planeName}/resourcegroups/{resourceGroupName}") delete is UcpResourceDeleteSync< ResourceGroupResource, ResourceGroupBaseParameters diff --git a/typespec/UCP/resourceproviders.tsp b/typespec/UCP/resourceproviders.tsp index 99c863dcda..adc706c63b 100644 --- a/typespec/UCP/resourceproviders.tsp +++ b/typespec/UCP/resourceproviders.tsp @@ -174,57 +174,52 @@ model ResourceProviderSummaryResourceType { @doc("The configuration of a resource type API version.") model ResourceTypeSummaryResultApiVersion {} -model ResourceProviderBaseParameters { +model ResourceProviderBaseParameters { ...PlaneBaseParameters; - ...KeysOf; + ...KeysOf; } -model ResourceTypeBaseParameters { +model ResourceTypeBaseParameters { ...PlaneBaseParameters; ...KeysOf; - ...KeysOf; + ...KeysOf; } -model ApiVersionBaseParameters { +model ApiVersionBaseParameters { ...PlaneBaseParameters; ...KeysOf; ...KeysOf; - ...KeysOf; + ...KeysOf; } -model LocationBaseParameters { +model LocationBaseParameters { ...PlaneBaseParameters; ...KeysOf; - ...KeysOf; + ...KeysOf; } - @route("/planes") @armResourceOperations interface ResourceProviders { @doc("List resource providers.") - @route("/planes/radius/{planeName}/providers/System.Resources/resourceproviders") list is UcpResourceList< ResourceProviderResource, PlaneBaseParameters >; @doc("Get the specified resource provider.") - //@route("planes/{resourceProviderName}") get is UcpResourceRead< ResourceProviderResource, ResourceProviderBaseParameters >; @doc("Create or update a resource provider") - //@route("planes/{resourceProviderName}") createOrUpdate is UcpResourceCreateOrUpdateAsync< ResourceProviderResource, ResourceProviderBaseParameters >; @doc("Delete a resource provider") - //@route("planes/{resourceProviderName}") delete is UcpResourceDeleteAsync< ResourceProviderResource, ResourceProviderBaseParameters @@ -247,31 +242,28 @@ interface ResourceProviders { ): ArmResponse | ErrorResponse; } +@route("/planes") @armResourceOperations interface ResourceTypes { @doc("List resource types.") - @route("planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes") list is UcpResourceList< ResourceTypeResource, ResourceProviderBaseParameters >; @doc("Get the specified resource type.") - @route("planes/{resourceTypeName}") get is UcpResourceRead< ResourceTypeResource, ResourceTypeBaseParameters >; @doc("Create or update a resource type") - @route("planes/{resourceTypeName}") createOrUpdate is UcpResourceCreateOrUpdateAsync< ResourceTypeResource, ResourceTypeBaseParameters >; @doc("Delete a resource type") - @route("planes/{resourceTypeName}") delete is UcpResourceDeleteAsync< ResourceTypeResource, ResourceTypeBaseParameters @@ -310,7 +302,6 @@ interface ApiVersions { @armResourceOperations interface Locations { @doc("List available locations for the specified resource provider.") - @route("planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations") list is UcpResourceList< LocationResource, ResourceProviderBaseParameters diff --git a/typespec/UCP/ucp-operations.tsp b/typespec/UCP/ucp-operations.tsp index f39533e98a..6a0244755f 100644 --- a/typespec/UCP/ucp-operations.tsp +++ b/typespec/UCP/ucp-operations.tsp @@ -20,7 +20,6 @@ import "@azure-tools/typespec-autorest"; import "@azure-tools/typespec-azure-core"; import "@azure-tools/typespec-azure-resource-manager"; - using TypeSpec.Http; using TypeSpec.Rest; using Azure.ResourceManager; @@ -31,30 +30,31 @@ using OpenAPI; // https://github.com/Azure/typespec-azure/blob/main/packages/typespec-azure-resource-manager/lib/operations.tsp #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" -@get @autoRoute -@doc("List {name}", Azure.ResourceManager.CommonTypes.Resource) -@armResourceList(Azure.ResourceManager.CommonTypes.Resource) +@doc("List {name}", TResource) +@segmentOf(TResource) +@armResourceList(TResource) +@get op UcpResourceList< - ResourceType extends Azure.ResourceManager.CommonTypes.Resource, + TResource extends Foundations.Resource, TBaseParameters>( ...TBaseParameters, - ...ParentKeysOf, -): ArmResponse> | ErrorResponse; + ...ParentKeysOf, +): ArmResponse> | ErrorResponse; -#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-xoutside-interface" +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Get a {name}", Resource) +@doc("Get a {name}", TResource) @get -@armResourceRead(Resource) op UcpResourceRead< - Resource extends Foundations.Resource, TBaseParameters>( + TResource extends Foundations.Resource, + TBaseParameters>( ...TBaseParameters, -): ArmResponse | ErrorResponse; +): ArmResponse | ErrorResponse; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Create a {name}", Resource) +@doc("Create a {name}", TResource) @extension("x-ms-long-running-operation", true) @extension( "x-ms-long-running-operation-options", @@ -62,22 +62,22 @@ op UcpResourceRead< `final-state-via`: "azure-async-operation", } ) -@armResourceCreateOrUpdate(Resource) +@armResourceCreateOrUpdate(TResource) @put op UcpResourceCreateOrUpdateAsync< - Resource extends Foundations.Resource, + TResource extends Foundations.Resource, TBaseParameters >( ...TBaseParameters, @doc("Resource create parameters.") @body - resource: Resource, -): ArmResourceUpdatedResponse | ArmResourceCreatedResponse | ErrorResponse; + resource: TResource, +): ArmResourceUpdatedResponse | ArmResourceCreatedResponse | ErrorResponse; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Update a {name}", Resource) +@doc("Update a {name}", TResource) @extension("x-ms-long-running-operation", true) @extension( "x-ms-long-running-operation-options", @@ -85,23 +85,23 @@ op UcpResourceCreateOrUpdateAsync< `final-state-via`: "location", } ) -@armResourceUpdate(Resource) +@armResourceUpdate(TResource) @patch op UcpCustomPatchAsync< - Resource extends Foundations.Resource, + TResource extends Foundations.Resource, TBaseParameters, - TPatchModel extends TypeSpec.Reflection.Model = TagsUpdateModel + TPatchModel extends TypeSpec.Reflection.Model = TagsUpdateModel >( ...TBaseParameters, @doc("The resource properties to be updated.") @body properties: TPatchModel, -): ArmResponse | ArmAcceptedLroResponse<"Resource update request accepted."> | ErrorResponse; +): ArmResponse | ArmAcceptedLroResponse<"Resource update request accepted."> | ErrorResponse; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Delete a {name}", Resource) +@doc("Delete a {name}", TResource) @extension("x-ms-long-running-operation", true) @extension( "x-ms-long-running-operation-options", @@ -109,10 +109,10 @@ op UcpCustomPatchAsync< `final-state-via`: "location", } ) -@armResourceDelete(Resource) +@armResourceDelete(TResource) @delete op UcpResourceDeleteAsync< - Resource extends Foundations.Resource, + TResource extends Foundations.Resource, TBaseParameters >(...TBaseParameters): | ArmDeletedResponse @@ -122,44 +122,44 @@ op UcpResourceDeleteAsync< #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Create a {name}", Resource) -@armResourceCreateOrUpdate(Resource) +@doc("Create a {name}", TResource) +@armResourceCreateOrUpdate(TResource) @put op UcpResourceCreateOrUpdateSync< - Resource extends Foundations.Resource, + TResource extends Foundations.Resource, TBaseParameters >( ...TBaseParameters, @doc("Resource create parameters.") @body - resource: Resource, -): ArmResourceUpdatedResponse | ArmResourceCreatedSyncResponse | ErrorResponse; + resource: TResource, +): ArmResourceUpdatedResponse | ArmResourceCreatedSyncResponse | ErrorResponse; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Update a {name}", Resource) -@armResourceUpdate(Resource) +@doc("Update a {name}", TResource) +@armResourceUpdate(TResource) @patch op UcpCustomPatchSync< - Resource extends Foundations.Resource, + TResource extends Foundations.Resource, TBaseParameters, - TPatchModel extends TypeSpec.Reflection.Model = TagsUpdateModel + TPatchModel extends TypeSpec.Reflection.Model = TagsUpdateModel >( ...TBaseParameters, @doc("The resource properties to be updated.") @body properties: TPatchModel, -): ArmResponse | ErrorResponse; +): ArmResponse | ErrorResponse; #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" @autoRoute -@doc("Delete a {name}", Resource) -@armResourceDelete(Resource) +@doc("Delete a {name}", TResource) +@armResourceDelete(TResource) @delete op UcpResourceDeleteSync< - Resource extends Foundations.Resource, + TResource extends Foundations.Resource, TBaseParameters >( ...TBaseParameters, diff --git a/typespec/radius/v1/ucprootscope.tsp b/typespec/radius/v1/ucprootscope.tsp index 5142cd4602..34862aea3a 100644 --- a/typespec/radius/v1/ucprootscope.tsp +++ b/typespec/radius/v1/ucprootscope.tsp @@ -35,7 +35,7 @@ model RootScopeParameter { } @doc("The UCP HTTP request base parameters.") -model UCPBaseParameters { +model UCPBaseParameters { ...ApiVersionParameter; ...RootScopeParameter; } From 29f82094d794bce6e3d6ac81c1cc08a7f86d208d Mon Sep 17 00:00:00 2001 From: lakshmimsft Date: Fri, 8 Nov 2024 19:34:45 -0800 Subject: [PATCH 6/9] format tsp Signed-off-by: lakshmimsft --- pkg/datastoresrp/api/README.md | 2 +- .../api/v20231001preview/zz_generated_constants.go | 2 +- typespec/UCP/ucp-operations.tsp | 8 ++------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/pkg/datastoresrp/api/README.md b/pkg/datastoresrp/api/README.md index 754c8ff045..dfdcd7716e 100644 --- a/pkg/datastoresrp/api/README.md +++ b/pkg/datastoresrp/api/README.md @@ -45,7 +45,7 @@ The following configuration generates track2 go models and client. ```yaml $(tag) != '' version: 3.*.* use: "@autorest/go@4.0.0-preview.69" -module: "github.com/radius-project/radius/pkg/datastoresrp/api" +module: "github.com/radius-project/radius/pkg/datastoresrp/api/v20231001preview" module-version: 0.0.1 file-prefix: zz_generated_ license-header: "Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information.\nCode generated by Microsoft (R) AutoRest Code Generator.\nChanges may cause incorrect behavior and will be lost if the code is regenerated." diff --git a/pkg/datastoresrp/api/v20231001preview/zz_generated_constants.go b/pkg/datastoresrp/api/v20231001preview/zz_generated_constants.go index 28c7d1dbff..23eccc0ff7 100644 --- a/pkg/datastoresrp/api/v20231001preview/zz_generated_constants.go +++ b/pkg/datastoresrp/api/v20231001preview/zz_generated_constants.go @@ -5,7 +5,7 @@ package v20231001preview const ( - moduleName = "github.com/radius-project/radius/pkg/datastoresrp/api" + moduleName = "github.com/radius-project/radius/pkg/datastoresrp/api/v20231001preview" moduleVersion = "v0.0.1" ) diff --git a/typespec/UCP/ucp-operations.tsp b/typespec/UCP/ucp-operations.tsp index 6a0244755f..3b8692b17b 100644 --- a/typespec/UCP/ucp-operations.tsp +++ b/typespec/UCP/ucp-operations.tsp @@ -35,9 +35,7 @@ using OpenAPI; @segmentOf(TResource) @armResourceList(TResource) @get -op UcpResourceList< - TResource extends Foundations.Resource, - TBaseParameters>( +op UcpResourceList( ...TBaseParameters, ...ParentKeysOf, ): ArmResponse> | ErrorResponse; @@ -46,9 +44,7 @@ op UcpResourceList< @autoRoute @doc("Get a {name}", TResource) @get -op UcpResourceRead< - TResource extends Foundations.Resource, - TBaseParameters>( +op UcpResourceRead( ...TBaseParameters, ): ArmResponse | ErrorResponse; From 2443da1cb618901b0b37770bf4d73af6ece85e5b Mon Sep 17 00:00:00 2001 From: lakshmimsft Date: Sat, 9 Nov 2024 22:07:53 -0800 Subject: [PATCH 7/9] add corerp Signed-off-by: lakshmimsft --- build/generate.mk | 6 +- pkg/corerp/api/README.md | 3 +- .../fake/zz_generated_applications_server.go | 314 ++++++++ .../fake/zz_generated_containers_server.go | 314 ++++++++ .../fake/zz_generated_environments_server.go | 314 ++++++++ .../fake/zz_generated_extenders_server.go | 353 +++++++++ .../fake/zz_generated_gateways_server.go | 314 ++++++++ .../fake/zz_generated_internal.go | 66 ++ .../fake/zz_generated_operations_server.go | 118 +++ .../fake/zz_generated_secretstores_server.go | 353 +++++++++ .../fake/zz_generated_server_factory.go | 122 +++ .../fake/zz_generated_time_rfc3339.go | 114 +++ .../fake/zz_generated_volumes_server.go | 314 ++++++++ .../zz_generated_applications_client.go | 66 +- .../zz_generated_client_factory.go | 67 +- .../zz_generated_constants.go | 101 ++- .../zz_generated_containers_client.go | 73 +- .../zz_generated_environments_client.go | 66 +- .../zz_generated_extenders_client.go | 81 +- .../zz_generated_gateways_client.go | 73 +- .../zz_generated_interfaces.go | 3 - .../v20231001preview/zz_generated_models.go | 745 +++++++++--------- .../zz_generated_models_serde.go | 13 +- .../zz_generated_operations_client.go | 30 +- .../v20231001preview/zz_generated_options.go | 33 +- .../zz_generated_polymorphic_helpers.go | 21 +- ...nse_types.go => zz_generated_responses.go} | 69 +- .../zz_generated_secretstores_client.go | 81 +- .../zz_generated_time_rfc3339.go | 76 +- .../zz_generated_volumes_client.go | 73 +- 30 files changed, 3602 insertions(+), 774 deletions(-) create mode 100644 pkg/corerp/api/v20231001preview/fake/zz_generated_applications_server.go create mode 100644 pkg/corerp/api/v20231001preview/fake/zz_generated_containers_server.go create mode 100644 pkg/corerp/api/v20231001preview/fake/zz_generated_environments_server.go create mode 100644 pkg/corerp/api/v20231001preview/fake/zz_generated_extenders_server.go create mode 100644 pkg/corerp/api/v20231001preview/fake/zz_generated_gateways_server.go create mode 100644 pkg/corerp/api/v20231001preview/fake/zz_generated_internal.go create mode 100644 pkg/corerp/api/v20231001preview/fake/zz_generated_operations_server.go create mode 100644 pkg/corerp/api/v20231001preview/fake/zz_generated_secretstores_server.go create mode 100644 pkg/corerp/api/v20231001preview/fake/zz_generated_server_factory.go create mode 100644 pkg/corerp/api/v20231001preview/fake/zz_generated_time_rfc3339.go create mode 100644 pkg/corerp/api/v20231001preview/fake/zz_generated_volumes_server.go rename pkg/corerp/api/v20231001preview/{zz_generated_response_types.go => zz_generated_responses.go} (78%) diff --git a/build/generate.mk b/build/generate.mk index b466729df8..dbb4129736 100644 --- a/build/generate.mk +++ b/build/generate.mk @@ -79,12 +79,12 @@ generate-genericcliclient: generate-node-installed generate-autorest-installed .PHONY: generate-rad-corerp-client generate-rad-corerp-client: generate-node-installed generate-autorest-installed generate-tsp-installed generate-openapi-spec ## Generates the corerp client SDK (Autorest). @echo "$(AUTOREST_MODULE_VERSION) is module version" - autorest pkg/corerp/api/README.md --tag=core-2023-10-01-preview + autorest pkg/corerp/api/README.md --tag=core-2023-10-01-preview && rm pkg/corerp/api/v20231001preview/go.mod .PHONY: generate-rad-datastoresrp-client generate-rad-datastoresrp-client: generate-node-installed generate-autorest-installed generate-tsp-installed generate-openapi-spec ## Generates the datastoresrp client SDK (Autorest). @echo "$(AUTOREST_MODULE_VERSION) is module version" - autorest pkg/datastoresrp/api/README.md --tag=datastores-2023-10-01-preview + autorest pkg/datastoresrp/api/README.md --tag=datastores-2023-10-01-preview && rm pkg/datastoresrp/api/v20231001preview/go.mod .PHONY: generate-rad-messagingrp-client generate-rad-messagingrp-client: generate-node-installed generate-autorest-installed generate-tsp-installed generate-openapi-spec ## Generates the messagingrp client SDK (Autorest). @@ -94,7 +94,7 @@ generate-rad-messagingrp-client: generate-node-installed generate-autorest-insta .PHONY: generate-rad-daprrp-client generate-rad-daprrp-client: generate-node-installed generate-autorest-installed generate-tsp-installed generate-openapi-spec ## Generates the daprrp client SDK (Autorest). @echo "$(AUTOREST_MODULE_VERSION) is module version" - autorest pkg/daprrp/api/README.md --tag=dapr-2023-10-01-preview + autorest pkg/daprrp/api/README.md --tag=dapr-2023-10-01-preview .PHONY: generate-rad-ucp-client generate-rad-ucp-client: generate-node-installed generate-autorest-installed test-ucp-spec-examples ## Generates the UCP client SDK (Autorest). diff --git a/pkg/corerp/api/README.md b/pkg/corerp/api/README.md index 14b2f7e099..76db986af6 100644 --- a/pkg/corerp/api/README.md +++ b/pkg/corerp/api/README.md @@ -46,7 +46,8 @@ The following configuration generates track2 go models and client. ```yaml $(tag) != '' version: 3.*.* -use: "@autorest/go@4.0.0-preview.55" +use: "@autorest/go@4.0.0-preview.69" +module: "github.com/radius-project/radius/pkg/corerp/api/v20231001preview" module-version: 0.0.1 file-prefix: zz_generated_ license-header: "Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information.\nCode generated by Microsoft (R) AutoRest Code Generator.\nChanges may cause incorrect behavior and will be lost if the code is regenerated." diff --git a/pkg/corerp/api/v20231001preview/fake/zz_generated_applications_server.go b/pkg/corerp/api/v20231001preview/fake/zz_generated_applications_server.go new file mode 100644 index 0000000000..d19b675056 --- /dev/null +++ b/pkg/corerp/api/v20231001preview/fake/zz_generated_applications_server.go @@ -0,0 +1,314 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/corerp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// ApplicationsServer is a fake server for instances of the v20231001preview.ApplicationsClient type. +type ApplicationsServer struct{ + // CreateOrUpdate is the fake for method ApplicationsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, applicationName string, resource v20231001preview.ApplicationResource, options *v20231001preview.ApplicationsClientCreateOrUpdateOptions) (resp azfake.Responder[v20231001preview.ApplicationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method ApplicationsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, applicationName string, options *v20231001preview.ApplicationsClientDeleteOptions) (resp azfake.Responder[v20231001preview.ApplicationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ApplicationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, applicationName string, options *v20231001preview.ApplicationsClientGetOptions) (resp azfake.Responder[v20231001preview.ApplicationsClientGetResponse], errResp azfake.ErrorResponder) + + // GetGraph is the fake for method ApplicationsClient.GetGraph + // HTTP status codes to indicate success: http.StatusOK + GetGraph func(ctx context.Context, applicationName string, body map[string]any, options *v20231001preview.ApplicationsClientGetGraphOptions) (resp azfake.Responder[v20231001preview.ApplicationsClientGetGraphResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method ApplicationsClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.ApplicationsClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.ApplicationsClientListByScopeResponse]) + + // Update is the fake for method ApplicationsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, applicationName string, properties v20231001preview.ApplicationResourceUpdate, options *v20231001preview.ApplicationsClientUpdateOptions) (resp azfake.Responder[v20231001preview.ApplicationsClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewApplicationsServerTransport creates a new instance of ApplicationsServerTransport with the provided implementation. +// The returned ApplicationsServerTransport instance is connected to an instance of v20231001preview.ApplicationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewApplicationsServerTransport(srv *ApplicationsServer) *ApplicationsServerTransport { + return &ApplicationsServerTransport{ + srv: srv, + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.ApplicationsClientListByScopeResponse]](), + } +} + +// ApplicationsServerTransport connects instances of v20231001preview.ApplicationsClient to instances of ApplicationsServer. +// Don't use this type directly, use NewApplicationsServerTransport instead. +type ApplicationsServerTransport struct { + srv *ApplicationsServer + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.ApplicationsClientListByScopeResponse]] +} + +// Do implements the policy.Transporter interface for ApplicationsServerTransport. +func (a *ApplicationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *ApplicationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if applicationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = applicationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ApplicationsClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "ApplicationsClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "ApplicationsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "ApplicationsClient.GetGraph": + res.resp, res.err = a.dispatchGetGraph(req) + case "ApplicationsClient.NewListByScopePager": + res.resp, res.err = a.dispatchNewListByScopePager(req) + case "ApplicationsClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *ApplicationsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/applications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.ApplicationResource](req) + if err != nil { + return nil, err + } + applicationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.CreateOrUpdate(req.Context(), applicationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ApplicationResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ApplicationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if a.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/applications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + applicationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Delete(req.Context(), applicationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ApplicationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/applications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + applicationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), applicationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ApplicationResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ApplicationsServerTransport) dispatchGetGraph(req *http.Request) (*http.Response, error) { + if a.srv.GetGraph == nil { + return nil, &nonRetriableError{errors.New("fake for method GetGraph not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/applications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getGraph` + 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) + } + body, err := server.UnmarshalRequestAsJSON[map[string]any](req) + if err != nil { + return nil, err + } + applicationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.GetGraph(req.Context(), applicationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ApplicationGraphResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ApplicationsServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := a.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/applications` + 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 := a.srv.NewListByScopePager(nil) + newListByScopePager = &resp + a.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.ApplicationsClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + a.newListByScopePager.remove(req) + } + return resp, nil +} + +func (a *ApplicationsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if a.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/applications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.ApplicationResourceUpdate](req) + if err != nil { + return nil, err + } + applicationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Update(req.Context(), applicationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ApplicationResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ApplicationsServerTransport +var applicationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/corerp/api/v20231001preview/fake/zz_generated_containers_server.go b/pkg/corerp/api/v20231001preview/fake/zz_generated_containers_server.go new file mode 100644 index 0000000000..06a459636f --- /dev/null +++ b/pkg/corerp/api/v20231001preview/fake/zz_generated_containers_server.go @@ -0,0 +1,314 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/corerp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// ContainersServer is a fake server for instances of the v20231001preview.ContainersClient type. +type ContainersServer struct{ + // BeginCreateOrUpdate is the fake for method ContainersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, containerName string, resource v20231001preview.ContainerResource, options *v20231001preview.ContainersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.ContainersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ContainersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, containerName string, options *v20231001preview.ContainersClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.ContainersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ContainersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, containerName string, options *v20231001preview.ContainersClientGetOptions) (resp azfake.Responder[v20231001preview.ContainersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method ContainersClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.ContainersClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.ContainersClientListByScopeResponse]) + + // BeginUpdate is the fake for method ContainersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, containerName string, properties v20231001preview.ContainerResourceUpdate, options *v20231001preview.ContainersClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.ContainersClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewContainersServerTransport creates a new instance of ContainersServerTransport with the provided implementation. +// The returned ContainersServerTransport instance is connected to an instance of v20231001preview.ContainersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewContainersServerTransport(srv *ContainersServer) *ContainersServerTransport { + return &ContainersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.ContainersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.ContainersClientDeleteResponse]](), + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.ContainersClientListByScopeResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.ContainersClientUpdateResponse]](), + } +} + +// ContainersServerTransport connects instances of v20231001preview.ContainersClient to instances of ContainersServer. +// Don't use this type directly, use NewContainersServerTransport instead. +type ContainersServerTransport struct { + srv *ContainersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.ContainersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.ContainersClientDeleteResponse]] + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.ContainersClientListByScopeResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.ContainersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for ContainersServerTransport. +func (c *ContainersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return c.dispatchToMethodFake(req, method) +} + +func (c *ContainersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if containersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = containersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ContainersClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "ContainersClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "ContainersClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "ContainersClient.NewListByScopePager": + res.resp, res.err = c.dispatchNewListByScopePager(req) + case "ContainersClient.BeginUpdate": + res.resp, res.err = c.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (c *ContainersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := c.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.ContainerResource](req) + if err != nil { + return nil, err + } + containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), containerNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + c.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (c *ContainersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), containerNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *ContainersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), containerNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ContainerResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ContainersServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := c.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/containers` + 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 := c.srv.NewListByScopePager(nil) + newListByScopePager = &resp + c.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.ContainersClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + c.newListByScopePager.remove(req) + } + return resp, nil +} + +func (c *ContainersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := c.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/containers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.ContainerResourceUpdate](req) + if err != nil { + return nil, err + } + containerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("containerName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdate(req.Context(), containerNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + c.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + c.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to ContainersServerTransport +var containersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/corerp/api/v20231001preview/fake/zz_generated_environments_server.go b/pkg/corerp/api/v20231001preview/fake/zz_generated_environments_server.go new file mode 100644 index 0000000000..290ccdd8af --- /dev/null +++ b/pkg/corerp/api/v20231001preview/fake/zz_generated_environments_server.go @@ -0,0 +1,314 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/corerp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// EnvironmentsServer is a fake server for instances of the v20231001preview.EnvironmentsClient type. +type EnvironmentsServer struct{ + // CreateOrUpdate is the fake for method EnvironmentsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, environmentName string, resource v20231001preview.EnvironmentResource, options *v20231001preview.EnvironmentsClientCreateOrUpdateOptions) (resp azfake.Responder[v20231001preview.EnvironmentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method EnvironmentsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, environmentName string, options *v20231001preview.EnvironmentsClientDeleteOptions) (resp azfake.Responder[v20231001preview.EnvironmentsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EnvironmentsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, environmentName string, options *v20231001preview.EnvironmentsClientGetOptions) (resp azfake.Responder[v20231001preview.EnvironmentsClientGetResponse], errResp azfake.ErrorResponder) + + // GetMetadata is the fake for method EnvironmentsClient.GetMetadata + // HTTP status codes to indicate success: http.StatusOK + GetMetadata func(ctx context.Context, environmentName string, body v20231001preview.RecipeGetMetadata, options *v20231001preview.EnvironmentsClientGetMetadataOptions) (resp azfake.Responder[v20231001preview.EnvironmentsClientGetMetadataResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method EnvironmentsClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.EnvironmentsClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.EnvironmentsClientListByScopeResponse]) + + // Update is the fake for method EnvironmentsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, environmentName string, properties v20231001preview.EnvironmentResourceUpdate, options *v20231001preview.EnvironmentsClientUpdateOptions) (resp azfake.Responder[v20231001preview.EnvironmentsClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewEnvironmentsServerTransport creates a new instance of EnvironmentsServerTransport with the provided implementation. +// The returned EnvironmentsServerTransport instance is connected to an instance of v20231001preview.EnvironmentsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEnvironmentsServerTransport(srv *EnvironmentsServer) *EnvironmentsServerTransport { + return &EnvironmentsServerTransport{ + srv: srv, + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.EnvironmentsClientListByScopeResponse]](), + } +} + +// EnvironmentsServerTransport connects instances of v20231001preview.EnvironmentsClient to instances of EnvironmentsServer. +// Don't use this type directly, use NewEnvironmentsServerTransport instead. +type EnvironmentsServerTransport struct { + srv *EnvironmentsServer + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.EnvironmentsClientListByScopeResponse]] +} + +// Do implements the policy.Transporter interface for EnvironmentsServerTransport. +func (e *EnvironmentsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *EnvironmentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if environmentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = environmentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EnvironmentsClient.CreateOrUpdate": + res.resp, res.err = e.dispatchCreateOrUpdate(req) + case "EnvironmentsClient.Delete": + res.resp, res.err = e.dispatchDelete(req) + case "EnvironmentsClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EnvironmentsClient.GetMetadata": + res.resp, res.err = e.dispatchGetMetadata(req) + case "EnvironmentsClient.NewListByScopePager": + res.resp, res.err = e.dispatchNewListByScopePager(req) + case "EnvironmentsClient.Update": + res.resp, res.err = e.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (e *EnvironmentsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/environments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.EnvironmentResource](req) + if err != nil { + return nil, err + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.CreateOrUpdate(req.Context(), environmentNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EnvironmentResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EnvironmentsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if e.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/environments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Delete(req.Context(), environmentNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EnvironmentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/environments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), environmentNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EnvironmentResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EnvironmentsServerTransport) dispatchGetMetadata(req *http.Request) (*http.Response, error) { + if e.srv.GetMetadata == nil { + return nil, &nonRetriableError{errors.New("fake for method GetMetadata not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/environments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getMetadata` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.RecipeGetMetadata](req) + if err != nil { + return nil, err + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.GetMetadata(req.Context(), environmentNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RecipeGetMetadataResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EnvironmentsServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := e.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/environments` + 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 := e.srv.NewListByScopePager(nil) + newListByScopePager = &resp + e.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.EnvironmentsClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + e.newListByScopePager.remove(req) + } + return resp, nil +} + +func (e *EnvironmentsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if e.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/environments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.EnvironmentResourceUpdate](req) + if err != nil { + return nil, err + } + environmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("environmentName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Update(req.Context(), environmentNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).EnvironmentResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to EnvironmentsServerTransport +var environmentsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/corerp/api/v20231001preview/fake/zz_generated_extenders_server.go b/pkg/corerp/api/v20231001preview/fake/zz_generated_extenders_server.go new file mode 100644 index 0000000000..5a907cf020 --- /dev/null +++ b/pkg/corerp/api/v20231001preview/fake/zz_generated_extenders_server.go @@ -0,0 +1,353 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/corerp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// ExtendersServer is a fake server for instances of the v20231001preview.ExtendersClient type. +type ExtendersServer struct{ + // BeginCreateOrUpdate is the fake for method ExtendersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, extenderName string, resource v20231001preview.ExtenderResource, options *v20231001preview.ExtendersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.ExtendersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ExtendersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, extenderName string, options *v20231001preview.ExtendersClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.ExtendersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ExtendersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, extenderName string, options *v20231001preview.ExtendersClientGetOptions) (resp azfake.Responder[v20231001preview.ExtendersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method ExtendersClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.ExtendersClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.ExtendersClientListByScopeResponse]) + + // ListSecrets is the fake for method ExtendersClient.ListSecrets + // HTTP status codes to indicate success: http.StatusOK + ListSecrets func(ctx context.Context, extenderName string, body map[string]any, options *v20231001preview.ExtendersClientListSecretsOptions) (resp azfake.Responder[v20231001preview.ExtendersClientListSecretsResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method ExtendersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, extenderName string, properties v20231001preview.ExtenderResourceUpdate, options *v20231001preview.ExtendersClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.ExtendersClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewExtendersServerTransport creates a new instance of ExtendersServerTransport with the provided implementation. +// The returned ExtendersServerTransport instance is connected to an instance of v20231001preview.ExtendersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewExtendersServerTransport(srv *ExtendersServer) *ExtendersServerTransport { + return &ExtendersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.ExtendersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.ExtendersClientDeleteResponse]](), + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.ExtendersClientListByScopeResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.ExtendersClientUpdateResponse]](), + } +} + +// ExtendersServerTransport connects instances of v20231001preview.ExtendersClient to instances of ExtendersServer. +// Don't use this type directly, use NewExtendersServerTransport instead. +type ExtendersServerTransport struct { + srv *ExtendersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.ExtendersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.ExtendersClientDeleteResponse]] + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.ExtendersClientListByScopeResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.ExtendersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for ExtendersServerTransport. +func (e *ExtendersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *ExtendersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if extendersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = extendersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ExtendersClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "ExtendersClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "ExtendersClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "ExtendersClient.NewListByScopePager": + res.resp, res.err = e.dispatchNewListByScopePager(req) + case "ExtendersClient.ListSecrets": + res.resp, res.err = e.dispatchListSecrets(req) + case "ExtendersClient.BeginUpdate": + res.resp, res.err = e.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (e *ExtendersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/extenders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.ExtenderResource](req) + if err != nil { + return nil, err + } + extenderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extenderName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), extenderNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *ExtendersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/extenders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + extenderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extenderName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), extenderNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + e.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *ExtendersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/extenders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + extenderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extenderName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), extenderNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ExtenderResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *ExtendersServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := e.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/extenders` + 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 := e.srv.NewListByScopePager(nil) + newListByScopePager = &resp + e.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.ExtendersClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + e.newListByScopePager.remove(req) + } + return resp, nil +} + +func (e *ExtendersServerTransport) dispatchListSecrets(req *http.Request) (*http.Response, error) { + if e.srv.ListSecrets == nil { + return nil, &nonRetriableError{errors.New("fake for method ListSecrets not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/extenders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listSecrets` + 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) + } + body, err := server.UnmarshalRequestAsJSON[map[string]any](req) + if err != nil { + return nil, err + } + extenderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extenderName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.ListSecrets(req.Context(), extenderNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Value, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *ExtendersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := e.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/extenders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.ExtenderResourceUpdate](req) + if err != nil { + return nil, err + } + extenderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extenderName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginUpdate(req.Context(), extenderNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + e.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + e.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + e.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to ExtendersServerTransport +var extendersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/corerp/api/v20231001preview/fake/zz_generated_gateways_server.go b/pkg/corerp/api/v20231001preview/fake/zz_generated_gateways_server.go new file mode 100644 index 0000000000..9adb99fd43 --- /dev/null +++ b/pkg/corerp/api/v20231001preview/fake/zz_generated_gateways_server.go @@ -0,0 +1,314 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/corerp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// GatewaysServer is a fake server for instances of the v20231001preview.GatewaysClient type. +type GatewaysServer struct{ + // BeginCreate is the fake for method GatewaysClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, gatewayName string, resource v20231001preview.GatewayResource, options *v20231001preview.GatewaysClientBeginCreateOptions) (resp azfake.PollerResponder[v20231001preview.GatewaysClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginCreateOrUpdate is the fake for method GatewaysClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginCreateOrUpdate func(ctx context.Context, gatewayName string, properties v20231001preview.GatewayResourceUpdate, options *v20231001preview.GatewaysClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.GatewaysClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method GatewaysClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, gatewayName string, options *v20231001preview.GatewaysClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.GatewaysClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method GatewaysClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, gatewayName string, options *v20231001preview.GatewaysClientGetOptions) (resp azfake.Responder[v20231001preview.GatewaysClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method GatewaysClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.GatewaysClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.GatewaysClientListByScopeResponse]) + +} + +// NewGatewaysServerTransport creates a new instance of GatewaysServerTransport with the provided implementation. +// The returned GatewaysServerTransport instance is connected to an instance of v20231001preview.GatewaysClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewGatewaysServerTransport(srv *GatewaysServer) *GatewaysServerTransport { + return &GatewaysServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[v20231001preview.GatewaysClientCreateResponse]](), + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.GatewaysClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.GatewaysClientDeleteResponse]](), + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.GatewaysClientListByScopeResponse]](), + } +} + +// GatewaysServerTransport connects instances of v20231001preview.GatewaysClient to instances of GatewaysServer. +// Don't use this type directly, use NewGatewaysServerTransport instead. +type GatewaysServerTransport struct { + srv *GatewaysServer + beginCreate *tracker[azfake.PollerResponder[v20231001preview.GatewaysClientCreateResponse]] + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.GatewaysClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.GatewaysClientDeleteResponse]] + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.GatewaysClientListByScopeResponse]] +} + +// Do implements the policy.Transporter interface for GatewaysServerTransport. +func (g *GatewaysServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return g.dispatchToMethodFake(req, method) +} + +func (g *GatewaysServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if gatewaysServerTransportInterceptor != nil { + res.resp, res.err, intercepted = gatewaysServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GatewaysClient.BeginCreate": + res.resp, res.err = g.dispatchBeginCreate(req) + case "GatewaysClient.BeginCreateOrUpdate": + res.resp, res.err = g.dispatchBeginCreateOrUpdate(req) + case "GatewaysClient.BeginDelete": + res.resp, res.err = g.dispatchBeginDelete(req) + case "GatewaysClient.Get": + res.resp, res.err = g.dispatchGet(req) + case "GatewaysClient.NewListByScopePager": + res.resp, res.err = g.dispatchNewListByScopePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (g *GatewaysServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if g.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := g.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/gateways/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.GatewayResource](req) + if err != nil { + return nil, err + } + gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")]) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.BeginCreate(req.Context(), gatewayNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + g.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + g.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + g.beginCreate.remove(req) + } + + return resp, nil +} + +func (g *GatewaysServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if g.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := g.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/gateways/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.GatewayResourceUpdate](req) + if err != nil { + return nil, err + } + gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")]) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.BeginCreateOrUpdate(req.Context(), gatewayNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + g.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + g.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + g.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (g *GatewaysServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if g.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := g.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/gateways/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")]) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.BeginDelete(req.Context(), gatewayNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + g.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + g.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + g.beginDelete.remove(req) + } + + return resp, nil +} + +func (g *GatewaysServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if g.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/gateways/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + gatewayNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("gatewayName")]) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.Get(req.Context(), gatewayNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GatewayResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (g *GatewaysServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if g.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := g.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/gateways` + 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 := g.srv.NewListByScopePager(nil) + newListByScopePager = &resp + g.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.GatewaysClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + g.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + g.newListByScopePager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to GatewaysServerTransport +var gatewaysServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/corerp/api/v20231001preview/fake/zz_generated_internal.go b/pkg/corerp/api/v20231001preview/fake/zz_generated_internal.go new file mode 100644 index 0000000000..0c62457a83 --- /dev/null +++ b/pkg/corerp/api/v20231001preview/fake/zz_generated_internal.go @@ -0,0 +1,66 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/pkg/corerp/api/v20231001preview/fake/zz_generated_operations_server.go b/pkg/corerp/api/v20231001preview/fake/zz_generated_operations_server.go new file mode 100644 index 0000000000..287ff02c08 --- /dev/null +++ b/pkg/corerp/api/v20231001preview/fake/zz_generated_operations_server.go @@ -0,0 +1,118 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + 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/radius-project/radius/pkg/corerp/api/v20231001preview" + "net/http" +) + +// OperationsServer is a fake server for instances of the v20231001preview.OperationsClient type. +type OperationsServer struct{ + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *v20231001preview.OperationsClientListOptions) (resp azfake.PagerResponder[v20231001preview.OperationsClientListResponse]) + +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of v20231001preview.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[v20231001preview.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of v20231001preview.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[v20231001preview.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { +resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/corerp/api/v20231001preview/fake/zz_generated_secretstores_server.go b/pkg/corerp/api/v20231001preview/fake/zz_generated_secretstores_server.go new file mode 100644 index 0000000000..ed67274935 --- /dev/null +++ b/pkg/corerp/api/v20231001preview/fake/zz_generated_secretstores_server.go @@ -0,0 +1,353 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/corerp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// SecretStoresServer is a fake server for instances of the v20231001preview.SecretStoresClient type. +type SecretStoresServer struct{ + // BeginCreateOrUpdate is the fake for method SecretStoresClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, secretStoreName string, resource v20231001preview.SecretStoreResource, options *v20231001preview.SecretStoresClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.SecretStoresClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SecretStoresClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, secretStoreName string, options *v20231001preview.SecretStoresClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.SecretStoresClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SecretStoresClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, secretStoreName string, options *v20231001preview.SecretStoresClientGetOptions) (resp azfake.Responder[v20231001preview.SecretStoresClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method SecretStoresClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.SecretStoresClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.SecretStoresClientListByScopeResponse]) + + // ListSecrets is the fake for method SecretStoresClient.ListSecrets + // HTTP status codes to indicate success: http.StatusOK + ListSecrets func(ctx context.Context, secretStoreName string, body map[string]any, options *v20231001preview.SecretStoresClientListSecretsOptions) (resp azfake.Responder[v20231001preview.SecretStoresClientListSecretsResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method SecretStoresClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, secretStoreName string, properties v20231001preview.SecretStoreResourceUpdate, options *v20231001preview.SecretStoresClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.SecretStoresClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewSecretStoresServerTransport creates a new instance of SecretStoresServerTransport with the provided implementation. +// The returned SecretStoresServerTransport instance is connected to an instance of v20231001preview.SecretStoresClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSecretStoresServerTransport(srv *SecretStoresServer) *SecretStoresServerTransport { + return &SecretStoresServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.SecretStoresClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.SecretStoresClientDeleteResponse]](), + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.SecretStoresClientListByScopeResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.SecretStoresClientUpdateResponse]](), + } +} + +// SecretStoresServerTransport connects instances of v20231001preview.SecretStoresClient to instances of SecretStoresServer. +// Don't use this type directly, use NewSecretStoresServerTransport instead. +type SecretStoresServerTransport struct { + srv *SecretStoresServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.SecretStoresClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.SecretStoresClientDeleteResponse]] + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.SecretStoresClientListByScopeResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.SecretStoresClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for SecretStoresServerTransport. +func (s *SecretStoresServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *SecretStoresServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if secretStoresServerTransportInterceptor != nil { + res.resp, res.err, intercepted = secretStoresServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SecretStoresClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "SecretStoresClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SecretStoresClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SecretStoresClient.NewListByScopePager": + res.resp, res.err = s.dispatchNewListByScopePager(req) + case "SecretStoresClient.ListSecrets": + res.resp, res.err = s.dispatchListSecrets(req) + case "SecretStoresClient.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SecretStoresServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/secretStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.SecretStoreResource](req) + if err != nil { + return nil, err + } + secretStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("secretStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), secretStoreNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SecretStoresServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/secretStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + secretStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("secretStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), secretStoreNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + s.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SecretStoresServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/secretStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + secretStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("secretStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), secretStoreNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SecretStoreResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SecretStoresServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := s.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/secretStores` + 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 := s.srv.NewListByScopePager(nil) + newListByScopePager = &resp + s.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.SecretStoresClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + s.newListByScopePager.remove(req) + } + return resp, nil +} + +func (s *SecretStoresServerTransport) dispatchListSecrets(req *http.Request) (*http.Response, error) { + if s.srv.ListSecrets == nil { + return nil, &nonRetriableError{errors.New("fake for method ListSecrets not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/secretStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listSecrets` + 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) + } + body, err := server.UnmarshalRequestAsJSON[map[string]any](req) + if err != nil { + return nil, err + } + secretStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("secretStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.ListSecrets(req.Context(), secretStoreNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SecretStoreListSecretsResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SecretStoresServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := s.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/secretStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.SecretStoreResourceUpdate](req) + if err != nil { + return nil, err + } + secretStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("secretStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdate(req.Context(), secretStoreNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + s.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + s.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to SecretStoresServerTransport +var secretStoresServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/corerp/api/v20231001preview/fake/zz_generated_server_factory.go b/pkg/corerp/api/v20231001preview/fake/zz_generated_server_factory.go new file mode 100644 index 0000000000..b60f75263a --- /dev/null +++ b/pkg/corerp/api/v20231001preview/fake/zz_generated_server_factory.go @@ -0,0 +1,122 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the v20231001preview.ClientFactory type. +type ServerFactory struct { + // ApplicationsServer contains the fakes for client ApplicationsClient + ApplicationsServer ApplicationsServer + + // ContainersServer contains the fakes for client ContainersClient + ContainersServer ContainersServer + + // EnvironmentsServer contains the fakes for client EnvironmentsClient + EnvironmentsServer EnvironmentsServer + + // ExtendersServer contains the fakes for client ExtendersClient + ExtendersServer ExtendersServer + + // GatewaysServer contains the fakes for client GatewaysClient + GatewaysServer GatewaysServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // SecretStoresServer contains the fakes for client SecretStoresClient + SecretStoresServer SecretStoresServer + + // VolumesServer contains the fakes for client VolumesClient + VolumesServer VolumesServer + +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of v20231001preview.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of v20231001preview.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trApplicationsServer *ApplicationsServerTransport + trContainersServer *ContainersServerTransport + trEnvironmentsServer *EnvironmentsServerTransport + trExtendersServer *ExtendersServerTransport + trGatewaysServer *GatewaysServerTransport + trOperationsServer *OperationsServerTransport + trSecretStoresServer *SecretStoresServerTransport + trVolumesServer *VolumesServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "ApplicationsClient": + initServer(s, &s.trApplicationsServer, func() *ApplicationsServerTransport { return NewApplicationsServerTransport(&s.srv.ApplicationsServer) }) + resp, err = s.trApplicationsServer.Do(req) + case "ContainersClient": + initServer(s, &s.trContainersServer, func() *ContainersServerTransport { return NewContainersServerTransport(&s.srv.ContainersServer) }) + resp, err = s.trContainersServer.Do(req) + case "EnvironmentsClient": + initServer(s, &s.trEnvironmentsServer, func() *EnvironmentsServerTransport { return NewEnvironmentsServerTransport(&s.srv.EnvironmentsServer) }) + resp, err = s.trEnvironmentsServer.Do(req) + case "ExtendersClient": + initServer(s, &s.trExtendersServer, func() *ExtendersServerTransport { return NewExtendersServerTransport(&s.srv.ExtendersServer) }) + resp, err = s.trExtendersServer.Do(req) + case "GatewaysClient": + initServer(s, &s.trGatewaysServer, func() *GatewaysServerTransport { return NewGatewaysServerTransport(&s.srv.GatewaysServer) }) + resp, err = s.trGatewaysServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "SecretStoresClient": + initServer(s, &s.trSecretStoresServer, func() *SecretStoresServerTransport { return NewSecretStoresServerTransport(&s.srv.SecretStoresServer) }) + resp, err = s.trSecretStoresServer.Do(req) + case "VolumesClient": + initServer(s, &s.trVolumesServer, func() *VolumesServerTransport { return NewVolumesServerTransport(&s.srv.VolumesServer) }) + resp, err = s.trVolumesServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/pkg/corerp/api/v20231001preview/fake/zz_generated_time_rfc3339.go b/pkg/corerp/api/v20231001preview/fake/zz_generated_time_rfc3339.go new file mode 100644 index 0000000000..83c75cddc6 --- /dev/null +++ b/pkg/corerp/api/v20231001preview/fake/zz_generated_time_rfc3339.go @@ -0,0 +1,114 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + + + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + + + +// 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+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +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 + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/pkg/corerp/api/v20231001preview/fake/zz_generated_volumes_server.go b/pkg/corerp/api/v20231001preview/fake/zz_generated_volumes_server.go new file mode 100644 index 0000000000..ca342090b5 --- /dev/null +++ b/pkg/corerp/api/v20231001preview/fake/zz_generated_volumes_server.go @@ -0,0 +1,314 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/corerp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// VolumesServer is a fake server for instances of the v20231001preview.VolumesClient type. +type VolumesServer struct{ + // BeginCreateOrUpdate is the fake for method VolumesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, volumeName string, resource v20231001preview.VolumeResource, options *v20231001preview.VolumesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.VolumesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method VolumesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, volumeName string, options *v20231001preview.VolumesClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.VolumesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method VolumesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, volumeName string, options *v20231001preview.VolumesClientGetOptions) (resp azfake.Responder[v20231001preview.VolumesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method VolumesClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.VolumesClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.VolumesClientListByScopeResponse]) + + // BeginUpdate is the fake for method VolumesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, volumeName string, properties v20231001preview.VolumeResourceUpdate, options *v20231001preview.VolumesClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.VolumesClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewVolumesServerTransport creates a new instance of VolumesServerTransport with the provided implementation. +// The returned VolumesServerTransport instance is connected to an instance of v20231001preview.VolumesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewVolumesServerTransport(srv *VolumesServer) *VolumesServerTransport { + return &VolumesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.VolumesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.VolumesClientDeleteResponse]](), + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.VolumesClientListByScopeResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.VolumesClientUpdateResponse]](), + } +} + +// VolumesServerTransport connects instances of v20231001preview.VolumesClient to instances of VolumesServer. +// Don't use this type directly, use NewVolumesServerTransport instead. +type VolumesServerTransport struct { + srv *VolumesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.VolumesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.VolumesClientDeleteResponse]] + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.VolumesClientListByScopeResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.VolumesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for VolumesServerTransport. +func (v *VolumesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return v.dispatchToMethodFake(req, method) +} + +func (v *VolumesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if volumesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = volumesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "VolumesClient.BeginCreateOrUpdate": + res.resp, res.err = v.dispatchBeginCreateOrUpdate(req) + case "VolumesClient.BeginDelete": + res.resp, res.err = v.dispatchBeginDelete(req) + case "VolumesClient.Get": + res.resp, res.err = v.dispatchGet(req) + case "VolumesClient.NewListByScopePager": + res.resp, res.err = v.dispatchNewListByScopePager(req) + case "VolumesClient.BeginUpdate": + res.resp, res.err = v.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (v *VolumesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if v.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := v.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/volumes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.VolumeResource](req) + if err != nil { + return nil, err + } + volumeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("volumeName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginCreateOrUpdate(req.Context(), volumeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + v.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + v.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + v.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (v *VolumesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if v.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := v.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/volumes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + volumeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("volumeName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginDelete(req.Context(), volumeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + v.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + v.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + v.beginDelete.remove(req) + } + + return resp, nil +} + +func (v *VolumesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if v.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/volumes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + volumeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("volumeName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.Get(req.Context(), volumeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).VolumeResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (v *VolumesServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if v.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := v.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/volumes` + 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 := v.srv.NewListByScopePager(nil) + newListByScopePager = &resp + v.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.VolumesClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + v.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + v.newListByScopePager.remove(req) + } + return resp, nil +} + +func (v *VolumesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if v.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := v.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Core/volumes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.VolumeResourceUpdate](req) + if err != nil { + return nil, err + } + volumeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("volumeName")]) + if err != nil { + return nil, err + } + respr, errRespr := v.srv.BeginUpdate(req.Context(), volumeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + v.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + v.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + v.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to VolumesServerTransport +var volumesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/corerp/api/v20231001preview/zz_generated_applications_client.go b/pkg/corerp/api/v20231001preview/zz_generated_applications_client.go index 8ba3350638..d0559c68dd 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_applications_client.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_applications_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type ApplicationsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewApplicationsClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationsClient, error) { - cl, err := arm.NewClient(moduleName+".ApplicationsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -54,6 +51,10 @@ func NewApplicationsClient(rootScope string, credential azcore.TokenCredential, // method. func (client *ApplicationsClient) CreateOrUpdate(ctx context.Context, applicationName string, resource ApplicationResource, options *ApplicationsClientCreateOrUpdateOptions) (ApplicationsClientCreateOrUpdateResponse, error) { var err error + const operationName = "ApplicationsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, applicationName, resource, options) if err != nil { return ApplicationsClientCreateOrUpdateResponse{}, err @@ -71,7 +72,7 @@ func (client *ApplicationsClient) CreateOrUpdate(ctx context.Context, applicatio } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ApplicationsClient) createOrUpdateCreateRequest(ctx context.Context, applicationName string, resource ApplicationResource, options *ApplicationsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ApplicationsClient) createOrUpdateCreateRequest(ctx context.Context, applicationName string, resource ApplicationResource, _ *ApplicationsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/applications/{applicationName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if applicationName == "" { @@ -89,7 +90,7 @@ func (client *ApplicationsClient) createOrUpdateCreateRequest(ctx context.Contex if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -109,6 +110,10 @@ func (client *ApplicationsClient) createOrUpdateHandleResponse(resp *http.Respon // - options - ApplicationsClientDeleteOptions contains the optional parameters for the ApplicationsClient.Delete method. func (client *ApplicationsClient) Delete(ctx context.Context, applicationName string, options *ApplicationsClientDeleteOptions) (ApplicationsClientDeleteResponse, error) { var err error + const operationName = "ApplicationsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, applicationName, options) if err != nil { return ApplicationsClientDeleteResponse{}, err @@ -125,7 +130,7 @@ func (client *ApplicationsClient) Delete(ctx context.Context, applicationName st } // deleteCreateRequest creates the Delete request. -func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, applicationName string, options *ApplicationsClientDeleteOptions) (*policy.Request, error) { +func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, applicationName string, _ *ApplicationsClientDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/applications/{applicationName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if applicationName == "" { @@ -151,6 +156,10 @@ func (client *ApplicationsClient) deleteCreateRequest(ctx context.Context, appli // - options - ApplicationsClientGetOptions contains the optional parameters for the ApplicationsClient.Get method. func (client *ApplicationsClient) Get(ctx context.Context, applicationName string, options *ApplicationsClientGetOptions) (ApplicationsClientGetResponse, error) { var err error + const operationName = "ApplicationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, applicationName, options) if err != nil { return ApplicationsClientGetResponse{}, err @@ -168,7 +177,7 @@ func (client *ApplicationsClient) Get(ctx context.Context, applicationName strin } // getCreateRequest creates the Get request. -func (client *ApplicationsClient) getCreateRequest(ctx context.Context, applicationName string, options *ApplicationsClientGetOptions) (*policy.Request, error) { +func (client *ApplicationsClient) getCreateRequest(ctx context.Context, applicationName string, _ *ApplicationsClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/applications/{applicationName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if applicationName == "" { @@ -204,6 +213,10 @@ func (client *ApplicationsClient) getHandleResponse(resp *http.Response) (Applic // - options - ApplicationsClientGetGraphOptions contains the optional parameters for the ApplicationsClient.GetGraph method. func (client *ApplicationsClient) GetGraph(ctx context.Context, applicationName string, body map[string]any, options *ApplicationsClientGetGraphOptions) (ApplicationsClientGetGraphResponse, error) { var err error + const operationName = "ApplicationsClient.GetGraph" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getGraphCreateRequest(ctx, applicationName, body, options) if err != nil { return ApplicationsClientGetGraphResponse{}, err @@ -221,7 +234,7 @@ func (client *ApplicationsClient) GetGraph(ctx context.Context, applicationName } // getGraphCreateRequest creates the GetGraph request. -func (client *ApplicationsClient) getGraphCreateRequest(ctx context.Context, applicationName string, body map[string]any, options *ApplicationsClientGetGraphOptions) (*policy.Request, error) { +func (client *ApplicationsClient) getGraphCreateRequest(ctx context.Context, applicationName string, body map[string]any, _ *ApplicationsClientGetGraphOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/applications/{applicationName}/getGraph" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if applicationName == "" { @@ -239,7 +252,7 @@ func (client *ApplicationsClient) getGraphCreateRequest(ctx context.Context, app if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err } - return req, nil +; return req, nil } // getGraphHandleResponse handles the GetGraph response. @@ -262,30 +275,25 @@ func (client *ApplicationsClient) NewListByScopePager(options *ApplicationsClien return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ApplicationsClientListByScopeResponse) (ApplicationsClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ApplicationsClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return ApplicationsClientListByScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ApplicationsClientListByScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ApplicationsClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *ApplicationsClient) listByScopeCreateRequest(ctx context.Context, options *ApplicationsClientListByScopeOptions) (*policy.Request, error) { +func (client *ApplicationsClient) listByScopeCreateRequest(ctx context.Context, _ *ApplicationsClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/applications" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -317,6 +325,10 @@ func (client *ApplicationsClient) listByScopeHandleResponse(resp *http.Response) // - options - ApplicationsClientUpdateOptions contains the optional parameters for the ApplicationsClient.Update method. func (client *ApplicationsClient) Update(ctx context.Context, applicationName string, properties ApplicationResourceUpdate, options *ApplicationsClientUpdateOptions) (ApplicationsClientUpdateResponse, error) { var err error + const operationName = "ApplicationsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, applicationName, properties, options) if err != nil { return ApplicationsClientUpdateResponse{}, err @@ -334,7 +346,7 @@ func (client *ApplicationsClient) Update(ctx context.Context, applicationName st } // updateCreateRequest creates the Update request. -func (client *ApplicationsClient) updateCreateRequest(ctx context.Context, applicationName string, properties ApplicationResourceUpdate, options *ApplicationsClientUpdateOptions) (*policy.Request, error) { +func (client *ApplicationsClient) updateCreateRequest(ctx context.Context, applicationName string, properties ApplicationResourceUpdate, _ *ApplicationsClientUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/applications/{applicationName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if applicationName == "" { @@ -352,7 +364,7 @@ func (client *ApplicationsClient) updateCreateRequest(ctx context.Context, appli if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } // updateHandleResponse handles the Update response. diff --git a/pkg/corerp/api/v20231001preview/zz_generated_client_factory.go b/pkg/corerp/api/v20231001preview/zz_generated_client_factory.go index 99dcc0c53a..1b0e4adc79 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_client_factory.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_client_factory.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -16,8 +13,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { rootScope string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -28,53 +24,76 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - rootScope: rootScope, credential: credential, - options: options.Clone(), + rootScope: rootScope, + internal: internal, }, nil } +// NewApplicationsClient creates a new instance of ApplicationsClient. func (c *ClientFactory) NewApplicationsClient() *ApplicationsClient { - subClient, _ := NewApplicationsClient(c.rootScope, c.credential, c.options) - return subClient + return &ApplicationsClient{ + rootScope: c.rootScope, + internal: c.internal, + } } +// NewContainersClient creates a new instance of ContainersClient. func (c *ClientFactory) NewContainersClient() *ContainersClient { - subClient, _ := NewContainersClient(c.rootScope, c.credential, c.options) - return subClient + return &ContainersClient{ + rootScope: c.rootScope, + internal: c.internal, + } } +// NewEnvironmentsClient creates a new instance of EnvironmentsClient. func (c *ClientFactory) NewEnvironmentsClient() *EnvironmentsClient { - subClient, _ := NewEnvironmentsClient(c.rootScope, c.credential, c.options) - return subClient + return &EnvironmentsClient{ + rootScope: c.rootScope, + internal: c.internal, + } } +// NewExtendersClient creates a new instance of ExtendersClient. func (c *ClientFactory) NewExtendersClient() *ExtendersClient { - subClient, _ := NewExtendersClient(c.rootScope, c.credential, c.options) - return subClient + return &ExtendersClient{ + rootScope: c.rootScope, + internal: c.internal, + } } +// NewGatewaysClient creates a new instance of GatewaysClient. func (c *ClientFactory) NewGatewaysClient() *GatewaysClient { - subClient, _ := NewGatewaysClient(c.rootScope, c.credential, c.options) - return subClient + return &GatewaysClient{ + rootScope: c.rootScope, + internal: c.internal, + } } +// NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } +// NewSecretStoresClient creates a new instance of SecretStoresClient. func (c *ClientFactory) NewSecretStoresClient() *SecretStoresClient { - subClient, _ := NewSecretStoresClient(c.rootScope, c.credential, c.options) - return subClient + return &SecretStoresClient{ + rootScope: c.rootScope, + internal: c.internal, + } } +// NewVolumesClient creates a new instance of VolumesClient. func (c *ClientFactory) NewVolumesClient() *VolumesClient { - subClient, _ := NewVolumesClient(c.rootScope, c.credential, c.options) - return subClient + return &VolumesClient{ + rootScope: c.rootScope, + internal: c.internal, + } } diff --git a/pkg/corerp/api/v20231001preview/zz_generated_constants.go b/pkg/corerp/api/v20231001preview/zz_generated_constants.go index 585fce3e5b..2a6559bec3 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_constants.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_constants.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -8,7 +5,7 @@ package v20231001preview const ( - moduleName = "v20231001preview" + moduleName = "github.com/radius-project/radius/pkg/corerp/api/v20231001preview" moduleVersion = "v0.0.1" ) @@ -30,9 +27,9 @@ func PossibleActionTypeValues() []ActionType { type CertificateFormats string const ( - // CertificateFormatsPem - PEM Certificate format +// CertificateFormatsPem - PEM Certificate format CertificateFormatsPem CertificateFormats = "pem" - // CertificateFormatsPfx - PFX Certificate format +// CertificateFormatsPfx - PFX Certificate format CertificateFormatsPfx CertificateFormats = "pfx" ) @@ -48,11 +45,11 @@ func PossibleCertificateFormatsValues() []CertificateFormats { type CertificateTypes string const ( - // CertificateTypesCertificate - Certificate type +// CertificateTypesCertificate - Certificate type CertificateTypesCertificate CertificateTypes = "certificate" - // CertificateTypesPrivatekey - Private Key type +// CertificateTypesPrivatekey - Private Key type CertificateTypesPrivatekey CertificateTypes = "privatekey" - // CertificateTypesPublickey - Public Key type +// CertificateTypesPublickey - Public Key type CertificateTypesPublickey CertificateTypes = "publickey" ) @@ -71,9 +68,9 @@ func PossibleCertificateTypesValues() []CertificateTypes { type ContainerResourceProvisioning string const ( - // ContainerResourceProvisioningInternal - The resource lifecycle will be managed internally by Radius +// ContainerResourceProvisioningInternal - The resource lifecycle will be managed internally by Radius ContainerResourceProvisioningInternal ContainerResourceProvisioning = "internal" - // ContainerResourceProvisioningManual - The resource lifecycle will be managed by the user +// ContainerResourceProvisioningManual - The resource lifecycle will be managed by the user ContainerResourceProvisioningManual ContainerResourceProvisioning = "manual" ) @@ -109,9 +106,9 @@ func PossibleCreatedByTypeValues() []CreatedByType { type DaprSidecarExtensionProtocol string const ( - // DaprSidecarExtensionProtocolGrpc - gRPC protocol +// DaprSidecarExtensionProtocolGrpc - gRPC protocol DaprSidecarExtensionProtocolGrpc DaprSidecarExtensionProtocol = "grpc" - // DaprSidecarExtensionProtocolHTTP - HTTP protocol +// DaprSidecarExtensionProtocolHTTP - HTTP protocol DaprSidecarExtensionProtocolHTTP DaprSidecarExtensionProtocol = "http" ) @@ -127,10 +124,10 @@ func PossibleDaprSidecarExtensionProtocolValues() []DaprSidecarExtensionProtocol type Direction string const ( - // DirectionInbound - The resource defining this connection accepts inbound connections from the resource specified by this +// DirectionInbound - The resource defining this connection accepts inbound connections from the resource specified by this // id. DirectionInbound Direction = "Inbound" - // DirectionOutbound - The resource defining this connection makes an outbound connection resource specified by this id. +// DirectionOutbound - The resource defining this connection makes an outbound connection resource specified by this id. DirectionOutbound Direction = "Outbound" ) @@ -146,7 +143,7 @@ func PossibleDirectionValues() []Direction { type IAMKind string const ( - // IAMKindAzure - Azure Active Directory +// IAMKindAzure - Azure Active Directory IAMKindAzure IAMKind = "azure" IAMKindString IAMKind = "string" ) @@ -163,9 +160,9 @@ func PossibleIAMKindValues() []IAMKind { type IdentitySettingKind string const ( - // IdentitySettingKindAzureComWorkload - azure ad workload identity +// IdentitySettingKindAzureComWorkload - azure ad workload identity IdentitySettingKindAzureComWorkload IdentitySettingKind = "azure.com.workload" - // IdentitySettingKindUndefined - undefined identity +// IdentitySettingKindUndefined - undefined identity IdentitySettingKindUndefined IdentitySettingKind = "undefined" ) @@ -181,11 +178,11 @@ func PossibleIdentitySettingKindValues() []IdentitySettingKind { type ImagePullPolicy string const ( - // ImagePullPolicyAlways - Always +// ImagePullPolicyAlways - Always ImagePullPolicyAlways ImagePullPolicy = "Always" - // ImagePullPolicyIfNotPresent - IfNotPresent +// ImagePullPolicyIfNotPresent - IfNotPresent ImagePullPolicyIfNotPresent ImagePullPolicy = "IfNotPresent" - // ImagePullPolicyNever - Never +// ImagePullPolicyNever - Never ImagePullPolicyNever ImagePullPolicy = "Never" ) @@ -202,9 +199,9 @@ func PossibleImagePullPolicyValues() []ImagePullPolicy { type ManagedStore string const ( - // ManagedStoreDisk - Disk store +// ManagedStoreDisk - Disk store ManagedStoreDisk ManagedStore = "disk" - // ManagedStoreMemory - Memory store +// ManagedStoreMemory - Memory store ManagedStoreMemory ManagedStore = "memory" ) @@ -239,9 +236,9 @@ func PossibleOriginValues() []Origin { type PortProtocol string const ( - // PortProtocolTCP - TCP protocol +// PortProtocolTCP - TCP protocol PortProtocolTCP PortProtocol = "TCP" - // PortProtocolUDP - UDP protocol +// PortProtocolUDP - UDP protocol PortProtocolUDP PortProtocol = "UDP" ) @@ -257,21 +254,21 @@ func PossiblePortProtocolValues() []PortProtocol { type ProvisioningState string const ( - // ProvisioningStateAccepted - The resource create request has been accepted +// ProvisioningStateAccepted - The resource create request has been accepted ProvisioningStateAccepted ProvisioningState = "Accepted" - // ProvisioningStateCanceled - The resource provisioning has been canceled +// ProvisioningStateCanceled - The resource provisioning has been canceled ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreating - The resource is being created +// ProvisioningStateCreating - The resource is being created ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting - The resource is being deleted +// ProvisioningStateDeleting - The resource is being deleted ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed - The resource provisioning has failed +// ProvisioningStateFailed - The resource provisioning has failed ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateProvisioning - The resource is being provisioned +// ProvisioningStateProvisioning - The resource is being provisioned ProvisioningStateProvisioning ProvisioningState = "Provisioning" - // ProvisioningStateSucceeded - The resource has been successfully provisioned +// ProvisioningStateSucceeded - The resource has been successfully provisioned ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating - The resource is being updated +// ProvisioningStateUpdating - The resource is being updated ProvisioningStateUpdating ProvisioningState = "Updating" ) @@ -295,9 +292,9 @@ func PossibleProvisioningStateValues() []ProvisioningState { type ResourceProvisioning string const ( - // ResourceProvisioningManual - The resource lifecycle will be managed by the user +// ResourceProvisioningManual - The resource lifecycle will be managed by the user ResourceProvisioningManual ResourceProvisioning = "manual" - // ResourceProvisioningRecipe - The resource lifecycle will be managed by Radius +// ResourceProvisioningRecipe - The resource lifecycle will be managed by Radius ResourceProvisioningRecipe ResourceProvisioning = "recipe" ) @@ -313,11 +310,11 @@ func PossibleResourceProvisioningValues() []ResourceProvisioning { type RestartPolicy string const ( - // RestartPolicyAlways - Always +// RestartPolicyAlways - Always RestartPolicyAlways RestartPolicy = "Always" - // RestartPolicyNever - Never +// RestartPolicyNever - Never RestartPolicyNever RestartPolicy = "Never" - // RestartPolicyOnFailure - OnFailure +// RestartPolicyOnFailure - OnFailure RestartPolicyOnFailure RestartPolicy = "OnFailure" ) @@ -334,18 +331,18 @@ func PossibleRestartPolicyValues() []RestartPolicy { type SecretStoreDataType string const ( - // SecretStoreDataTypeAwsIRSA - awsIRSA type is used to represent authentication using AWS IRSA (IAM Roles for Service accounts) +// SecretStoreDataTypeAwsIRSA - awsIRSA type is used to represent authentication using AWS IRSA (IAM Roles for Service accounts) // and the secretstore resource is expected to have the key 'roleARN'. SecretStoreDataTypeAwsIRSA SecretStoreDataType = "awsIRSA" - // SecretStoreDataTypeAzureWorkloadIdentity - azureWorkloadIdentity type is used to represent authentication using azure federated +// SecretStoreDataTypeAzureWorkloadIdentity - azureWorkloadIdentity type is used to represent authentication using azure federated // identity and the secretstore resource is expected to have the keys 'clientId' and 'tenantId'. SecretStoreDataTypeAzureWorkloadIdentity SecretStoreDataType = "azureWorkloadIdentity" - // SecretStoreDataTypeBasicAuthentication - basicAuthentication type is used to represent username and password based authentication +// SecretStoreDataTypeBasicAuthentication - basicAuthentication type is used to represent username and password based authentication // and the secretstore resource is expected to have the keys 'username' and 'password'. SecretStoreDataTypeBasicAuthentication SecretStoreDataType = "basicAuthentication" - // SecretStoreDataTypeCertificate - Certificate secret data type +// SecretStoreDataTypeCertificate - Certificate secret data type SecretStoreDataTypeCertificate SecretStoreDataType = "certificate" - // SecretStoreDataTypeGeneric - Generic secret data type +// SecretStoreDataTypeGeneric - Generic secret data type SecretStoreDataTypeGeneric SecretStoreDataType = "generic" ) @@ -364,9 +361,9 @@ func PossibleSecretStoreDataTypeValues() []SecretStoreDataType { type SecretValueEncoding string const ( - // SecretValueEncodingBase64 - The base64-encoded secret value +// SecretValueEncodingBase64 - The base64-encoded secret value SecretValueEncodingBase64 SecretValueEncoding = "base64" - // SecretValueEncodingRaw - The raw secret value +// SecretValueEncodingRaw - The raw secret value SecretValueEncodingRaw SecretValueEncoding = "raw" ) @@ -382,9 +379,9 @@ func PossibleSecretValueEncodingValues() []SecretValueEncoding { type TLSMinVersion string const ( - // TLSMinVersionTls12 - TLS Version 1.2 +// TLSMinVersionTls12 - TLS Version 1.2 TLSMinVersionTls12 TLSMinVersion = "1.2" - // TLSMinVersionTls13 - TLS Version 1.3 +// TLSMinVersionTls13 - TLS Version 1.3 TLSMinVersionTls13 TLSMinVersion = "1.3" ) @@ -400,9 +397,9 @@ func PossibleTLSMinVersionValues() []TLSMinVersion { type VolumePermission string const ( - // VolumePermissionRead - Read only +// VolumePermissionRead - Read only VolumePermissionRead VolumePermission = "read" - // VolumePermissionWrite - Read and write +// VolumePermissionWrite - Read and write VolumePermissionWrite VolumePermission = "write" ) @@ -418,11 +415,11 @@ func PossibleVolumePermissionValues() []VolumePermission { type VolumeSecretEncodings string const ( - // VolumeSecretEncodingsBase64 - Base64 encoding +// VolumeSecretEncodingsBase64 - Base64 encoding VolumeSecretEncodingsBase64 VolumeSecretEncodings = "base64" - // VolumeSecretEncodingsHex - Hex encoding +// VolumeSecretEncodingsHex - Hex encoding VolumeSecretEncodingsHex VolumeSecretEncodings = "hex" - // VolumeSecretEncodingsUTF8 - UTF-8 encoding +// VolumeSecretEncodingsUTF8 - UTF-8 encoding VolumeSecretEncodingsUTF8 VolumeSecretEncodings = "utf-8" ) diff --git a/pkg/corerp/api/v20231001preview/zz_generated_containers_client.go b/pkg/corerp/api/v20231001preview/zz_generated_containers_client.go index fa59c000c5..e98cfde4cd 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_containers_client.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_containers_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type ContainersClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewContainersClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContainersClient, error) { - cl, err := arm.NewClient(moduleName+".ContainersClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -60,10 +57,13 @@ func (client *ContainersClient) BeginCreateOrUpdate(ctx context.Context, contain } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContainersClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[ContainersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ContainersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -73,6 +73,10 @@ func (client *ContainersClient) BeginCreateOrUpdate(ctx context.Context, contain // Generated from API version 2023-10-01-preview func (client *ContainersClient) createOrUpdate(ctx context.Context, containerName string, resource ContainerResource, options *ContainersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "ContainersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, containerName, resource, options) if err != nil { return nil, err @@ -89,7 +93,7 @@ func (client *ContainersClient) createOrUpdate(ctx context.Context, containerNam } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ContainersClient) createOrUpdateCreateRequest(ctx context.Context, containerName string, resource ContainerResource, options *ContainersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ContainersClient) createOrUpdateCreateRequest(ctx context.Context, containerName string, resource ContainerResource, _ *ContainersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/containers/{containerName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if containerName == "" { @@ -107,7 +111,7 @@ func (client *ContainersClient) createOrUpdateCreateRequest(ctx context.Context, if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a ContainerResource @@ -124,10 +128,13 @@ func (client *ContainersClient) BeginDelete(ctx context.Context, containerName s } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContainersClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[ContainersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ContainersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -137,6 +144,10 @@ func (client *ContainersClient) BeginDelete(ctx context.Context, containerName s // Generated from API version 2023-10-01-preview func (client *ContainersClient) deleteOperation(ctx context.Context, containerName string, options *ContainersClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "ContainersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, containerName, options) if err != nil { return nil, err @@ -153,7 +164,7 @@ func (client *ContainersClient) deleteOperation(ctx context.Context, containerNa } // deleteCreateRequest creates the Delete request. -func (client *ContainersClient) deleteCreateRequest(ctx context.Context, containerName string, options *ContainersClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ContainersClient) deleteCreateRequest(ctx context.Context, containerName string, _ *ContainersClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/containers/{containerName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if containerName == "" { @@ -179,6 +190,10 @@ func (client *ContainersClient) deleteCreateRequest(ctx context.Context, contain // - options - ContainersClientGetOptions contains the optional parameters for the ContainersClient.Get method. func (client *ContainersClient) Get(ctx context.Context, containerName string, options *ContainersClientGetOptions) (ContainersClientGetResponse, error) { var err error + const operationName = "ContainersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, containerName, options) if err != nil { return ContainersClientGetResponse{}, err @@ -196,7 +211,7 @@ func (client *ContainersClient) Get(ctx context.Context, containerName string, o } // getCreateRequest creates the Get request. -func (client *ContainersClient) getCreateRequest(ctx context.Context, containerName string, options *ContainersClientGetOptions) (*policy.Request, error) { +func (client *ContainersClient) getCreateRequest(ctx context.Context, containerName string, _ *ContainersClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/containers/{containerName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if containerName == "" { @@ -234,30 +249,25 @@ func (client *ContainersClient) NewListByScopePager(options *ContainersClientLis return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ContainersClientListByScopeResponse) (ContainersClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ContainersClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return ContainersClientListByScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ContainersClientListByScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ContainersClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *ContainersClient) listByScopeCreateRequest(ctx context.Context, options *ContainersClientListByScopeOptions) (*policy.Request, error) { +func (client *ContainersClient) listByScopeCreateRequest(ctx context.Context, _ *ContainersClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/containers" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -295,10 +305,13 @@ func (client *ContainersClient) BeginUpdate(ctx context.Context, containerName s } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ContainersClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[ContainersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ContainersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -308,6 +321,10 @@ func (client *ContainersClient) BeginUpdate(ctx context.Context, containerName s // Generated from API version 2023-10-01-preview func (client *ContainersClient) update(ctx context.Context, containerName string, properties ContainerResourceUpdate, options *ContainersClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "ContainersClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, containerName, properties, options) if err != nil { return nil, err @@ -324,7 +341,7 @@ func (client *ContainersClient) update(ctx context.Context, containerName string } // updateCreateRequest creates the Update request. -func (client *ContainersClient) updateCreateRequest(ctx context.Context, containerName string, properties ContainerResourceUpdate, options *ContainersClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ContainersClient) updateCreateRequest(ctx context.Context, containerName string, properties ContainerResourceUpdate, _ *ContainersClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/containers/{containerName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if containerName == "" { @@ -342,6 +359,6 @@ func (client *ContainersClient) updateCreateRequest(ctx context.Context, contain if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/corerp/api/v20231001preview/zz_generated_environments_client.go b/pkg/corerp/api/v20231001preview/zz_generated_environments_client.go index 6a943000ed..465bb63cf8 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_environments_client.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_environments_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type EnvironmentsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewEnvironmentsClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EnvironmentsClient, error) { - cl, err := arm.NewClient(moduleName+".EnvironmentsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -54,6 +51,10 @@ func NewEnvironmentsClient(rootScope string, credential azcore.TokenCredential, // method. func (client *EnvironmentsClient) CreateOrUpdate(ctx context.Context, environmentName string, resource EnvironmentResource, options *EnvironmentsClientCreateOrUpdateOptions) (EnvironmentsClientCreateOrUpdateResponse, error) { var err error + const operationName = "EnvironmentsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, environmentName, resource, options) if err != nil { return EnvironmentsClientCreateOrUpdateResponse{}, err @@ -71,7 +72,7 @@ func (client *EnvironmentsClient) CreateOrUpdate(ctx context.Context, environmen } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *EnvironmentsClient) createOrUpdateCreateRequest(ctx context.Context, environmentName string, resource EnvironmentResource, options *EnvironmentsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *EnvironmentsClient) createOrUpdateCreateRequest(ctx context.Context, environmentName string, resource EnvironmentResource, _ *EnvironmentsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/environments/{environmentName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if environmentName == "" { @@ -89,7 +90,7 @@ func (client *EnvironmentsClient) createOrUpdateCreateRequest(ctx context.Contex if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -109,6 +110,10 @@ func (client *EnvironmentsClient) createOrUpdateHandleResponse(resp *http.Respon // - options - EnvironmentsClientDeleteOptions contains the optional parameters for the EnvironmentsClient.Delete method. func (client *EnvironmentsClient) Delete(ctx context.Context, environmentName string, options *EnvironmentsClientDeleteOptions) (EnvironmentsClientDeleteResponse, error) { var err error + const operationName = "EnvironmentsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, environmentName, options) if err != nil { return EnvironmentsClientDeleteResponse{}, err @@ -125,7 +130,7 @@ func (client *EnvironmentsClient) Delete(ctx context.Context, environmentName st } // deleteCreateRequest creates the Delete request. -func (client *EnvironmentsClient) deleteCreateRequest(ctx context.Context, environmentName string, options *EnvironmentsClientDeleteOptions) (*policy.Request, error) { +func (client *EnvironmentsClient) deleteCreateRequest(ctx context.Context, environmentName string, _ *EnvironmentsClientDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/environments/{environmentName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if environmentName == "" { @@ -151,6 +156,10 @@ func (client *EnvironmentsClient) deleteCreateRequest(ctx context.Context, envir // - options - EnvironmentsClientGetOptions contains the optional parameters for the EnvironmentsClient.Get method. func (client *EnvironmentsClient) Get(ctx context.Context, environmentName string, options *EnvironmentsClientGetOptions) (EnvironmentsClientGetResponse, error) { var err error + const operationName = "EnvironmentsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, environmentName, options) if err != nil { return EnvironmentsClientGetResponse{}, err @@ -168,7 +177,7 @@ func (client *EnvironmentsClient) Get(ctx context.Context, environmentName strin } // getCreateRequest creates the Get request. -func (client *EnvironmentsClient) getCreateRequest(ctx context.Context, environmentName string, options *EnvironmentsClientGetOptions) (*policy.Request, error) { +func (client *EnvironmentsClient) getCreateRequest(ctx context.Context, environmentName string, _ *EnvironmentsClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/environments/{environmentName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if environmentName == "" { @@ -205,6 +214,10 @@ func (client *EnvironmentsClient) getHandleResponse(resp *http.Response) (Enviro // method. func (client *EnvironmentsClient) GetMetadata(ctx context.Context, environmentName string, body RecipeGetMetadata, options *EnvironmentsClientGetMetadataOptions) (EnvironmentsClientGetMetadataResponse, error) { var err error + const operationName = "EnvironmentsClient.GetMetadata" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getMetadataCreateRequest(ctx, environmentName, body, options) if err != nil { return EnvironmentsClientGetMetadataResponse{}, err @@ -222,7 +235,7 @@ func (client *EnvironmentsClient) GetMetadata(ctx context.Context, environmentNa } // getMetadataCreateRequest creates the GetMetadata request. -func (client *EnvironmentsClient) getMetadataCreateRequest(ctx context.Context, environmentName string, body RecipeGetMetadata, options *EnvironmentsClientGetMetadataOptions) (*policy.Request, error) { +func (client *EnvironmentsClient) getMetadataCreateRequest(ctx context.Context, environmentName string, body RecipeGetMetadata, _ *EnvironmentsClientGetMetadataOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/environments/{environmentName}/getMetadata" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if environmentName == "" { @@ -240,7 +253,7 @@ func (client *EnvironmentsClient) getMetadataCreateRequest(ctx context.Context, if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err } - return req, nil +; return req, nil } // getMetadataHandleResponse handles the GetMetadata response. @@ -263,30 +276,25 @@ func (client *EnvironmentsClient) NewListByScopePager(options *EnvironmentsClien return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *EnvironmentsClientListByScopeResponse) (EnvironmentsClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EnvironmentsClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return EnvironmentsClientListByScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EnvironmentsClientListByScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EnvironmentsClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *EnvironmentsClient) listByScopeCreateRequest(ctx context.Context, options *EnvironmentsClientListByScopeOptions) (*policy.Request, error) { +func (client *EnvironmentsClient) listByScopeCreateRequest(ctx context.Context, _ *EnvironmentsClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/environments" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -318,6 +326,10 @@ func (client *EnvironmentsClient) listByScopeHandleResponse(resp *http.Response) // - options - EnvironmentsClientUpdateOptions contains the optional parameters for the EnvironmentsClient.Update method. func (client *EnvironmentsClient) Update(ctx context.Context, environmentName string, properties EnvironmentResourceUpdate, options *EnvironmentsClientUpdateOptions) (EnvironmentsClientUpdateResponse, error) { var err error + const operationName = "EnvironmentsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, environmentName, properties, options) if err != nil { return EnvironmentsClientUpdateResponse{}, err @@ -335,7 +347,7 @@ func (client *EnvironmentsClient) Update(ctx context.Context, environmentName st } // updateCreateRequest creates the Update request. -func (client *EnvironmentsClient) updateCreateRequest(ctx context.Context, environmentName string, properties EnvironmentResourceUpdate, options *EnvironmentsClientUpdateOptions) (*policy.Request, error) { +func (client *EnvironmentsClient) updateCreateRequest(ctx context.Context, environmentName string, properties EnvironmentResourceUpdate, _ *EnvironmentsClientUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/environments/{environmentName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if environmentName == "" { @@ -353,7 +365,7 @@ func (client *EnvironmentsClient) updateCreateRequest(ctx context.Context, envir if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } // updateHandleResponse handles the Update response. diff --git a/pkg/corerp/api/v20231001preview/zz_generated_extenders_client.go b/pkg/corerp/api/v20231001preview/zz_generated_extenders_client.go index eefd86b561..b64f341498 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_extenders_client.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_extenders_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type ExtendersClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewExtendersClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExtendersClient, error) { - cl, err := arm.NewClient(moduleName+".ExtendersClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -60,10 +57,13 @@ func (client *ExtendersClient) BeginCreateOrUpdate(ctx context.Context, extender } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtendersClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[ExtendersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExtendersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -73,6 +73,10 @@ func (client *ExtendersClient) BeginCreateOrUpdate(ctx context.Context, extender // Generated from API version 2023-10-01-preview func (client *ExtendersClient) createOrUpdate(ctx context.Context, extenderName string, resource ExtenderResource, options *ExtendersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "ExtendersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, extenderName, resource, options) if err != nil { return nil, err @@ -89,7 +93,7 @@ func (client *ExtendersClient) createOrUpdate(ctx context.Context, extenderName } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ExtendersClient) createOrUpdateCreateRequest(ctx context.Context, extenderName string, resource ExtenderResource, options *ExtendersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ExtendersClient) createOrUpdateCreateRequest(ctx context.Context, extenderName string, resource ExtenderResource, _ *ExtendersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/extenders/{extenderName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if extenderName == "" { @@ -107,7 +111,7 @@ func (client *ExtendersClient) createOrUpdateCreateRequest(ctx context.Context, if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a ExtenderResource @@ -124,10 +128,13 @@ func (client *ExtendersClient) BeginDelete(ctx context.Context, extenderName str } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtendersClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[ExtendersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExtendersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -137,6 +144,10 @@ func (client *ExtendersClient) BeginDelete(ctx context.Context, extenderName str // Generated from API version 2023-10-01-preview func (client *ExtendersClient) deleteOperation(ctx context.Context, extenderName string, options *ExtendersClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "ExtendersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, extenderName, options) if err != nil { return nil, err @@ -153,7 +164,7 @@ func (client *ExtendersClient) deleteOperation(ctx context.Context, extenderName } // deleteCreateRequest creates the Delete request. -func (client *ExtendersClient) deleteCreateRequest(ctx context.Context, extenderName string, options *ExtendersClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ExtendersClient) deleteCreateRequest(ctx context.Context, extenderName string, _ *ExtendersClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/extenders/{extenderName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if extenderName == "" { @@ -179,6 +190,10 @@ func (client *ExtendersClient) deleteCreateRequest(ctx context.Context, extender // - options - ExtendersClientGetOptions contains the optional parameters for the ExtendersClient.Get method. func (client *ExtendersClient) Get(ctx context.Context, extenderName string, options *ExtendersClientGetOptions) (ExtendersClientGetResponse, error) { var err error + const operationName = "ExtendersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, extenderName, options) if err != nil { return ExtendersClientGetResponse{}, err @@ -196,7 +211,7 @@ func (client *ExtendersClient) Get(ctx context.Context, extenderName string, opt } // getCreateRequest creates the Get request. -func (client *ExtendersClient) getCreateRequest(ctx context.Context, extenderName string, options *ExtendersClientGetOptions) (*policy.Request, error) { +func (client *ExtendersClient) getCreateRequest(ctx context.Context, extenderName string, _ *ExtendersClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/extenders/{extenderName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if extenderName == "" { @@ -234,30 +249,25 @@ func (client *ExtendersClient) NewListByScopePager(options *ExtendersClientListB return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ExtendersClientListByScopeResponse) (ExtendersClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ExtendersClientListByScopeResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExtendersClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return ExtendersClientListByScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ExtendersClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *ExtendersClient) listByScopeCreateRequest(ctx context.Context, options *ExtendersClientListByScopeOptions) (*policy.Request, error) { +func (client *ExtendersClient) listByScopeCreateRequest(ctx context.Context, _ *ExtendersClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/extenders" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -289,6 +299,10 @@ func (client *ExtendersClient) listByScopeHandleResponse(resp *http.Response) (E // - options - ExtendersClientListSecretsOptions contains the optional parameters for the ExtendersClient.ListSecrets method. func (client *ExtendersClient) ListSecrets(ctx context.Context, extenderName string, body map[string]any, options *ExtendersClientListSecretsOptions) (ExtendersClientListSecretsResponse, error) { var err error + const operationName = "ExtendersClient.ListSecrets" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listSecretsCreateRequest(ctx, extenderName, body, options) if err != nil { return ExtendersClientListSecretsResponse{}, err @@ -306,7 +320,7 @@ func (client *ExtendersClient) ListSecrets(ctx context.Context, extenderName str } // listSecretsCreateRequest creates the ListSecrets request. -func (client *ExtendersClient) listSecretsCreateRequest(ctx context.Context, extenderName string, body map[string]any, options *ExtendersClientListSecretsOptions) (*policy.Request, error) { +func (client *ExtendersClient) listSecretsCreateRequest(ctx context.Context, extenderName string, body map[string]any, _ *ExtendersClientListSecretsOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/extenders/{extenderName}/listSecrets" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if extenderName == "" { @@ -324,7 +338,7 @@ func (client *ExtendersClient) listSecretsCreateRequest(ctx context.Context, ext if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err } - return req, nil +; return req, nil } // listSecretsHandleResponse handles the ListSecrets response. @@ -351,10 +365,13 @@ func (client *ExtendersClient) BeginUpdate(ctx context.Context, extenderName str } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExtendersClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[ExtendersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExtendersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -364,6 +381,10 @@ func (client *ExtendersClient) BeginUpdate(ctx context.Context, extenderName str // Generated from API version 2023-10-01-preview func (client *ExtendersClient) update(ctx context.Context, extenderName string, properties ExtenderResourceUpdate, options *ExtendersClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "ExtendersClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, extenderName, properties, options) if err != nil { return nil, err @@ -380,7 +401,7 @@ func (client *ExtendersClient) update(ctx context.Context, extenderName string, } // updateCreateRequest creates the Update request. -func (client *ExtendersClient) updateCreateRequest(ctx context.Context, extenderName string, properties ExtenderResourceUpdate, options *ExtendersClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ExtendersClient) updateCreateRequest(ctx context.Context, extenderName string, properties ExtenderResourceUpdate, _ *ExtendersClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/extenders/{extenderName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if extenderName == "" { @@ -398,6 +419,6 @@ func (client *ExtendersClient) updateCreateRequest(ctx context.Context, extender if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/corerp/api/v20231001preview/zz_generated_gateways_client.go b/pkg/corerp/api/v20231001preview/zz_generated_gateways_client.go index 05e3175058..e38ef4db6b 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_gateways_client.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_gateways_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type GatewaysClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewGatewaysClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GatewaysClient, error) { - cl, err := arm.NewClient(moduleName+".GatewaysClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -59,10 +56,13 @@ func (client *GatewaysClient) BeginCreate(ctx context.Context, gatewayName strin } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GatewaysClientCreateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[GatewaysClientCreateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GatewaysClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -72,6 +72,10 @@ func (client *GatewaysClient) BeginCreate(ctx context.Context, gatewayName strin // Generated from API version 2023-10-01-preview func (client *GatewaysClient) create(ctx context.Context, gatewayName string, resource GatewayResource, options *GatewaysClientBeginCreateOptions) (*http.Response, error) { var err error + const operationName = "GatewaysClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createCreateRequest(ctx, gatewayName, resource, options) if err != nil { return nil, err @@ -88,7 +92,7 @@ func (client *GatewaysClient) create(ctx context.Context, gatewayName string, re } // createCreateRequest creates the Create request. -func (client *GatewaysClient) createCreateRequest(ctx context.Context, gatewayName string, resource GatewayResource, options *GatewaysClientBeginCreateOptions) (*policy.Request, error) { +func (client *GatewaysClient) createCreateRequest(ctx context.Context, gatewayName string, resource GatewayResource, _ *GatewaysClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/gateways/{gatewayName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if gatewayName == "" { @@ -106,7 +110,7 @@ func (client *GatewaysClient) createCreateRequest(ctx context.Context, gatewayNa if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginCreateOrUpdate - Update a GatewayResource @@ -125,10 +129,13 @@ func (client *GatewaysClient) BeginCreateOrUpdate(ctx context.Context, gatewayNa } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GatewaysClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[GatewaysClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GatewaysClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -138,6 +145,10 @@ func (client *GatewaysClient) BeginCreateOrUpdate(ctx context.Context, gatewayNa // Generated from API version 2023-10-01-preview func (client *GatewaysClient) createOrUpdate(ctx context.Context, gatewayName string, properties GatewayResourceUpdate, options *GatewaysClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "GatewaysClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, gatewayName, properties, options) if err != nil { return nil, err @@ -154,7 +165,7 @@ func (client *GatewaysClient) createOrUpdate(ctx context.Context, gatewayName st } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *GatewaysClient) createOrUpdateCreateRequest(ctx context.Context, gatewayName string, properties GatewayResourceUpdate, options *GatewaysClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *GatewaysClient) createOrUpdateCreateRequest(ctx context.Context, gatewayName string, properties GatewayResourceUpdate, _ *GatewaysClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/gateways/{gatewayName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if gatewayName == "" { @@ -172,7 +183,7 @@ func (client *GatewaysClient) createOrUpdateCreateRequest(ctx context.Context, g if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a GatewayResource @@ -189,10 +200,13 @@ func (client *GatewaysClient) BeginDelete(ctx context.Context, gatewayName strin } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GatewaysClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[GatewaysClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GatewaysClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -202,6 +216,10 @@ func (client *GatewaysClient) BeginDelete(ctx context.Context, gatewayName strin // Generated from API version 2023-10-01-preview func (client *GatewaysClient) deleteOperation(ctx context.Context, gatewayName string, options *GatewaysClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "GatewaysClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, gatewayName, options) if err != nil { return nil, err @@ -218,7 +236,7 @@ func (client *GatewaysClient) deleteOperation(ctx context.Context, gatewayName s } // deleteCreateRequest creates the Delete request. -func (client *GatewaysClient) deleteCreateRequest(ctx context.Context, gatewayName string, options *GatewaysClientBeginDeleteOptions) (*policy.Request, error) { +func (client *GatewaysClient) deleteCreateRequest(ctx context.Context, gatewayName string, _ *GatewaysClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/gateways/{gatewayName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if gatewayName == "" { @@ -244,6 +262,10 @@ func (client *GatewaysClient) deleteCreateRequest(ctx context.Context, gatewayNa // - options - GatewaysClientGetOptions contains the optional parameters for the GatewaysClient.Get method. func (client *GatewaysClient) Get(ctx context.Context, gatewayName string, options *GatewaysClientGetOptions) (GatewaysClientGetResponse, error) { var err error + const operationName = "GatewaysClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, gatewayName, options) if err != nil { return GatewaysClientGetResponse{}, err @@ -261,7 +283,7 @@ func (client *GatewaysClient) Get(ctx context.Context, gatewayName string, optio } // getCreateRequest creates the Get request. -func (client *GatewaysClient) getCreateRequest(ctx context.Context, gatewayName string, options *GatewaysClientGetOptions) (*policy.Request, error) { +func (client *GatewaysClient) getCreateRequest(ctx context.Context, gatewayName string, _ *GatewaysClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/gateways/{gatewayName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if gatewayName == "" { @@ -299,30 +321,25 @@ func (client *GatewaysClient) NewListByScopePager(options *GatewaysClientListByS return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *GatewaysClientListByScopeResponse) (GatewaysClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GatewaysClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return GatewaysClientListByScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return GatewaysClientListByScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GatewaysClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *GatewaysClient) listByScopeCreateRequest(ctx context.Context, options *GatewaysClientListByScopeOptions) (*policy.Request, error) { +func (client *GatewaysClient) listByScopeCreateRequest(ctx context.Context, _ *GatewaysClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/gateways" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) diff --git a/pkg/corerp/api/v20231001preview/zz_generated_interfaces.go b/pkg/corerp/api/v20231001preview/zz_generated_interfaces.go index 9bbe9c0ef3..25f85466ad 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_interfaces.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_interfaces.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. diff --git a/pkg/corerp/api/v20231001preview/zz_generated_models.go b/pkg/corerp/api/v20231001preview/zz_generated_models.go index 00a1ad5695..4d45153cbf 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_models.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_models.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -11,152 +8,152 @@ import "time" // ApplicationGraphConnection - Describes the connection between two resources. type ApplicationGraphConnection struct { - // REQUIRED; The direction of the connection. 'Outbound' indicates this connection specifies the ID of the destination and +// REQUIRED; The direction of the connection. 'Outbound' indicates this connection specifies the ID of the destination and // 'Inbound' indicates indicates this connection specifies the ID of the source. Direction *Direction - // REQUIRED; The resource ID +// REQUIRED; The resource ID ID *string } // ApplicationGraphOutputResource - Describes an output resource that comprises an application graph resource. type ApplicationGraphOutputResource struct { - // REQUIRED; The resource ID. +// REQUIRED; The resource ID. ID *string - // REQUIRED; The resource name. +// REQUIRED; The resource name. Name *string - // REQUIRED; The resource type. +// REQUIRED; The resource type. Type *string } // ApplicationGraphResource - Describes a resource in the application graph. type ApplicationGraphResource struct { - // REQUIRED; The connections between resources in the application graph. +// REQUIRED; The connections between resources in the application graph. Connections []*ApplicationGraphConnection - // REQUIRED; The resource ID. +// REQUIRED; The resource ID. ID *string - // REQUIRED; The resource name. +// REQUIRED; The resource name. Name *string - // REQUIRED; The resources that comprise this resource. +// REQUIRED; The resources that comprise this resource. OutputResources []*ApplicationGraphOutputResource - // REQUIRED; provisioningState of this resource. +// REQUIRED; provisioningState of this resource. ProvisioningState *string - // REQUIRED; The resource type. +// REQUIRED; The resource type. Type *string } // ApplicationGraphResponse - Describes the application architecture and its dependencies. type ApplicationGraphResponse struct { - // REQUIRED; The resources in the application graph. +// REQUIRED; The resources in the application graph. Resources []*ApplicationGraphResource } // ApplicationProperties - Application properties type ApplicationProperties struct { - // REQUIRED; Fully qualified resource ID for the environment that the application is linked to +// REQUIRED; Fully qualified resource ID for the environment that the application is linked to Environment *string - // The application extension. +// The application extension. Extensions []ExtensionClassification - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } // ApplicationResource - Radius Application resource type ApplicationResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *ApplicationProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ApplicationResourceListResult - The response of a ApplicationResource list operation. type ApplicationResourceListResult struct { - // REQUIRED; The ApplicationResource items on this page +// REQUIRED; The ApplicationResource items on this page Value []*ApplicationResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // ApplicationResourceUpdate - Radius Application resource type ApplicationResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // AuthConfig - Authentication information used to access private Terraform module sources. Supported module sources: Git. type AuthConfig struct { - // Authentication information used to access private Terraform modules from Git repository sources. +// Authentication information used to access private Terraform modules from Git repository sources. Git *GitAuthConfig } // AzureKeyVaultVolumeProperties - Represents Azure Key Vault Volume properties type AzureKeyVaultVolumeProperties struct { - // REQUIRED; Fully qualified resource ID for the application +// REQUIRED; Fully qualified resource ID for the application Application *string - // REQUIRED; Discriminator property for VolumeProperties. +// REQUIRED; Discriminator property for VolumeProperties. Kind *string - // REQUIRED; The ID of the keyvault to use for this volume resource +// REQUIRED; The ID of the keyvault to use for this volume resource Resource *string - // The KeyVault certificates that this volume exposes +// The KeyVault certificates that this volume exposes Certificates map[string]*CertificateObjectProperties - // Fully qualified resource ID for the environment that the application is linked to +// Fully qualified resource ID for the environment that the application is linked to Environment *string - // The KeyVault keys that this volume exposes +// The KeyVault keys that this volume exposes Keys map[string]*KeyObjectProperties - // The KeyVault secrets that this volume exposes +// The KeyVault secrets that this volume exposes Secrets map[string]*SecretObjectProperties - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } @@ -174,42 +171,42 @@ func (a *AzureKeyVaultVolumeProperties) GetVolumeProperties() *VolumeProperties // AzureResourceManagerCommonTypesTrackedResourceUpdate - The resource model definition for an Azure Resource Manager tracked // top level resource which has 'tags' and a 'location' type AzureResourceManagerCommonTypesTrackedResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // BicepConfigProperties - Configuration for Bicep Recipes. Controls how Bicep plans and applies templates as part of Recipe // deployment. type BicepConfigProperties struct { - // Authentication information used to access private bicep registries, which is a map of registry hostname to secret config +// Authentication information used to access private bicep registries, which is a map of registry hostname to secret config // that contains credential information. Authentication map[string]*RegistrySecretConfig } // BicepRecipeProperties - Represents Bicep recipe properties. type BicepRecipeProperties struct { - // REQUIRED; Discriminator property for RecipeProperties. +// REQUIRED; Discriminator property for RecipeProperties. TemplateKind *string - // REQUIRED; Path to the template provided by the recipe. Currently only link to Azure Container Registry is supported. +// REQUIRED; Path to the template provided by the recipe. Currently only link to Azure Container Registry is supported. TemplatePath *string - // Key/value parameters to pass to the recipe template at deployment. +// Key/value parameters to pass to the recipe template at deployment. Parameters map[string]any - // Connect to the Bicep registry using HTTP (not-HTTPS). This should be used when the registry is known not to support HTTPS, +// Connect to the Bicep registry using HTTP (not-HTTPS). This should be used when the registry is known not to support HTTPS, // for example in a locally-hosted registry. Defaults to false (use HTTPS/TLS). PlainHTTP *bool } @@ -225,192 +222,192 @@ func (b *BicepRecipeProperties) GetRecipeProperties() *RecipeProperties { // CertificateObjectProperties - Represents certificate object properties type CertificateObjectProperties struct { - // REQUIRED; The name of the certificate +// REQUIRED; The name of the certificate Name *string - // File name when written to disk +// File name when written to disk Alias *string - // Certificate object type to be downloaded - the certificate itself, private key or public key of the certificate +// Certificate object type to be downloaded - the certificate itself, private key or public key of the certificate CertType *CertificateTypes - // Encoding format. Default utf-8 +// Encoding format. Default utf-8 Encoding *VolumeSecretEncodings - // Certificate format. Default pem +// Certificate format. Default pem Format *CertificateFormats - // Certificate version +// Certificate version Version *string } // ConnectionProperties - Connection Properties type ConnectionProperties struct { - // REQUIRED; The source of the connection +// REQUIRED; The source of the connection Source *string - // default environment variable override +// default environment variable override DisableDefaultEnvVars *bool - // iam properties +// iam properties Iam *IamProperties } // Container - Definition of a container type Container struct { - // REQUIRED; The registry and image to download and run in your container +// REQUIRED; The registry and image to download and run in your container Image *string - // Arguments to the entrypoint. Overrides the container image's CMD +// Arguments to the entrypoint. Overrides the container image's CMD Args []*string - // Entrypoint array. Overrides the container image's ENTRYPOINT +// Entrypoint array. Overrides the container image's ENTRYPOINT Command []*string - // environment +// environment Env map[string]*EnvironmentVariable - // The pull policy for the container image +// The pull policy for the container image ImagePullPolicy *ImagePullPolicy - // liveness probe properties +// liveness probe properties LivenessProbe HealthProbePropertiesClassification - // container ports +// container ports Ports map[string]*ContainerPortProperties - // readiness probe properties +// readiness probe properties ReadinessProbe HealthProbePropertiesClassification - // container volumes +// container volumes Volumes map[string]VolumeClassification - // Working directory for the container +// Working directory for the container WorkingDir *string } // ContainerPortProperties - Specifies a listening port for the container type ContainerPortProperties struct { - // REQUIRED; The listening port number +// REQUIRED; The listening port number ContainerPort *int32 - // Specifies the port that will be exposed by this container. Must be set when value different from containerPort is desired +// Specifies the port that will be exposed by this container. Must be set when value different from containerPort is desired Port *int32 - // Protocol in use by the port +// Protocol in use by the port Protocol *PortProtocol - // Specifies the URL scheme of the communication protocol. Consumers can use the scheme to construct a URL. The value defaults +// Specifies the URL scheme of the communication protocol. Consumers can use the scheme to construct a URL. The value defaults // to 'http' or 'https' depending on the port value Scheme *string } // ContainerProperties - Container properties type ContainerProperties struct { - // REQUIRED; Fully qualified resource ID for the application +// REQUIRED; Fully qualified resource ID for the application Application *string - // REQUIRED; Definition of a container. +// REQUIRED; Definition of a container. Container *Container - // Specifies a connection to another resource. +// Specifies a connection to another resource. Connections map[string]*ConnectionProperties - // Fully qualified resource ID for the environment that the application is linked to +// Fully qualified resource ID for the environment that the application is linked to Environment *string - // Extensions spec of the resource +// Extensions spec of the resource Extensions []ExtensionClassification - // Configuration for supported external identity providers +// Configuration for supported external identity providers Identity *IdentitySettings - // Specifies how the underlying container resource is provisioned and managed. +// Specifies how the underlying container resource is provisioned and managed. ResourceProvisioning *ContainerResourceProvisioning - // A collection of references to resources associated with the container +// A collection of references to resources associated with the container Resources []*ResourceReference - // The restart policy for the underlying container +// The restart policy for the underlying container RestartPolicy *RestartPolicy - // Specifies Runtime-specific functionality +// Specifies Runtime-specific functionality Runtimes *RuntimesProperties - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } // ContainerResource - Concrete tracked resource types can be created by aliasing this type using a specific property type. type ContainerResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *ContainerProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ContainerResourceListResult - The response of a ContainerResource list operation. type ContainerResourceListResult struct { - // REQUIRED; The ContainerResource items on this page +// REQUIRED; The ContainerResource items on this page Value []*ContainerResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // ContainerResourceUpdate - Concrete tracked resource types can be created by aliasing this type using a specific property // type. type ContainerResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // DaprSidecarExtension - Specifies the resource should have a Dapr sidecar injected type DaprSidecarExtension struct { - // REQUIRED; The Dapr appId. Specifies the identifier used by Dapr for service invocation. +// REQUIRED; The Dapr appId. Specifies the identifier used by Dapr for service invocation. AppID *string - // REQUIRED; Discriminator property for Extension. +// REQUIRED; Discriminator property for Extension. Kind *string - // The Dapr appPort. Specifies the internal listening port for the application to handle requests from the Dapr sidecar. +// The Dapr appPort. Specifies the internal listening port for the application to handle requests from the Dapr sidecar. AppPort *int32 - // Specifies the Dapr configuration to use for the resource. +// Specifies the Dapr configuration to use for the resource. Config *string - // Specifies the Dapr app-protocol to use for the resource. +// Specifies the Dapr app-protocol to use for the resource. Protocol *DaprSidecarExtensionProtocol } @@ -423,13 +420,13 @@ func (d *DaprSidecarExtension) GetExtension() *Extension { // EnvironmentCompute - Represents backing compute resource type EnvironmentCompute struct { - // REQUIRED; Discriminator property for EnvironmentCompute. +// REQUIRED; Discriminator property for EnvironmentCompute. Kind *string - // Configuration for supported external identity providers +// Configuration for supported external identity providers Identity *IdentitySettings - // The resource id of the compute resource for application environment. +// The resource id of the compute resource for application environment. ResourceID *string } @@ -438,103 +435,103 @@ func (e *EnvironmentCompute) GetEnvironmentCompute() *EnvironmentCompute { retur // EnvironmentProperties - Environment properties type EnvironmentProperties struct { - // REQUIRED; The compute resource used by application environment. +// REQUIRED; The compute resource used by application environment. Compute EnvironmentComputeClassification - // The environment extension. +// The environment extension. Extensions []ExtensionClassification - // Cloud providers configuration for the environment. +// Cloud providers configuration for the environment. Providers *Providers - // Configuration for Recipes. Defines how each type of Recipe should be configured and run. +// Configuration for Recipes. Defines how each type of Recipe should be configured and run. RecipeConfig *RecipeConfigProperties - // Specifies Recipes linked to the Environment. +// Specifies Recipes linked to the Environment. Recipes map[string]map[string]RecipePropertiesClassification - // Simulated environment. +// Simulated environment. Simulated *bool - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } // EnvironmentResource - The environment resource type EnvironmentResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *EnvironmentProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // EnvironmentResourceListResult - The response of a EnvironmentResource list operation. type EnvironmentResourceListResult struct { - // REQUIRED; The EnvironmentResource items on this page +// REQUIRED; The EnvironmentResource items on this page Value []*EnvironmentResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // EnvironmentResourceUpdate - The environment resource type EnvironmentResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // EnvironmentVariable - Environment variables type type EnvironmentVariable struct { - // The value of the environment variable +// The value of the environment variable Value *string - // The reference to the variable +// The reference to the variable ValueFrom *EnvironmentVariableReference } // EnvironmentVariableReference - The reference to the variable type EnvironmentVariableReference struct { - // REQUIRED; The secret reference +// REQUIRED; The secret reference SecretRef *SecretReference } // EphemeralVolume - Specifies an ephemeral volume for a container type EphemeralVolume struct { - // REQUIRED; Discriminator property for Volume. +// REQUIRED; Discriminator property for Volume. Kind *string - // REQUIRED; Backing store for the ephemeral volume +// REQUIRED; Backing store for the ephemeral volume ManagedStore *ManagedStore - // The path where the volume is mounted +// The path where the volume is mounted MountPath *string } @@ -548,56 +545,56 @@ func (e *EphemeralVolume) GetVolume() *Volume { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. +// READ-ONLY; The additional info. Info map[string]any - // READ-ONLY; The additional info type. +// READ-ONLY; The additional info type. Type *string } // ErrorDetail - The error detail. type ErrorDetail struct { - // READ-ONLY; The error additional info. +// READ-ONLY; The error additional info. AdditionalInfo []*ErrorAdditionalInfo - // READ-ONLY; The error code. +// READ-ONLY; The error code. Code *string - // READ-ONLY; The error details. +// READ-ONLY; The error details. Details []*ErrorDetail - // READ-ONLY; The error message. +// READ-ONLY; The error message. Message *string - // READ-ONLY; The error target. +// READ-ONLY; The error target. Target *string } // ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. // (This also follows the OData error response format.). type ErrorResponse struct { - // The error object. +// The error object. Error *ErrorDetail } // ExecHealthProbeProperties - Specifies the properties for readiness/liveness probe using an executable type ExecHealthProbeProperties struct { - // REQUIRED; Command to execute to probe readiness/liveness +// REQUIRED; Command to execute to probe readiness/liveness Command *string - // REQUIRED; Discriminator property for HealthProbeProperties. +// REQUIRED; Discriminator property for HealthProbeProperties. Kind *string - // Threshold number of times the probe fails after which a failure would be reported +// Threshold number of times the probe fails after which a failure would be reported FailureThreshold *float32 - // Initial delay in seconds before probing for readiness/liveness +// Initial delay in seconds before probing for readiness/liveness InitialDelaySeconds *float32 - // Interval for the readiness/liveness probe in seconds +// Interval for the readiness/liveness probe in seconds PeriodSeconds *float32 - // Number of seconds after which the readiness/liveness probe times out. Defaults to 5 seconds +// Number of seconds after which the readiness/liveness probe times out. Defaults to 5 seconds TimeoutSeconds *float32 } @@ -614,85 +611,85 @@ func (e *ExecHealthProbeProperties) GetHealthProbeProperties() *HealthProbePrope // ExtenderProperties - ExtenderResource portable resource properties type ExtenderProperties struct { - // REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to +// REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to Environment *string - // OPTIONAL; Contains additional key/value pairs not defined in the schema. +// OPTIONAL; Contains additional key/value pairs not defined in the schema. AdditionalProperties map[string]any - // Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) +// Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) Application *string - // The recipe used to automatically deploy underlying infrastructure for the extender portable resource +// The recipe used to automatically deploy underlying infrastructure for the extender portable resource Recipe *Recipe - // Specifies how the underlying service/resource is provisioned and managed. +// Specifies how the underlying service/resource is provisioned and managed. ResourceProvisioning *ResourceProvisioning - // The secrets for referenced resource +// The secrets for referenced resource Secrets map[string]any - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } // ExtenderResource portable resource type ExtenderResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *ExtenderProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ExtenderResourceListResult - The response of a ExtenderResource list operation. type ExtenderResourceListResult struct { - // REQUIRED; The ExtenderResource items on this page +// REQUIRED; The ExtenderResource items on this page Value []*ExtenderResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // ExtenderResourceUpdate - ExtenderResource portable resource type ExtenderResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // Extension of a environment/application resource. type Extension struct { - // REQUIRED; Discriminator property for Extension. +// REQUIRED; Discriminator property for Extension. Kind *string } @@ -701,155 +698,155 @@ func (e *Extension) GetExtension() *Extension { return e } // GatewayHostname - Declare hostname information for the Gateway. Leaving the hostname empty auto-assigns one: mygateway.myapp.PUBLICHOSTNAMEORIP.nip.io. type GatewayHostname struct { - // Specify a fully-qualified domain name: myapp.mydomain.com. Mutually exclusive with 'prefix' and will take priority if both +// Specify a fully-qualified domain name: myapp.mydomain.com. Mutually exclusive with 'prefix' and will take priority if both // are defined. FullyQualifiedHostname *string - // Specify a prefix for the hostname: myhostname.myapp.PUBLICHOSTNAMEORIP.nip.io. Mutually exclusive with 'fullyQualifiedHostname' +// Specify a prefix for the hostname: myhostname.myapp.PUBLICHOSTNAMEORIP.nip.io. Mutually exclusive with 'fullyQualifiedHostname' // and will be overridden if both are defined. Prefix *string } // GatewayProperties - Gateway properties type GatewayProperties struct { - // REQUIRED; Fully qualified resource ID for the application +// REQUIRED; Fully qualified resource ID for the application Application *string - // REQUIRED; Routes attached to this Gateway +// REQUIRED; Routes attached to this Gateway Routes []*GatewayRoute - // Fully qualified resource ID for the environment that the application is linked to +// Fully qualified resource ID for the environment that the application is linked to Environment *string - // Declare hostname information for the Gateway. Leaving the hostname empty auto-assigns one: mygateway.myapp.PUBLICHOSTNAMEORIP.nip.io. +// Declare hostname information for the Gateway. Leaving the hostname empty auto-assigns one: mygateway.myapp.PUBLICHOSTNAMEORIP.nip.io. Hostname *GatewayHostname - // Sets Gateway to not be exposed externally (no public IP address associated). Defaults to false (exposed to internet). +// Sets Gateway to not be exposed externally (no public IP address associated). Defaults to false (exposed to internet). Internal *bool - // TLS configuration for the Gateway. +// TLS configuration for the Gateway. TLS *GatewayTLS - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus - // READ-ONLY; URL of the gateway resource. Readonly +// READ-ONLY; URL of the gateway resource. Readonly URL *string } // GatewayResource - Concrete tracked resource types can be created by aliasing this type using a specific property type. type GatewayResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *GatewayProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // GatewayResourceListResult - The response of a GatewayResource list operation. type GatewayResourceListResult struct { - // REQUIRED; The GatewayResource items on this page +// REQUIRED; The GatewayResource items on this page Value []*GatewayResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // GatewayResourceUpdate - Concrete tracked resource types can be created by aliasing this type using a specific property // type. type GatewayResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // GatewayRoute - Route attached to Gateway type GatewayRoute struct { - // The URL or id of the service to route to. Ex - 'http://myservice'. +// The URL or id of the service to route to. Ex - 'http://myservice'. Destination *string - // Enables websocket support for the route. Defaults to false. +// Enables websocket support for the route. Defaults to false. EnableWebsockets *bool - // The path to match the incoming request path on. Ex - /myservice. +// The path to match the incoming request path on. Ex - /myservice. Path *string - // Optionally update the prefix when sending the request to the service. Ex - replacePrefix: '/' and path: '/myservice' will +// Optionally update the prefix when sending the request to the service. Ex - replacePrefix: '/' and path: '/myservice' will // transform '/myservice/myroute' to '/myroute' ReplacePrefix *string } // GatewayTLS - TLS configuration definition for Gateway resource. type GatewayTLS struct { - // The resource id for the secret containing the TLS certificate and key for the gateway. +// The resource id for the secret containing the TLS certificate and key for the gateway. CertificateFrom *string - // TLS minimum protocol version (defaults to 1.2). +// TLS minimum protocol version (defaults to 1.2). MinimumProtocolVersion *TLSMinVersion - // If true, gateway lets the https traffic sslPassthrough to the backend servers for decryption. +// If true, gateway lets the https traffic sslPassthrough to the backend servers for decryption. SSLPassthrough *bool } // GitAuthConfig - Authentication information used to access private Terraform modules from Git repository sources. type GitAuthConfig struct { - // Personal Access Token (PAT) configuration used to authenticate to Git platforms. +// Personal Access Token (PAT) configuration used to authenticate to Git platforms. Pat map[string]*SecretConfig } // HTTPGetHealthProbeProperties - Specifies the properties for readiness/liveness probe using HTTP Get type HTTPGetHealthProbeProperties struct { - // REQUIRED; The listening port number +// REQUIRED; The listening port number ContainerPort *int32 - // REQUIRED; Discriminator property for HealthProbeProperties. +// REQUIRED; Discriminator property for HealthProbeProperties. Kind *string - // REQUIRED; The route to make the HTTP request on +// REQUIRED; The route to make the HTTP request on Path *string - // Threshold number of times the probe fails after which a failure would be reported +// Threshold number of times the probe fails after which a failure would be reported FailureThreshold *float32 - // Custom HTTP headers to add to the get request +// Custom HTTP headers to add to the get request Headers map[string]*string - // Initial delay in seconds before probing for readiness/liveness +// Initial delay in seconds before probing for readiness/liveness InitialDelaySeconds *float32 - // Interval for the readiness/liveness probe in seconds +// Interval for the readiness/liveness probe in seconds PeriodSeconds *float32 - // Number of seconds after which the readiness/liveness probe times out. Defaults to 5 seconds +// Number of seconds after which the readiness/liveness probe times out. Defaults to 5 seconds TimeoutSeconds *float32 } @@ -866,19 +863,19 @@ func (h *HTTPGetHealthProbeProperties) GetHealthProbeProperties() *HealthProbePr // HealthProbeProperties - Properties for readiness/liveness probe type HealthProbeProperties struct { - // REQUIRED; Discriminator property for HealthProbeProperties. +// REQUIRED; Discriminator property for HealthProbeProperties. Kind *string - // Threshold number of times the probe fails after which a failure would be reported +// Threshold number of times the probe fails after which a failure would be reported FailureThreshold *float32 - // Initial delay in seconds before probing for readiness/liveness +// Initial delay in seconds before probing for readiness/liveness InitialDelaySeconds *float32 - // Interval for the readiness/liveness probe in seconds +// Interval for the readiness/liveness probe in seconds PeriodSeconds *float32 - // Number of seconds after which the readiness/liveness probe times out. Defaults to 5 seconds +// Number of seconds after which the readiness/liveness probe times out. Defaults to 5 seconds TimeoutSeconds *float32 } @@ -887,49 +884,49 @@ func (h *HealthProbeProperties) GetHealthProbeProperties() *HealthProbePropertie // IamProperties - IAM properties type IamProperties struct { - // REQUIRED; The kind of IAM provider to configure +// REQUIRED; The kind of IAM provider to configure Kind *IAMKind - // RBAC permissions to be assigned on the source resource +// RBAC permissions to be assigned on the source resource Roles []*string } // IdentitySettings is the external identity setting. type IdentitySettings struct { - // REQUIRED; kind of identity setting +// REQUIRED; kind of identity setting Kind *IdentitySettingKind - // The URI for your compute platform's OIDC issuer +// The URI for your compute platform's OIDC issuer OidcIssuer *string - // The resource ID of the provisioned identity +// The resource ID of the provisioned identity Resource *string } // KeyObjectProperties - Represents key object properties type KeyObjectProperties struct { - // REQUIRED; The name of the key +// REQUIRED; The name of the key Name *string - // File name when written to disk +// File name when written to disk Alias *string - // Key version +// Key version Version *string } // KubernetesCompute - The Kubernetes compute configuration type KubernetesCompute struct { - // REQUIRED; Discriminator property for EnvironmentCompute. +// REQUIRED; Discriminator property for EnvironmentCompute. Kind *string - // REQUIRED; The namespace to use for the environment. +// REQUIRED; The namespace to use for the environment. Namespace *string - // Configuration for supported external identity providers +// Configuration for supported external identity providers Identity *IdentitySettings - // The resource id of the compute resource for application environment. +// The resource id of the compute resource for application environment. ResourceID *string } @@ -944,13 +941,13 @@ func (k *KubernetesCompute) GetEnvironmentCompute() *EnvironmentCompute { // KubernetesMetadataExtension - Kubernetes metadata extension of a environment/application resource. type KubernetesMetadataExtension struct { - // REQUIRED; Discriminator property for Extension. +// REQUIRED; Discriminator property for Extension. Kind *string - // Annotations to be applied to the Kubernetes resources output by the resource +// Annotations to be applied to the Kubernetes resources output by the resource Annotations map[string]*string - // Labels to be applied to the Kubernetes resources output by the resource +// Labels to be applied to the Kubernetes resources output by the resource Labels map[string]*string } @@ -963,10 +960,10 @@ func (k *KubernetesMetadataExtension) GetExtension() *Extension { // KubernetesNamespaceExtension - Kubernetes namespace extension of a environment/application resource. type KubernetesNamespaceExtension struct { - // REQUIRED; Discriminator property for Extension. +// REQUIRED; Discriminator property for Extension. Kind *string - // REQUIRED; The namespace of the application environment. +// REQUIRED; The namespace of the application environment. Namespace *string } @@ -979,20 +976,20 @@ func (k *KubernetesNamespaceExtension) GetExtension() *Extension { // KubernetesRuntimeProperties - The runtime configuration properties for Kubernetes type KubernetesRuntimeProperties struct { - // The serialized YAML manifest which represents the base Kubernetes resources to deploy, such as Deployment, Service, ServiceAccount, +// The serialized YAML manifest which represents the base Kubernetes resources to deploy, such as Deployment, Service, ServiceAccount, // Secrets, and ConfigMaps. Base *string - // A strategic merge patch that will be applied to the PodSpec object when this container is being deployed. +// A strategic merge patch that will be applied to the PodSpec object when this container is being deployed. Pod map[string]any } // ManualScalingExtension - ManualScaling Extension type ManualScalingExtension struct { - // REQUIRED; Discriminator property for Extension. +// REQUIRED; Discriminator property for Extension. Kind *string - // REQUIRED; Replica count. +// REQUIRED; Replica count. Replicas *int32 } @@ -1005,39 +1002,39 @@ func (m *ManualScalingExtension) GetExtension() *Extension { // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // Localized display information for this particular operation. +// Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +// READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane +// READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane // operations. IsDataAction *bool - // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", +// READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", // "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 +// READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default // value is "user,system" Origin *Origin } // OperationDisplay - Localized display information for this particular operation. type OperationDisplay struct { - // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. +// READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual +// READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual // Machine", "Restart Virtual Machine". Operation *string - // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft +// READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft // Compute". Provider *string - // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job +// READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job // Schedule Collections". Resource *string } @@ -1045,39 +1042,39 @@ type OperationDisplay struct { // OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to // get the next set of results. type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). +// READ-ONLY; URL to get the next set of operation list results (if there are any). NextLink *string - // READ-ONLY; List of operations supported by the resource provider +// READ-ONLY; List of operations supported by the resource provider Value []*Operation } // OutputResource - Properties of an output resource. type OutputResource struct { - // The UCP resource ID of the underlying resource. +// The UCP resource ID of the underlying resource. ID *string - // The logical identifier scoped to the owning Radius resource. This is only needed or used when a resource has a dependency +// The logical identifier scoped to the owning Radius resource. This is only needed or used when a resource has a dependency // relationship. LocalIDs do not have any particular format or meaning beyond // being compared to determine dependency relationships. LocalID *string - // Determines whether Radius manages the lifecycle of the underlying resource. +// Determines whether Radius manages the lifecycle of the underlying resource. RadiusManaged *bool } // PersistentVolume - Specifies a persistent volume for a container type PersistentVolume struct { - // REQUIRED; Discriminator property for Volume. +// REQUIRED; Discriminator property for Volume. Kind *string - // REQUIRED; The source of the volume +// REQUIRED; The source of the volume Source *string - // The path where the volume is mounted +// The path where the volume is mounted MountPath *string - // Container read/write access to the volume +// Container read/write access to the volume Permission *VolumePermission } @@ -1092,99 +1089,99 @@ func (p *PersistentVolume) GetVolume() *Volume { // ProviderConfigProperties - This configuration holds the necessary information to authenticate and interact with a provider // for the recipe execution. type ProviderConfigProperties struct { - // OPTIONAL; Contains additional key/value pairs not defined in the schema. +// OPTIONAL; Contains additional key/value pairs not defined in the schema. AdditionalProperties map[string]any - // Sensitive data in provider configuration can be stored as secrets. The secrets are stored in Applications.Core/SecretStores +// Sensitive data in provider configuration can be stored as secrets. The secrets are stored in Applications.Core/SecretStores // resource. Secrets map[string]*SecretReference } // Providers - The Cloud providers configuration. type Providers struct { - // The AWS cloud provider configuration. +// The AWS cloud provider configuration. Aws *ProvidersAws - // The Azure cloud provider configuration. +// The Azure cloud provider configuration. Azure *ProvidersAzure } // ProvidersAws - The AWS cloud provider definition. type ProvidersAws struct { - // REQUIRED; Target scope for AWS resources to be deployed into. For example: '/planes/aws/aws/accounts/000000000000/regions/us-west-2'. +// REQUIRED; Target scope for AWS resources to be deployed into. For example: '/planes/aws/aws/accounts/000000000000/regions/us-west-2'. Scope *string } // ProvidersAzure - The Azure cloud provider definition. type ProvidersAzure struct { - // REQUIRED; Target scope for Azure resources to be deployed into. For example: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testGroup'. +// REQUIRED; Target scope for Azure resources to be deployed into. For example: '/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/testGroup'. Scope *string } // Recipe - The recipe used to automatically deploy underlying infrastructure for a portable resource type Recipe struct { - // REQUIRED; The name of the recipe within the environment to use +// REQUIRED; The name of the recipe within the environment to use Name *string - // Key/value parameters to pass into the recipe at deployment +// Key/value parameters to pass into the recipe at deployment Parameters map[string]any } // RecipeConfigProperties - Configuration for Recipes. Defines how each type of Recipe should be configured and run. type RecipeConfigProperties struct { - // Configuration for Bicep Recipes. Controls how Bicep plans and applies templates as part of Recipe deployment. +// Configuration for Bicep Recipes. Controls how Bicep plans and applies templates as part of Recipe deployment. Bicep *BicepConfigProperties - // Environment variables injected during recipe execution for the recipes in the environment, currently supported for Terraform +// Environment variables injected during recipe execution for the recipes in the environment, currently supported for Terraform // recipes. Env map[string]*string - // Environment variables containing sensitive information can be stored as secrets. The secrets are stored in Applications.Core/SecretStores +// Environment variables containing sensitive information can be stored as secrets. The secrets are stored in Applications.Core/SecretStores // resource. EnvSecrets map[string]*SecretReference - // Configuration for Terraform Recipes. Controls how Terraform plans and applies templates as part of Recipe deployment. +// Configuration for Terraform Recipes. Controls how Terraform plans and applies templates as part of Recipe deployment. Terraform *TerraformConfigProperties } // RecipeGetMetadata - Represents the request body of the getmetadata action. type RecipeGetMetadata struct { - // REQUIRED; The name of the recipe registered to the environment. +// REQUIRED; The name of the recipe registered to the environment. Name *string - // REQUIRED; Type of the resource this recipe can be consumed by. For example: 'Applications.Datastores/mongoDatabases'. +// REQUIRED; Type of the resource this recipe can be consumed by. For example: 'Applications.Datastores/mongoDatabases'. ResourceType *string } // RecipeGetMetadataResponse - The properties of a Recipe linked to an Environment. type RecipeGetMetadataResponse struct { - // REQUIRED; The key/value parameters to pass to the recipe template at deployment. +// REQUIRED; The key/value parameters to pass to the recipe template at deployment. Parameters map[string]any - // REQUIRED; The format of the template provided by the recipe. Allowed values: bicep, terraform. +// REQUIRED; The format of the template provided by the recipe. Allowed values: bicep, terraform. TemplateKind *string - // REQUIRED; The path to the template provided by the recipe. Currently only link to Azure Container Registry is supported. +// REQUIRED; The path to the template provided by the recipe. Currently only link to Azure Container Registry is supported. TemplatePath *string - // Connect to the Bicep registry using HTTP (not-HTTPS). This should be used when the registry is known not to support HTTPS, +// Connect to the Bicep registry using HTTP (not-HTTPS). This should be used when the registry is known not to support HTTPS, // for example in a locally-hosted registry. Defaults to false (use HTTPS/TLS). PlainHTTP *bool - // The version of the template to deploy. For Terraform recipes using a module registry this is required, but must be omitted +// The version of the template to deploy. For Terraform recipes using a module registry this is required, but must be omitted // for other module sources. TemplateVersion *string } // RecipeProperties - Format of the template provided by the recipe. Allowed values: bicep, terraform. type RecipeProperties struct { - // REQUIRED; Discriminator property for RecipeProperties. +// REQUIRED; Discriminator property for RecipeProperties. TemplateKind *string - // REQUIRED; Path to the template provided by the recipe. Currently only link to Azure Container Registry is supported. +// REQUIRED; Path to the template provided by the recipe. Currently only link to Azure Container Registry is supported. TemplatePath *string - // Key/value parameters to pass to the recipe template at deployment. +// Key/value parameters to pass to the recipe template at deployment. Parameters map[string]any } @@ -1193,65 +1190,65 @@ func (r *RecipeProperties) GetRecipeProperties() *RecipeProperties { return r } // RecipeStatus - Recipe status at deployment time for a resource. type RecipeStatus struct { - // REQUIRED; TemplateKind is the kind of the recipe template used by the portable resource upon deployment. +// REQUIRED; TemplateKind is the kind of the recipe template used by the portable resource upon deployment. TemplateKind *string - // REQUIRED; TemplatePath is the path of the recipe consumed by the portable resource upon deployment. +// REQUIRED; TemplatePath is the path of the recipe consumed by the portable resource upon deployment. TemplatePath *string - // TemplateVersion is the version number of the template. +// TemplateVersion is the version number of the template. TemplateVersion *string } // RegistrySecretConfig - Registry Secret Configuration used to authenticate to private bicep registries. type RegistrySecretConfig struct { - // The ID of an Applications.Core/SecretStore resource containing credential information used to authenticate private container +// The ID of an Applications.Core/SecretStore resource containing credential information used to authenticate private container // registry.The keys in the secretstore depends on the type. Secret *string } // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ResourceReference - Describes a reference to an existing resource type ResourceReference struct { - // REQUIRED; Resource id of an existing resource +// REQUIRED; Resource id of an existing resource ID *string } // ResourceStatus - Status of a resource. type ResourceStatus struct { - // The compute resource associated with the resource. +// The compute resource associated with the resource. Compute EnvironmentComputeClassification - // Properties of an output resource +// Properties of an output resource OutputResources []*OutputResource - // READ-ONLY; The recipe data at the time of deployment +// READ-ONLY; The recipe data at the time of deployment Recipe *RecipeStatus } // RuntimesProperties - The properties for runtime configuration type RuntimesProperties struct { - // The runtime configuration properties for Kubernetes +// The runtime configuration properties for Kubernetes Kubernetes *KubernetesRuntimeProperties } // SecretConfig - Personal Access Token (PAT) configuration used to authenticate to Git platforms. type SecretConfig struct { - // The ID of an Applications.Core/SecretStore resource containing the Git platform personal access token (PAT). The secret +// The ID of an Applications.Core/SecretStore resource containing the Git platform personal access token (PAT). The secret // store must have a secret named 'pat', containing the PAT value. A secret named // 'username' is optional, containing the username associated with the pat. By default no username is specified. Secret *string @@ -1259,165 +1256,165 @@ type SecretConfig struct { // SecretObjectProperties - Represents secret object properties type SecretObjectProperties struct { - // REQUIRED; The name of the secret +// REQUIRED; The name of the secret Name *string - // File name when written to disk +// File name when written to disk Alias *string - // Encoding format. Default utf-8 +// Encoding format. Default utf-8 Encoding *VolumeSecretEncodings - // secret version +// secret version Version *string } // SecretReference - This secret is used within a recipe. Secrets are encrypted, often have fine-grained access control, auditing // and are recommended to be used to hold sensitive data. type SecretReference struct { - // REQUIRED; The key for the secret in the secret store. +// REQUIRED; The key for the secret in the secret store. Key *string - // REQUIRED; The ID of an Applications.Core/SecretStore resource containing sensitive data required for recipe execution. +// REQUIRED; The ID of an Applications.Core/SecretStore resource containing sensitive data required for recipe execution. Source *string } // SecretStoreListSecretsResult - The list of secrets type SecretStoreListSecretsResult struct { - // REQUIRED; An object to represent key-value type secrets +// REQUIRED; An object to represent key-value type secrets Data map[string]*SecretValueProperties - // REQUIRED; The type of secret store data +// REQUIRED; The type of secret store data Type *SecretStoreDataType } // SecretStoreProperties - The properties of SecretStore type SecretStoreProperties struct { - // REQUIRED; An object to represent key-value type secrets +// REQUIRED; An object to represent key-value type secrets Data map[string]*SecretValueProperties - // Fully qualified resource ID for the application +// Fully qualified resource ID for the application Application *string - // Fully qualified resource ID for the environment that the application is linked to +// Fully qualified resource ID for the environment that the application is linked to Environment *string - // The resource id of external secret store. +// The resource id of external secret store. Resource *string - // The type of secret store data +// The type of secret store data Type *SecretStoreDataType - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } // SecretStoreResource - Concrete tracked resource types can be created by aliasing this type using a specific property type. type SecretStoreResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *SecretStoreProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // SecretStoreResourceListResult - The response of a SecretStoreResource list operation. type SecretStoreResourceListResult struct { - // REQUIRED; The SecretStoreResource items on this page +// REQUIRED; The SecretStoreResource items on this page Value []*SecretStoreResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // SecretStoreResourceUpdate - Concrete tracked resource types can be created by aliasing this type using a specific property // type. type SecretStoreResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // SecretValueProperties - The properties of SecretValue type SecretValueProperties struct { - // The encoding of value +// The encoding of value Encoding *SecretValueEncoding - // The value of secret. +// The value of secret. Value *string - // The referenced secret in properties.resource +// The referenced secret in properties.resource ValueFrom *ValueFromProperties } // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { - // The timestamp of resource creation (UTC). +// The timestamp of resource creation (UTC). CreatedAt *time.Time - // The identity that created the resource. +// The identity that created the resource. CreatedBy *string - // The type of identity that created the resource. +// The type of identity that created the resource. CreatedByType *CreatedByType - // The timestamp of resource last modification (UTC) +// The timestamp of resource last modification (UTC) LastModifiedAt *time.Time - // The identity that last modified the resource. +// The identity that last modified the resource. LastModifiedBy *string - // The type of identity that last modified the resource. +// The type of identity that last modified the resource. LastModifiedByType *CreatedByType } // TCPHealthProbeProperties - Specifies the properties for readiness/liveness probe using TCP type TCPHealthProbeProperties struct { - // REQUIRED; The listening port number +// REQUIRED; The listening port number ContainerPort *int32 - // REQUIRED; Discriminator property for HealthProbeProperties. +// REQUIRED; Discriminator property for HealthProbeProperties. Kind *string - // Threshold number of times the probe fails after which a failure would be reported +// Threshold number of times the probe fails after which a failure would be reported FailureThreshold *float32 - // Initial delay in seconds before probing for readiness/liveness +// Initial delay in seconds before probing for readiness/liveness InitialDelaySeconds *float32 - // Interval for the readiness/liveness probe in seconds +// Interval for the readiness/liveness probe in seconds PeriodSeconds *float32 - // Number of seconds after which the readiness/liveness probe times out. Defaults to 5 seconds +// Number of seconds after which the readiness/liveness probe times out. Defaults to 5 seconds TimeoutSeconds *float32 } @@ -1435,10 +1432,10 @@ func (t *TCPHealthProbeProperties) GetHealthProbeProperties() *HealthProbeProper // TerraformConfigProperties - Configuration for Terraform Recipes. Controls how Terraform plans and applies templates as // part of Recipe deployment. type TerraformConfigProperties struct { - // Authentication information used to access private Terraform module sources. Supported module sources: Git. +// Authentication information used to access private Terraform module sources. Supported module sources: Git. Authentication *AuthConfig - // Configuration for Terraform Recipe Providers. Controls how Terraform interacts with cloud providers, SaaS providers, and +// Configuration for Terraform Recipe Providers. Controls how Terraform interacts with cloud providers, SaaS providers, and // other APIs. For more information, please see: // https://developer.hashicorp.com/terraform/language/providers/configuration. Providers map[string][]*ProviderConfigProperties @@ -1446,16 +1443,16 @@ type TerraformConfigProperties struct { // TerraformRecipeProperties - Represents Terraform recipe properties. type TerraformRecipeProperties struct { - // REQUIRED; Discriminator property for RecipeProperties. +// REQUIRED; Discriminator property for RecipeProperties. TemplateKind *string - // REQUIRED; Path to the template provided by the recipe. Currently only link to Azure Container Registry is supported. +// REQUIRED; Path to the template provided by the recipe. Currently only link to Azure Container Registry is supported. TemplatePath *string - // Key/value parameters to pass to the recipe template at deployment. +// Key/value parameters to pass to the recipe template at deployment. Parameters map[string]any - // Version of the template to deploy. For Terraform recipes using a module registry this is required, but must be omitted +// Version of the template to deploy. For Terraform recipes using a module registry this is required, but must be omitted // for other module sources. TemplateVersion *string } @@ -1472,40 +1469,40 @@ func (t *TerraformRecipeProperties) GetRecipeProperties() *RecipeProperties { // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ValueFromProperties - The Secret value source properties type ValueFromProperties struct { - // REQUIRED; The name of the referenced secret. +// REQUIRED; The name of the referenced secret. Name *string - // The version of the referenced secret. +// The version of the referenced secret. Version *string } // Volume - Specifies a volume for a container type Volume struct { - // REQUIRED; Discriminator property for Volume. +// REQUIRED; Discriminator property for Volume. Kind *string - // The path where the volume is mounted +// The path where the volume is mounted MountPath *string } @@ -1514,19 +1511,19 @@ func (v *Volume) GetVolume() *Volume { return v } // VolumeProperties - Volume properties type VolumeProperties struct { - // REQUIRED; Fully qualified resource ID for the application +// REQUIRED; Fully qualified resource ID for the application Application *string - // REQUIRED; Discriminator property for VolumeProperties. +// REQUIRED; Discriminator property for VolumeProperties. Kind *string - // Fully qualified resource ID for the environment that the application is linked to +// Fully qualified resource ID for the environment that the application is linked to Environment *string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } @@ -1535,52 +1532,52 @@ func (v *VolumeProperties) GetVolumeProperties() *VolumeProperties { return v } // VolumeResource - Radius Volume resource. type VolumeResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties VolumePropertiesClassification - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // VolumeResourceListResult - The response of a VolumeResource list operation. type VolumeResourceListResult struct { - // REQUIRED; The VolumeResource items on this page +// REQUIRED; The VolumeResource items on this page Value []*VolumeResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // VolumeResourceUpdate - Radius Volume resource. type VolumeResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } diff --git a/pkg/corerp/api/v20231001preview/zz_generated_models_serde.go b/pkg/corerp/api/v20231001preview/zz_generated_models_serde.go index d02daf69d5..2fe7f8dc62 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_models_serde.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_models_serde.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -3324,10 +3321,10 @@ func (s *SecretValueProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -3343,7 +3340,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) @@ -3352,7 +3349,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) @@ -3773,7 +3770,7 @@ func populate(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/pkg/corerp/api/v20231001preview/zz_generated_operations_client.go b/pkg/corerp/api/v20231001preview/zz_generated_operations_client.go index 98a01b0f36..47bf528f1b 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_operations_client.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_operations_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -26,7 +23,7 @@ type OperationsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -46,30 +43,25 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return OperationsClientListResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return OperationsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Applications.Core/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/pkg/corerp/api/v20231001preview/zz_generated_options.go b/pkg/corerp/api/v20231001preview/zz_generated_options.go index b5984dbc9a..3d8e22c67a 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_options.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_options.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -40,19 +37,19 @@ type ApplicationsClientUpdateOptions struct { // ContainersClientBeginCreateOrUpdateOptions contains the optional parameters for the ContainersClient.BeginCreateOrUpdate // method. type ContainersClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // ContainersClientBeginDeleteOptions contains the optional parameters for the ContainersClient.BeginDelete method. type ContainersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // ContainersClientBeginUpdateOptions contains the optional parameters for the ContainersClient.BeginUpdate method. type ContainersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -99,19 +96,19 @@ type EnvironmentsClientUpdateOptions struct { // ExtendersClientBeginCreateOrUpdateOptions contains the optional parameters for the ExtendersClient.BeginCreateOrUpdate // method. type ExtendersClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // ExtendersClientBeginDeleteOptions contains the optional parameters for the ExtendersClient.BeginDelete method. type ExtendersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // ExtendersClientBeginUpdateOptions contains the optional parameters for the ExtendersClient.BeginUpdate method. type ExtendersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -132,19 +129,19 @@ type ExtendersClientListSecretsOptions struct { // GatewaysClientBeginCreateOptions contains the optional parameters for the GatewaysClient.BeginCreate method. type GatewaysClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // GatewaysClientBeginCreateOrUpdateOptions contains the optional parameters for the GatewaysClient.BeginCreateOrUpdate method. type GatewaysClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // GatewaysClientBeginDeleteOptions contains the optional parameters for the GatewaysClient.BeginDelete method. type GatewaysClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -166,19 +163,19 @@ type OperationsClientListOptions struct { // SecretStoresClientBeginCreateOrUpdateOptions contains the optional parameters for the SecretStoresClient.BeginCreateOrUpdate // method. type SecretStoresClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // SecretStoresClientBeginDeleteOptions contains the optional parameters for the SecretStoresClient.BeginDelete method. type SecretStoresClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // SecretStoresClientBeginUpdateOptions contains the optional parameters for the SecretStoresClient.BeginUpdate method. type SecretStoresClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -199,19 +196,19 @@ type SecretStoresClientListSecretsOptions struct { // VolumesClientBeginCreateOrUpdateOptions contains the optional parameters for the VolumesClient.BeginCreateOrUpdate method. type VolumesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // VolumesClientBeginDeleteOptions contains the optional parameters for the VolumesClient.BeginDelete method. type VolumesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // VolumesClientBeginUpdateOptions contains the optional parameters for the VolumesClient.BeginUpdate method. type VolumesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/pkg/corerp/api/v20231001preview/zz_generated_polymorphic_helpers.go b/pkg/corerp/api/v20231001preview/zz_generated_polymorphic_helpers.go index 176251b27b..a0b0491bef 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_polymorphic_helpers.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_polymorphic_helpers.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -10,7 +7,7 @@ package v20231001preview import "encoding/json" func unmarshalEnvironmentComputeClassification(rawMsg json.RawMessage) (EnvironmentComputeClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -31,7 +28,7 @@ func unmarshalEnvironmentComputeClassification(rawMsg json.RawMessage) (Environm } func unmarshalExtensionClassification(rawMsg json.RawMessage) (ExtensionClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -58,7 +55,7 @@ func unmarshalExtensionClassification(rawMsg json.RawMessage) (ExtensionClassifi } func unmarshalExtensionClassificationArray(rawMsg json.RawMessage) ([]ExtensionClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var rawMessages []json.RawMessage @@ -77,7 +74,7 @@ func unmarshalExtensionClassificationArray(rawMsg json.RawMessage) ([]ExtensionC } func unmarshalHealthProbePropertiesClassification(rawMsg json.RawMessage) (HealthProbePropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -102,7 +99,7 @@ func unmarshalHealthProbePropertiesClassification(rawMsg json.RawMessage) (Healt } func unmarshalRecipePropertiesClassification(rawMsg json.RawMessage) (RecipePropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -125,7 +122,7 @@ func unmarshalRecipePropertiesClassification(rawMsg json.RawMessage) (RecipeProp } func unmarshalRecipePropertiesClassificationMap(rawMsg json.RawMessage) (map[string]RecipePropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var rawMessages map[string]json.RawMessage @@ -144,7 +141,7 @@ func unmarshalRecipePropertiesClassificationMap(rawMsg json.RawMessage) (map[str } func unmarshalVolumeClassification(rawMsg json.RawMessage) (VolumeClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -167,7 +164,7 @@ func unmarshalVolumeClassification(rawMsg json.RawMessage) (VolumeClassification } func unmarshalVolumeClassificationMap(rawMsg json.RawMessage) (map[string]VolumeClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var rawMessages map[string]json.RawMessage @@ -186,7 +183,7 @@ func unmarshalVolumeClassificationMap(rawMsg json.RawMessage) (map[string]Volume } func unmarshalVolumePropertiesClassification(rawMsg json.RawMessage) (VolumePropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any diff --git a/pkg/corerp/api/v20231001preview/zz_generated_response_types.go b/pkg/corerp/api/v20231001preview/zz_generated_responses.go similarity index 78% rename from pkg/corerp/api/v20231001preview/zz_generated_response_types.go rename to pkg/corerp/api/v20231001preview/zz_generated_responses.go index 8322ebd40c..2d0542c82d 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_response_types.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_responses.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -9,7 +6,7 @@ package v20231001preview // ApplicationsClientCreateOrUpdateResponse contains the response from method ApplicationsClient.CreateOrUpdate. type ApplicationsClientCreateOrUpdateResponse struct { - // Radius Application resource +// Radius Application resource ApplicationResource } @@ -20,31 +17,31 @@ type ApplicationsClientDeleteResponse struct { // ApplicationsClientGetGraphResponse contains the response from method ApplicationsClient.GetGraph. type ApplicationsClientGetGraphResponse struct { - // Describes the application architecture and its dependencies. +// Describes the application architecture and its dependencies. ApplicationGraphResponse } // ApplicationsClientGetResponse contains the response from method ApplicationsClient.Get. type ApplicationsClientGetResponse struct { - // Radius Application resource +// Radius Application resource ApplicationResource } // ApplicationsClientListByScopeResponse contains the response from method ApplicationsClient.NewListByScopePager. type ApplicationsClientListByScopeResponse struct { - // The response of a ApplicationResource list operation. +// The response of a ApplicationResource list operation. ApplicationResourceListResult } // ApplicationsClientUpdateResponse contains the response from method ApplicationsClient.Update. type ApplicationsClientUpdateResponse struct { - // Radius Application resource +// Radius Application resource ApplicationResource } // ContainersClientCreateOrUpdateResponse contains the response from method ContainersClient.BeginCreateOrUpdate. type ContainersClientCreateOrUpdateResponse struct { - // Concrete tracked resource types can be created by aliasing this type using a specific property type. +// Concrete tracked resource types can be created by aliasing this type using a specific property type. ContainerResource } @@ -55,25 +52,25 @@ type ContainersClientDeleteResponse struct { // ContainersClientGetResponse contains the response from method ContainersClient.Get. type ContainersClientGetResponse struct { - // Concrete tracked resource types can be created by aliasing this type using a specific property type. +// Concrete tracked resource types can be created by aliasing this type using a specific property type. ContainerResource } // ContainersClientListByScopeResponse contains the response from method ContainersClient.NewListByScopePager. type ContainersClientListByScopeResponse struct { - // The response of a ContainerResource list operation. +// The response of a ContainerResource list operation. ContainerResourceListResult } // ContainersClientUpdateResponse contains the response from method ContainersClient.BeginUpdate. type ContainersClientUpdateResponse struct { - // Concrete tracked resource types can be created by aliasing this type using a specific property type. +// Concrete tracked resource types can be created by aliasing this type using a specific property type. ContainerResource } // EnvironmentsClientCreateOrUpdateResponse contains the response from method EnvironmentsClient.CreateOrUpdate. type EnvironmentsClientCreateOrUpdateResponse struct { - // The environment resource +// The environment resource EnvironmentResource } @@ -84,31 +81,31 @@ type EnvironmentsClientDeleteResponse struct { // EnvironmentsClientGetMetadataResponse contains the response from method EnvironmentsClient.GetMetadata. type EnvironmentsClientGetMetadataResponse struct { - // The properties of a Recipe linked to an Environment. +// The properties of a Recipe linked to an Environment. RecipeGetMetadataResponse } // EnvironmentsClientGetResponse contains the response from method EnvironmentsClient.Get. type EnvironmentsClientGetResponse struct { - // The environment resource +// The environment resource EnvironmentResource } // EnvironmentsClientListByScopeResponse contains the response from method EnvironmentsClient.NewListByScopePager. type EnvironmentsClientListByScopeResponse struct { - // The response of a EnvironmentResource list operation. +// The response of a EnvironmentResource list operation. EnvironmentResourceListResult } // EnvironmentsClientUpdateResponse contains the response from method EnvironmentsClient.Update. type EnvironmentsClientUpdateResponse struct { - // The environment resource +// The environment resource EnvironmentResource } // ExtendersClientCreateOrUpdateResponse contains the response from method ExtendersClient.BeginCreateOrUpdate. type ExtendersClientCreateOrUpdateResponse struct { - // ExtenderResource portable resource +// ExtenderResource portable resource ExtenderResource } @@ -119,37 +116,37 @@ type ExtendersClientDeleteResponse struct { // ExtendersClientGetResponse contains the response from method ExtendersClient.Get. type ExtendersClientGetResponse struct { - // ExtenderResource portable resource +// ExtenderResource portable resource ExtenderResource } // ExtendersClientListByScopeResponse contains the response from method ExtendersClient.NewListByScopePager. type ExtendersClientListByScopeResponse struct { - // The response of a ExtenderResource list operation. +// The response of a ExtenderResource list operation. ExtenderResourceListResult } // ExtendersClientListSecretsResponse contains the response from method ExtendersClient.ListSecrets. type ExtendersClientListSecretsResponse struct { - // Response for list secrets API call +// Response for list secrets API call Value map[string]any } // ExtendersClientUpdateResponse contains the response from method ExtendersClient.BeginUpdate. type ExtendersClientUpdateResponse struct { - // ExtenderResource portable resource +// ExtenderResource portable resource ExtenderResource } // GatewaysClientCreateOrUpdateResponse contains the response from method GatewaysClient.BeginCreateOrUpdate. type GatewaysClientCreateOrUpdateResponse struct { - // Concrete tracked resource types can be created by aliasing this type using a specific property type. +// Concrete tracked resource types can be created by aliasing this type using a specific property type. GatewayResource } // GatewaysClientCreateResponse contains the response from method GatewaysClient.BeginCreate. type GatewaysClientCreateResponse struct { - // Concrete tracked resource types can be created by aliasing this type using a specific property type. +// Concrete tracked resource types can be created by aliasing this type using a specific property type. GatewayResource } @@ -160,25 +157,25 @@ type GatewaysClientDeleteResponse struct { // GatewaysClientGetResponse contains the response from method GatewaysClient.Get. type GatewaysClientGetResponse struct { - // Concrete tracked resource types can be created by aliasing this type using a specific property type. +// Concrete tracked resource types can be created by aliasing this type using a specific property type. GatewayResource } // GatewaysClientListByScopeResponse contains the response from method GatewaysClient.NewListByScopePager. type GatewaysClientListByScopeResponse struct { - // The response of a GatewayResource list operation. +// The response of a GatewayResource list operation. GatewayResourceListResult } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. 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. +// 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 } // SecretStoresClientCreateOrUpdateResponse contains the response from method SecretStoresClient.BeginCreateOrUpdate. type SecretStoresClientCreateOrUpdateResponse struct { - // Concrete tracked resource types can be created by aliasing this type using a specific property type. +// Concrete tracked resource types can be created by aliasing this type using a specific property type. SecretStoreResource } @@ -189,31 +186,31 @@ type SecretStoresClientDeleteResponse struct { // SecretStoresClientGetResponse contains the response from method SecretStoresClient.Get. type SecretStoresClientGetResponse struct { - // Concrete tracked resource types can be created by aliasing this type using a specific property type. +// Concrete tracked resource types can be created by aliasing this type using a specific property type. SecretStoreResource } // SecretStoresClientListByScopeResponse contains the response from method SecretStoresClient.NewListByScopePager. type SecretStoresClientListByScopeResponse struct { - // The response of a SecretStoreResource list operation. +// The response of a SecretStoreResource list operation. SecretStoreResourceListResult } // SecretStoresClientListSecretsResponse contains the response from method SecretStoresClient.ListSecrets. type SecretStoresClientListSecretsResponse struct { - // The list of secrets +// The list of secrets SecretStoreListSecretsResult } // SecretStoresClientUpdateResponse contains the response from method SecretStoresClient.BeginUpdate. type SecretStoresClientUpdateResponse struct { - // Concrete tracked resource types can be created by aliasing this type using a specific property type. +// Concrete tracked resource types can be created by aliasing this type using a specific property type. SecretStoreResource } // VolumesClientCreateOrUpdateResponse contains the response from method VolumesClient.BeginCreateOrUpdate. type VolumesClientCreateOrUpdateResponse struct { - // Radius Volume resource. +// Radius Volume resource. VolumeResource } @@ -224,19 +221,19 @@ type VolumesClientDeleteResponse struct { // VolumesClientGetResponse contains the response from method VolumesClient.Get. type VolumesClientGetResponse struct { - // Radius Volume resource. +// Radius Volume resource. VolumeResource } // VolumesClientListByScopeResponse contains the response from method VolumesClient.NewListByScopePager. type VolumesClientListByScopeResponse struct { - // The response of a VolumeResource list operation. +// The response of a VolumeResource list operation. VolumeResourceListResult } // VolumesClientUpdateResponse contains the response from method VolumesClient.BeginUpdate. type VolumesClientUpdateResponse struct { - // Radius Volume resource. +// Radius Volume resource. VolumeResource } diff --git a/pkg/corerp/api/v20231001preview/zz_generated_secretstores_client.go b/pkg/corerp/api/v20231001preview/zz_generated_secretstores_client.go index 760cfa2260..e49673c32d 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_secretstores_client.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_secretstores_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type SecretStoresClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSecretStoresClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecretStoresClient, error) { - cl, err := arm.NewClient(moduleName+".SecretStoresClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -60,10 +57,13 @@ func (client *SecretStoresClient) BeginCreateOrUpdate(ctx context.Context, secre } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecretStoresClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[SecretStoresClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SecretStoresClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -73,6 +73,10 @@ func (client *SecretStoresClient) BeginCreateOrUpdate(ctx context.Context, secre // Generated from API version 2023-10-01-preview func (client *SecretStoresClient) createOrUpdate(ctx context.Context, secretStoreName string, resource SecretStoreResource, options *SecretStoresClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "SecretStoresClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, secretStoreName, resource, options) if err != nil { return nil, err @@ -89,7 +93,7 @@ func (client *SecretStoresClient) createOrUpdate(ctx context.Context, secretStor } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *SecretStoresClient) createOrUpdateCreateRequest(ctx context.Context, secretStoreName string, resource SecretStoreResource, options *SecretStoresClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *SecretStoresClient) createOrUpdateCreateRequest(ctx context.Context, secretStoreName string, resource SecretStoreResource, _ *SecretStoresClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/secretStores/{secretStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if secretStoreName == "" { @@ -107,7 +111,7 @@ func (client *SecretStoresClient) createOrUpdateCreateRequest(ctx context.Contex if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a SecretStoreResource @@ -125,10 +129,13 @@ func (client *SecretStoresClient) BeginDelete(ctx context.Context, secretStoreNa } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecretStoresClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[SecretStoresClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SecretStoresClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -138,6 +145,10 @@ func (client *SecretStoresClient) BeginDelete(ctx context.Context, secretStoreNa // Generated from API version 2023-10-01-preview func (client *SecretStoresClient) deleteOperation(ctx context.Context, secretStoreName string, options *SecretStoresClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "SecretStoresClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, secretStoreName, options) if err != nil { return nil, err @@ -154,7 +165,7 @@ func (client *SecretStoresClient) deleteOperation(ctx context.Context, secretSto } // deleteCreateRequest creates the Delete request. -func (client *SecretStoresClient) deleteCreateRequest(ctx context.Context, secretStoreName string, options *SecretStoresClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SecretStoresClient) deleteCreateRequest(ctx context.Context, secretStoreName string, _ *SecretStoresClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/secretStores/{secretStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if secretStoreName == "" { @@ -180,6 +191,10 @@ func (client *SecretStoresClient) deleteCreateRequest(ctx context.Context, secre // - options - SecretStoresClientGetOptions contains the optional parameters for the SecretStoresClient.Get method. func (client *SecretStoresClient) Get(ctx context.Context, secretStoreName string, options *SecretStoresClientGetOptions) (SecretStoresClientGetResponse, error) { var err error + const operationName = "SecretStoresClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, secretStoreName, options) if err != nil { return SecretStoresClientGetResponse{}, err @@ -197,7 +212,7 @@ func (client *SecretStoresClient) Get(ctx context.Context, secretStoreName strin } // getCreateRequest creates the Get request. -func (client *SecretStoresClient) getCreateRequest(ctx context.Context, secretStoreName string, options *SecretStoresClientGetOptions) (*policy.Request, error) { +func (client *SecretStoresClient) getCreateRequest(ctx context.Context, secretStoreName string, _ *SecretStoresClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/secretStores/{secretStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if secretStoreName == "" { @@ -235,30 +250,25 @@ func (client *SecretStoresClient) NewListByScopePager(options *SecretStoresClien return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *SecretStoresClientListByScopeResponse) (SecretStoresClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return SecretStoresClientListByScopeResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SecretStoresClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return SecretStoresClientListByScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SecretStoresClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *SecretStoresClient) listByScopeCreateRequest(ctx context.Context, options *SecretStoresClientListByScopeOptions) (*policy.Request, error) { +func (client *SecretStoresClient) listByScopeCreateRequest(ctx context.Context, _ *SecretStoresClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/secretStores" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -291,6 +301,10 @@ func (client *SecretStoresClient) listByScopeHandleResponse(resp *http.Response) // method. func (client *SecretStoresClient) ListSecrets(ctx context.Context, secretStoreName string, body map[string]any, options *SecretStoresClientListSecretsOptions) (SecretStoresClientListSecretsResponse, error) { var err error + const operationName = "SecretStoresClient.ListSecrets" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listSecretsCreateRequest(ctx, secretStoreName, body, options) if err != nil { return SecretStoresClientListSecretsResponse{}, err @@ -308,7 +322,7 @@ func (client *SecretStoresClient) ListSecrets(ctx context.Context, secretStoreNa } // listSecretsCreateRequest creates the ListSecrets request. -func (client *SecretStoresClient) listSecretsCreateRequest(ctx context.Context, secretStoreName string, body map[string]any, options *SecretStoresClientListSecretsOptions) (*policy.Request, error) { +func (client *SecretStoresClient) listSecretsCreateRequest(ctx context.Context, secretStoreName string, body map[string]any, _ *SecretStoresClientListSecretsOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/secretStores/{secretStoreName}/listSecrets" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if secretStoreName == "" { @@ -326,7 +340,7 @@ func (client *SecretStoresClient) listSecretsCreateRequest(ctx context.Context, if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err } - return req, nil +; return req, nil } // listSecretsHandleResponse handles the ListSecrets response. @@ -354,10 +368,13 @@ func (client *SecretStoresClient) BeginUpdate(ctx context.Context, secretStoreNa } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecretStoresClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[SecretStoresClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SecretStoresClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -367,6 +384,10 @@ func (client *SecretStoresClient) BeginUpdate(ctx context.Context, secretStoreNa // Generated from API version 2023-10-01-preview func (client *SecretStoresClient) update(ctx context.Context, secretStoreName string, properties SecretStoreResourceUpdate, options *SecretStoresClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "SecretStoresClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, secretStoreName, properties, options) if err != nil { return nil, err @@ -383,7 +404,7 @@ func (client *SecretStoresClient) update(ctx context.Context, secretStoreName st } // updateCreateRequest creates the Update request. -func (client *SecretStoresClient) updateCreateRequest(ctx context.Context, secretStoreName string, properties SecretStoreResourceUpdate, options *SecretStoresClientBeginUpdateOptions) (*policy.Request, error) { +func (client *SecretStoresClient) updateCreateRequest(ctx context.Context, secretStoreName string, properties SecretStoreResourceUpdate, _ *SecretStoresClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/secretStores/{secretStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if secretStoreName == "" { @@ -401,6 +422,6 @@ func (client *SecretStoresClient) updateCreateRequest(ctx context.Context, secre if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/corerp/api/v20231001preview/zz_generated_time_rfc3339.go b/pkg/corerp/api/v20231001preview/zz_generated_time_rfc3339.go index 948a6660cd..bbe5fcce12 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_time_rfc3339.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_time_rfc3339.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -21,51 +18,78 @@ import ( +// 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+)*"*$`) + const ( - utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` - utcLayout = "2006-01-02T15:04:05.999999999" - rfc3339JSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) -// 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+)*"*$`) - -type timeRFC3339 time.Time +type dateTimeRFC3339 time.Time -func (t timeRFC3339) MarshalJSON() (json []byte, err error) { +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { tt := time.Time(t) return tt.MarshalJSON() } -func (t timeRFC3339) MarshalText() (text []byte, err error) { +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { tt := time.Time(t) return tt.MarshalText() } -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcLayoutJSON - if tzOffsetRegex.Match(data) { - layout = rfc3339JSON +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { - layout := utcLayout - if tzOffsetRegex.Match(data) { +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) Parse(layout, value string) error { +func (t *dateTimeRFC3339) Parse(layout, value string) error { p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) + *t = dateTimeRFC3339(p) return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { @@ -74,14 +98,14 @@ func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { } else if reflect.ValueOf(t).IsNil() { return } - m[k] = (*timeRFC3339)(t) + m[k] = (*dateTimeRFC3339)(t) } -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { return nil } - var aux timeRFC3339 + var aux dateTimeRFC3339 if err := json.Unmarshal(data, &aux); err != nil { return fmt.Errorf("struct field %s: %v", fn, err) } diff --git a/pkg/corerp/api/v20231001preview/zz_generated_volumes_client.go b/pkg/corerp/api/v20231001preview/zz_generated_volumes_client.go index a371b7191a..9d752795e1 100644 --- a/pkg/corerp/api/v20231001preview/zz_generated_volumes_client.go +++ b/pkg/corerp/api/v20231001preview/zz_generated_volumes_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type VolumesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewVolumesClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VolumesClient, error) { - cl, err := arm.NewClient(moduleName+".VolumesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -60,10 +57,13 @@ func (client *VolumesClient) BeginCreateOrUpdate(ctx context.Context, volumeName } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[VolumesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VolumesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -73,6 +73,10 @@ func (client *VolumesClient) BeginCreateOrUpdate(ctx context.Context, volumeName // Generated from API version 2023-10-01-preview func (client *VolumesClient) createOrUpdate(ctx context.Context, volumeName string, resource VolumeResource, options *VolumesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "VolumesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, volumeName, resource, options) if err != nil { return nil, err @@ -89,7 +93,7 @@ func (client *VolumesClient) createOrUpdate(ctx context.Context, volumeName stri } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VolumesClient) createOrUpdateCreateRequest(ctx context.Context, volumeName string, resource VolumeResource, options *VolumesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *VolumesClient) createOrUpdateCreateRequest(ctx context.Context, volumeName string, resource VolumeResource, _ *VolumesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/volumes/{volumeName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if volumeName == "" { @@ -107,7 +111,7 @@ func (client *VolumesClient) createOrUpdateCreateRequest(ctx context.Context, vo if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a VolumeResource @@ -124,10 +128,13 @@ func (client *VolumesClient) BeginDelete(ctx context.Context, volumeName string, } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[VolumesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VolumesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -137,6 +144,10 @@ func (client *VolumesClient) BeginDelete(ctx context.Context, volumeName string, // Generated from API version 2023-10-01-preview func (client *VolumesClient) deleteOperation(ctx context.Context, volumeName string, options *VolumesClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "VolumesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, volumeName, options) if err != nil { return nil, err @@ -153,7 +164,7 @@ func (client *VolumesClient) deleteOperation(ctx context.Context, volumeName str } // deleteCreateRequest creates the Delete request. -func (client *VolumesClient) deleteCreateRequest(ctx context.Context, volumeName string, options *VolumesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *VolumesClient) deleteCreateRequest(ctx context.Context, volumeName string, _ *VolumesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/volumes/{volumeName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if volumeName == "" { @@ -179,6 +190,10 @@ func (client *VolumesClient) deleteCreateRequest(ctx context.Context, volumeName // - options - VolumesClientGetOptions contains the optional parameters for the VolumesClient.Get method. func (client *VolumesClient) Get(ctx context.Context, volumeName string, options *VolumesClientGetOptions) (VolumesClientGetResponse, error) { var err error + const operationName = "VolumesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, volumeName, options) if err != nil { return VolumesClientGetResponse{}, err @@ -196,7 +211,7 @@ func (client *VolumesClient) Get(ctx context.Context, volumeName string, options } // getCreateRequest creates the Get request. -func (client *VolumesClient) getCreateRequest(ctx context.Context, volumeName string, options *VolumesClientGetOptions) (*policy.Request, error) { +func (client *VolumesClient) getCreateRequest(ctx context.Context, volumeName string, _ *VolumesClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/volumes/{volumeName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if volumeName == "" { @@ -233,30 +248,25 @@ func (client *VolumesClient) NewListByScopePager(options *VolumesClientListBySco return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *VolumesClientListByScopeResponse) (VolumesClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VolumesClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return VolumesClientListByScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return VolumesClientListByScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return VolumesClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *VolumesClient) listByScopeCreateRequest(ctx context.Context, options *VolumesClientListByScopeOptions) (*policy.Request, error) { +func (client *VolumesClient) listByScopeCreateRequest(ctx context.Context, _ *VolumesClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/volumes" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -294,10 +304,13 @@ func (client *VolumesClient) BeginUpdate(ctx context.Context, volumeName string, } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VolumesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[VolumesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[VolumesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -307,6 +320,10 @@ func (client *VolumesClient) BeginUpdate(ctx context.Context, volumeName string, // Generated from API version 2023-10-01-preview func (client *VolumesClient) update(ctx context.Context, volumeName string, properties VolumeResourceUpdate, options *VolumesClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "VolumesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, volumeName, properties, options) if err != nil { return nil, err @@ -323,7 +340,7 @@ func (client *VolumesClient) update(ctx context.Context, volumeName string, prop } // updateCreateRequest creates the Update request. -func (client *VolumesClient) updateCreateRequest(ctx context.Context, volumeName string, properties VolumeResourceUpdate, options *VolumesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *VolumesClient) updateCreateRequest(ctx context.Context, volumeName string, properties VolumeResourceUpdate, _ *VolumesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Core/volumes/{volumeName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if volumeName == "" { @@ -341,6 +358,6 @@ func (client *VolumesClient) updateCreateRequest(ctx context.Context, volumeName if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } From 40f25d849a08e628c912b3ad444171c7d1ebd208 Mon Sep 17 00:00:00 2001 From: lakshmimsft Date: Sat, 9 Nov 2024 23:57:26 -0800 Subject: [PATCH 8/9] generate clients for ucp, dapr Signed-off-by: lakshmimsft --- build/generate.mk | 4 +- pkg/daprrp/api/README.md | 3 +- ...zz_generated_configurationstores_server.go | 314 +++++++++++++++ .../fake/zz_generated_internal.go | 66 +++ .../fake/zz_generated_operations_server.go | 118 ++++++ .../fake/zz_generated_pubsubbrokers_server.go | 314 +++++++++++++++ .../fake/zz_generated_secretstores_server.go | 314 +++++++++++++++ .../fake/zz_generated_server_factory.go | 101 +++++ .../fake/zz_generated_statestores_server.go | 314 +++++++++++++++ .../fake/zz_generated_time_rfc3339.go | 114 ++++++ .../zz_generated_client_factory.go | 46 ++- ...zz_generated_configurationstores_client.go | 73 ++-- .../zz_generated_constants.go | 29 +- .../zz_generated_interfaces.go | 3 - .../v20231001preview/zz_generated_models.go | 349 ++++++++-------- .../zz_generated_models_serde.go | 13 +- .../zz_generated_operations_client.go | 30 +- .../v20231001preview/zz_generated_options.go | 27 +- .../zz_generated_polymorphic_helpers.go | 5 +- .../zz_generated_pubsubbrokers_client.go | 73 ++-- ...nse_types.go => zz_generated_responses.go} | 37 +- .../zz_generated_secretstores_client.go | 73 ++-- .../zz_generated_statestores_client.go | 73 ++-- .../zz_generated_time_rfc3339.go | 76 ++-- pkg/ucp/api/README.md | 3 +- .../fake/zz_generated_apiversions_server.go | 310 ++++++++++++++ .../zz_generated_awscredentials_server.go | 295 ++++++++++++++ .../fake/zz_generated_awsplanes_server.go | 308 ++++++++++++++ .../zz_generated_azurecredentials_server.go | 295 ++++++++++++++ .../fake/zz_generated_azureplanes_server.go | 308 ++++++++++++++ .../fake/zz_generated_internal.go | 66 +++ .../fake/zz_generated_locations_server.go | 294 ++++++++++++++ .../fake/zz_generated_planes_server.go | 118 ++++++ .../fake/zz_generated_radiusplanes_server.go | 308 ++++++++++++++ .../zz_generated_resourcegroups_server.go | 295 ++++++++++++++ .../zz_generated_resourceproviders_server.go | 362 +++++++++++++++++ .../fake/zz_generated_resources_server.go | 134 ++++++ .../fake/zz_generated_resourcetypes_server.go | 294 ++++++++++++++ .../fake/zz_generated_server_factory.go | 150 +++++++ .../fake/zz_generated_time_rfc3339.go | 114 ++++++ .../zz_generated_apiversions_client.go | 60 +-- .../zz_generated_awscredentials_client.go | 58 +-- .../zz_generated_awsplanes_client.go | 73 ++-- .../zz_generated_azurecredentials_client.go | 58 +-- .../zz_generated_azureplanes_client.go | 73 ++-- .../zz_generated_client_factory.go | 83 ++-- .../zz_generated_constants.go | 31 +- .../zz_generated_interfaces.go | 3 - .../zz_generated_locations_client.go | 60 +-- .../v20231001preview/zz_generated_models.go | 381 +++++++++--------- .../zz_generated_models_serde.go | 13 +- .../v20231001preview/zz_generated_options.go | 37 +- .../zz_generated_planes_client.go | 30 +- .../zz_generated_polymorphic_helpers.go | 9 +- .../zz_generated_radiusplanes_client.go | 73 ++-- .../zz_generated_resourcegroups_client.go | 58 +-- .../zz_generated_resourceproviders_client.go | 91 +++-- .../zz_generated_resources_client.go | 30 +- .../zz_generated_resourcetypes_client.go | 60 +-- ...nse_types.go => zz_generated_responses.go} | 83 ++-- .../zz_generated_time_rfc3339.go | 76 ++-- typespec/UCP/ucp-operations.tsp | 3 +- 62 files changed, 6584 insertions(+), 1082 deletions(-) create mode 100644 pkg/daprrp/api/v20231001preview/fake/zz_generated_configurationstores_server.go create mode 100644 pkg/daprrp/api/v20231001preview/fake/zz_generated_internal.go create mode 100644 pkg/daprrp/api/v20231001preview/fake/zz_generated_operations_server.go create mode 100644 pkg/daprrp/api/v20231001preview/fake/zz_generated_pubsubbrokers_server.go create mode 100644 pkg/daprrp/api/v20231001preview/fake/zz_generated_secretstores_server.go create mode 100644 pkg/daprrp/api/v20231001preview/fake/zz_generated_server_factory.go create mode 100644 pkg/daprrp/api/v20231001preview/fake/zz_generated_statestores_server.go create mode 100644 pkg/daprrp/api/v20231001preview/fake/zz_generated_time_rfc3339.go rename pkg/daprrp/api/v20231001preview/{zz_generated_response_types.go => zz_generated_responses.go} (82%) create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_apiversions_server.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_awscredentials_server.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_awsplanes_server.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_azurecredentials_server.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_azureplanes_server.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_internal.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_locations_server.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_planes_server.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_radiusplanes_server.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_resourcegroups_server.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_resourceproviders_server.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_resources_server.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_resourcetypes_server.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_server_factory.go create mode 100644 pkg/ucp/api/v20231001preview/fake/zz_generated_time_rfc3339.go rename pkg/ucp/api/v20231001preview/{zz_generated_response_types.go => zz_generated_responses.go} (79%) diff --git a/build/generate.mk b/build/generate.mk index dbb4129736..56b0655f9f 100644 --- a/build/generate.mk +++ b/build/generate.mk @@ -94,12 +94,12 @@ generate-rad-messagingrp-client: generate-node-installed generate-autorest-insta .PHONY: generate-rad-daprrp-client generate-rad-daprrp-client: generate-node-installed generate-autorest-installed generate-tsp-installed generate-openapi-spec ## Generates the daprrp client SDK (Autorest). @echo "$(AUTOREST_MODULE_VERSION) is module version" - autorest pkg/daprrp/api/README.md --tag=dapr-2023-10-01-preview + autorest pkg/daprrp/api/README.md --tag=dapr-2023-10-01-preview && rm pkg/daprrp/api/v20231001preview/go.mod .PHONY: generate-rad-ucp-client generate-rad-ucp-client: generate-node-installed generate-autorest-installed test-ucp-spec-examples ## Generates the UCP client SDK (Autorest). @echo "$(AUTOREST_MODULE_VERSION) is module version" - autorest pkg/ucp/api/README.md --tag=ucp-2023-10-01-preview + autorest pkg/ucp/api/README.md --tag=ucp-2023-10-01-preview && rm pkg/ucp/api/v20231001preview/go.mod .PHONY: generate-mockgen-installed generate-mockgen-installed: diff --git a/pkg/daprrp/api/README.md b/pkg/daprrp/api/README.md index 4bf3b8d8cc..a1d526f3e0 100644 --- a/pkg/daprrp/api/README.md +++ b/pkg/daprrp/api/README.md @@ -44,7 +44,8 @@ The following configuration generates track2 go models and client. ```yaml $(tag) != '' version: 3.*.* -use: "@autorest/go@4.0.0-preview.55" +use: "@autorest/go@4.0.0-preview.69" +module: "github.com/radius-project/radius/pkg/daprrp/api/v20231001preview" module-version: 0.0.1 file-prefix: zz_generated_ license-header: "Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information.\nCode generated by Microsoft (R) AutoRest Code Generator.\nChanges may cause incorrect behavior and will be lost if the code is regenerated." diff --git a/pkg/daprrp/api/v20231001preview/fake/zz_generated_configurationstores_server.go b/pkg/daprrp/api/v20231001preview/fake/zz_generated_configurationstores_server.go new file mode 100644 index 0000000000..fefb7f46f2 --- /dev/null +++ b/pkg/daprrp/api/v20231001preview/fake/zz_generated_configurationstores_server.go @@ -0,0 +1,314 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/daprrp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// ConfigurationStoresServer is a fake server for instances of the v20231001preview.ConfigurationStoresClient type. +type ConfigurationStoresServer struct{ + // BeginCreateOrUpdate is the fake for method ConfigurationStoresClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, configurationStoreName string, resource v20231001preview.DaprConfigurationStoreResource, options *v20231001preview.ConfigurationStoresClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.ConfigurationStoresClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ConfigurationStoresClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, configurationStoreName string, options *v20231001preview.ConfigurationStoresClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.ConfigurationStoresClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ConfigurationStoresClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, configurationStoreName string, options *v20231001preview.ConfigurationStoresClientGetOptions) (resp azfake.Responder[v20231001preview.ConfigurationStoresClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method ConfigurationStoresClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.ConfigurationStoresClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.ConfigurationStoresClientListByScopeResponse]) + + // BeginUpdate is the fake for method ConfigurationStoresClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, configurationStoreName string, properties v20231001preview.DaprConfigurationStoreResourceUpdate, options *v20231001preview.ConfigurationStoresClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.ConfigurationStoresClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewConfigurationStoresServerTransport creates a new instance of ConfigurationStoresServerTransport with the provided implementation. +// The returned ConfigurationStoresServerTransport instance is connected to an instance of v20231001preview.ConfigurationStoresClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewConfigurationStoresServerTransport(srv *ConfigurationStoresServer) *ConfigurationStoresServerTransport { + return &ConfigurationStoresServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.ConfigurationStoresClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.ConfigurationStoresClientDeleteResponse]](), + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.ConfigurationStoresClientListByScopeResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.ConfigurationStoresClientUpdateResponse]](), + } +} + +// ConfigurationStoresServerTransport connects instances of v20231001preview.ConfigurationStoresClient to instances of ConfigurationStoresServer. +// Don't use this type directly, use NewConfigurationStoresServerTransport instead. +type ConfigurationStoresServerTransport struct { + srv *ConfigurationStoresServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.ConfigurationStoresClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.ConfigurationStoresClientDeleteResponse]] + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.ConfigurationStoresClientListByScopeResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.ConfigurationStoresClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for ConfigurationStoresServerTransport. +func (c *ConfigurationStoresServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return c.dispatchToMethodFake(req, method) +} + +func (c *ConfigurationStoresServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if configurationStoresServerTransportInterceptor != nil { + res.resp, res.err, intercepted = configurationStoresServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ConfigurationStoresClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "ConfigurationStoresClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "ConfigurationStoresClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "ConfigurationStoresClient.NewListByScopePager": + res.resp, res.err = c.dispatchNewListByScopePager(req) + case "ConfigurationStoresClient.BeginUpdate": + res.resp, res.err = c.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (c *ConfigurationStoresServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := c.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/configurationStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.DaprConfigurationStoreResource](req) + if err != nil { + return nil, err + } + configurationStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configurationStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), configurationStoreNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + c.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + c.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + c.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (c *ConfigurationStoresServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if c.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := c.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/configurationStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + configurationStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configurationStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginDelete(req.Context(), configurationStoreNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + c.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + c.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + c.beginDelete.remove(req) + } + + return resp, nil +} + +func (c *ConfigurationStoresServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/configurationStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + configurationStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configurationStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), configurationStoreNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DaprConfigurationStoreResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ConfigurationStoresServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if c.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := c.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/configurationStores` + 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 := c.srv.NewListByScopePager(nil) + newListByScopePager = &resp + c.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.ConfigurationStoresClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + c.newListByScopePager.remove(req) + } + return resp, nil +} + +func (c *ConfigurationStoresServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if c.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := c.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/configurationStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.DaprConfigurationStoreResourceUpdate](req) + if err != nil { + return nil, err + } + configurationStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("configurationStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.BeginUpdate(req.Context(), configurationStoreNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + c.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + c.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + c.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to ConfigurationStoresServerTransport +var configurationStoresServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/daprrp/api/v20231001preview/fake/zz_generated_internal.go b/pkg/daprrp/api/v20231001preview/fake/zz_generated_internal.go new file mode 100644 index 0000000000..0c62457a83 --- /dev/null +++ b/pkg/daprrp/api/v20231001preview/fake/zz_generated_internal.go @@ -0,0 +1,66 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/pkg/daprrp/api/v20231001preview/fake/zz_generated_operations_server.go b/pkg/daprrp/api/v20231001preview/fake/zz_generated_operations_server.go new file mode 100644 index 0000000000..f683157e0f --- /dev/null +++ b/pkg/daprrp/api/v20231001preview/fake/zz_generated_operations_server.go @@ -0,0 +1,118 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + 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/radius-project/radius/pkg/daprrp/api/v20231001preview" + "net/http" +) + +// OperationsServer is a fake server for instances of the v20231001preview.OperationsClient type. +type OperationsServer struct{ + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *v20231001preview.OperationsClientListOptions) (resp azfake.PagerResponder[v20231001preview.OperationsClientListResponse]) + +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of v20231001preview.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[v20231001preview.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of v20231001preview.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[v20231001preview.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { +resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/daprrp/api/v20231001preview/fake/zz_generated_pubsubbrokers_server.go b/pkg/daprrp/api/v20231001preview/fake/zz_generated_pubsubbrokers_server.go new file mode 100644 index 0000000000..66d859fd71 --- /dev/null +++ b/pkg/daprrp/api/v20231001preview/fake/zz_generated_pubsubbrokers_server.go @@ -0,0 +1,314 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/daprrp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// PubSubBrokersServer is a fake server for instances of the v20231001preview.PubSubBrokersClient type. +type PubSubBrokersServer struct{ + // BeginCreateOrUpdate is the fake for method PubSubBrokersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, pubSubBrokerName string, resource v20231001preview.DaprPubSubBrokerResource, options *v20231001preview.PubSubBrokersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.PubSubBrokersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PubSubBrokersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, pubSubBrokerName string, options *v20231001preview.PubSubBrokersClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.PubSubBrokersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PubSubBrokersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, pubSubBrokerName string, options *v20231001preview.PubSubBrokersClientGetOptions) (resp azfake.Responder[v20231001preview.PubSubBrokersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method PubSubBrokersClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.PubSubBrokersClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.PubSubBrokersClientListByScopeResponse]) + + // BeginUpdate is the fake for method PubSubBrokersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, pubSubBrokerName string, properties v20231001preview.DaprPubSubBrokerResourceUpdate, options *v20231001preview.PubSubBrokersClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.PubSubBrokersClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewPubSubBrokersServerTransport creates a new instance of PubSubBrokersServerTransport with the provided implementation. +// The returned PubSubBrokersServerTransport instance is connected to an instance of v20231001preview.PubSubBrokersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPubSubBrokersServerTransport(srv *PubSubBrokersServer) *PubSubBrokersServerTransport { + return &PubSubBrokersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.PubSubBrokersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.PubSubBrokersClientDeleteResponse]](), + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.PubSubBrokersClientListByScopeResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.PubSubBrokersClientUpdateResponse]](), + } +} + +// PubSubBrokersServerTransport connects instances of v20231001preview.PubSubBrokersClient to instances of PubSubBrokersServer. +// Don't use this type directly, use NewPubSubBrokersServerTransport instead. +type PubSubBrokersServerTransport struct { + srv *PubSubBrokersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.PubSubBrokersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.PubSubBrokersClientDeleteResponse]] + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.PubSubBrokersClientListByScopeResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.PubSubBrokersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for PubSubBrokersServerTransport. +func (p *PubSubBrokersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *PubSubBrokersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if pubSubBrokersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = pubSubBrokersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PubSubBrokersClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "PubSubBrokersClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PubSubBrokersClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PubSubBrokersClient.NewListByScopePager": + res.resp, res.err = p.dispatchNewListByScopePager(req) + case "PubSubBrokersClient.BeginUpdate": + res.resp, res.err = p.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (p *PubSubBrokersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/pubSubBrokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.DaprPubSubBrokerResource](req) + if err != nil { + return nil, err + } + pubSubBrokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("pubSubBrokerName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), pubSubBrokerNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *PubSubBrokersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/pubSubBrokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + pubSubBrokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("pubSubBrokerName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), pubSubBrokerNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PubSubBrokersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/pubSubBrokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + pubSubBrokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("pubSubBrokerName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), pubSubBrokerNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DaprPubSubBrokerResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PubSubBrokersServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if p.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := p.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/pubSubBrokers` + 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 := p.srv.NewListByScopePager(nil) + newListByScopePager = &resp + p.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.PubSubBrokersClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + p.newListByScopePager.remove(req) + } + return resp, nil +} + +func (p *PubSubBrokersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/pubSubBrokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.DaprPubSubBrokerResourceUpdate](req) + if err != nil { + return nil, err + } + pubSubBrokerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("pubSubBrokerName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), pubSubBrokerNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + p.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + p.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to PubSubBrokersServerTransport +var pubSubBrokersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/daprrp/api/v20231001preview/fake/zz_generated_secretstores_server.go b/pkg/daprrp/api/v20231001preview/fake/zz_generated_secretstores_server.go new file mode 100644 index 0000000000..8d360185ff --- /dev/null +++ b/pkg/daprrp/api/v20231001preview/fake/zz_generated_secretstores_server.go @@ -0,0 +1,314 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/daprrp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// SecretStoresServer is a fake server for instances of the v20231001preview.SecretStoresClient type. +type SecretStoresServer struct{ + // BeginCreateOrUpdate is the fake for method SecretStoresClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, secretStoreName string, resource v20231001preview.DaprSecretStoreResource, options *v20231001preview.SecretStoresClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.SecretStoresClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SecretStoresClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, secretStoreName string, options *v20231001preview.SecretStoresClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.SecretStoresClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SecretStoresClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, secretStoreName string, options *v20231001preview.SecretStoresClientGetOptions) (resp azfake.Responder[v20231001preview.SecretStoresClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method SecretStoresClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.SecretStoresClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.SecretStoresClientListByScopeResponse]) + + // BeginUpdate is the fake for method SecretStoresClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, secretStoreName string, properties v20231001preview.DaprSecretStoreResourceUpdate, options *v20231001preview.SecretStoresClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.SecretStoresClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewSecretStoresServerTransport creates a new instance of SecretStoresServerTransport with the provided implementation. +// The returned SecretStoresServerTransport instance is connected to an instance of v20231001preview.SecretStoresClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSecretStoresServerTransport(srv *SecretStoresServer) *SecretStoresServerTransport { + return &SecretStoresServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.SecretStoresClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.SecretStoresClientDeleteResponse]](), + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.SecretStoresClientListByScopeResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.SecretStoresClientUpdateResponse]](), + } +} + +// SecretStoresServerTransport connects instances of v20231001preview.SecretStoresClient to instances of SecretStoresServer. +// Don't use this type directly, use NewSecretStoresServerTransport instead. +type SecretStoresServerTransport struct { + srv *SecretStoresServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.SecretStoresClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.SecretStoresClientDeleteResponse]] + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.SecretStoresClientListByScopeResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.SecretStoresClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for SecretStoresServerTransport. +func (s *SecretStoresServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *SecretStoresServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if secretStoresServerTransportInterceptor != nil { + res.resp, res.err, intercepted = secretStoresServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SecretStoresClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "SecretStoresClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SecretStoresClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SecretStoresClient.NewListByScopePager": + res.resp, res.err = s.dispatchNewListByScopePager(req) + case "SecretStoresClient.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SecretStoresServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/secretStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.DaprSecretStoreResource](req) + if err != nil { + return nil, err + } + secretStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("secretStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), secretStoreNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *SecretStoresServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/secretStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + secretStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("secretStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), secretStoreNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + s.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *SecretStoresServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/secretStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + secretStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("secretStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), secretStoreNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DaprSecretStoreResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SecretStoresServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := s.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/secretStores` + 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 := s.srv.NewListByScopePager(nil) + newListByScopePager = &resp + s.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.SecretStoresClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + s.newListByScopePager.remove(req) + } + return resp, nil +} + +func (s *SecretStoresServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := s.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/secretStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.DaprSecretStoreResourceUpdate](req) + if err != nil { + return nil, err + } + secretStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("secretStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdate(req.Context(), secretStoreNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + s.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + s.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to SecretStoresServerTransport +var secretStoresServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/daprrp/api/v20231001preview/fake/zz_generated_server_factory.go b/pkg/daprrp/api/v20231001preview/fake/zz_generated_server_factory.go new file mode 100644 index 0000000000..0f11c087f9 --- /dev/null +++ b/pkg/daprrp/api/v20231001preview/fake/zz_generated_server_factory.go @@ -0,0 +1,101 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the v20231001preview.ClientFactory type. +type ServerFactory struct { + // ConfigurationStoresServer contains the fakes for client ConfigurationStoresClient + ConfigurationStoresServer ConfigurationStoresServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // PubSubBrokersServer contains the fakes for client PubSubBrokersClient + PubSubBrokersServer PubSubBrokersServer + + // SecretStoresServer contains the fakes for client SecretStoresClient + SecretStoresServer SecretStoresServer + + // StateStoresServer contains the fakes for client StateStoresClient + StateStoresServer StateStoresServer + +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of v20231001preview.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of v20231001preview.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trConfigurationStoresServer *ConfigurationStoresServerTransport + trOperationsServer *OperationsServerTransport + trPubSubBrokersServer *PubSubBrokersServerTransport + trSecretStoresServer *SecretStoresServerTransport + trStateStoresServer *StateStoresServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "ConfigurationStoresClient": + initServer(s, &s.trConfigurationStoresServer, func() *ConfigurationStoresServerTransport { return NewConfigurationStoresServerTransport(&s.srv.ConfigurationStoresServer) }) + resp, err = s.trConfigurationStoresServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "PubSubBrokersClient": + initServer(s, &s.trPubSubBrokersServer, func() *PubSubBrokersServerTransport { return NewPubSubBrokersServerTransport(&s.srv.PubSubBrokersServer) }) + resp, err = s.trPubSubBrokersServer.Do(req) + case "SecretStoresClient": + initServer(s, &s.trSecretStoresServer, func() *SecretStoresServerTransport { return NewSecretStoresServerTransport(&s.srv.SecretStoresServer) }) + resp, err = s.trSecretStoresServer.Do(req) + case "StateStoresClient": + initServer(s, &s.trStateStoresServer, func() *StateStoresServerTransport { return NewStateStoresServerTransport(&s.srv.StateStoresServer) }) + resp, err = s.trStateStoresServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/pkg/daprrp/api/v20231001preview/fake/zz_generated_statestores_server.go b/pkg/daprrp/api/v20231001preview/fake/zz_generated_statestores_server.go new file mode 100644 index 0000000000..097919bed4 --- /dev/null +++ b/pkg/daprrp/api/v20231001preview/fake/zz_generated_statestores_server.go @@ -0,0 +1,314 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/daprrp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// StateStoresServer is a fake server for instances of the v20231001preview.StateStoresClient type. +type StateStoresServer struct{ + // BeginCreateOrUpdate is the fake for method StateStoresClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, stateStoreName string, resource v20231001preview.DaprStateStoreResource, options *v20231001preview.StateStoresClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.StateStoresClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method StateStoresClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, stateStoreName string, options *v20231001preview.StateStoresClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.StateStoresClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method StateStoresClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, stateStoreName string, options *v20231001preview.StateStoresClientGetOptions) (resp azfake.Responder[v20231001preview.StateStoresClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method StateStoresClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.StateStoresClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.StateStoresClientListByScopeResponse]) + + // BeginUpdate is the fake for method StateStoresClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, stateStoreName string, properties v20231001preview.DaprStateStoreResourceUpdate, options *v20231001preview.StateStoresClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.StateStoresClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewStateStoresServerTransport creates a new instance of StateStoresServerTransport with the provided implementation. +// The returned StateStoresServerTransport instance is connected to an instance of v20231001preview.StateStoresClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewStateStoresServerTransport(srv *StateStoresServer) *StateStoresServerTransport { + return &StateStoresServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.StateStoresClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.StateStoresClientDeleteResponse]](), + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.StateStoresClientListByScopeResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.StateStoresClientUpdateResponse]](), + } +} + +// StateStoresServerTransport connects instances of v20231001preview.StateStoresClient to instances of StateStoresServer. +// Don't use this type directly, use NewStateStoresServerTransport instead. +type StateStoresServerTransport struct { + srv *StateStoresServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.StateStoresClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.StateStoresClientDeleteResponse]] + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.StateStoresClientListByScopeResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.StateStoresClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for StateStoresServerTransport. +func (s *StateStoresServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *StateStoresServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if stateStoresServerTransportInterceptor != nil { + res.resp, res.err, intercepted = stateStoresServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "StateStoresClient.BeginCreateOrUpdate": + res.resp, res.err = s.dispatchBeginCreateOrUpdate(req) + case "StateStoresClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "StateStoresClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "StateStoresClient.NewListByScopePager": + res.resp, res.err = s.dispatchNewListByScopePager(req) + case "StateStoresClient.BeginUpdate": + res.resp, res.err = s.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *StateStoresServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := s.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/stateStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.DaprStateStoreResource](req) + if err != nil { + return nil, err + } + stateStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("stateStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreateOrUpdate(req.Context(), stateStoreNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + s.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + s.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (s *StateStoresServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if s.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := s.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/stateStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + stateStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("stateStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), stateStoreNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + s.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + s.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + s.beginDelete.remove(req) + } + + return resp, nil +} + +func (s *StateStoresServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/stateStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + stateStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("stateStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), stateStoreNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DaprStateStoreResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *StateStoresServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := s.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/stateStores` + 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 := s.srv.NewListByScopePager(nil) + newListByScopePager = &resp + s.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.StateStoresClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + s.newListByScopePager.remove(req) + } + return resp, nil +} + +func (s *StateStoresServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if s.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := s.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Dapr/stateStores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.DaprStateStoreResourceUpdate](req) + if err != nil { + return nil, err + } + stateStoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("stateStoreName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginUpdate(req.Context(), stateStoreNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + s.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + s.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to StateStoresServerTransport +var stateStoresServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/daprrp/api/v20231001preview/fake/zz_generated_time_rfc3339.go b/pkg/daprrp/api/v20231001preview/fake/zz_generated_time_rfc3339.go new file mode 100644 index 0000000000..83c75cddc6 --- /dev/null +++ b/pkg/daprrp/api/v20231001preview/fake/zz_generated_time_rfc3339.go @@ -0,0 +1,114 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + + + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + + + +// 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+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +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 + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_client_factory.go b/pkg/daprrp/api/v20231001preview/zz_generated_client_factory.go index e5971bf730..1431c737b5 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_client_factory.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_client_factory.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -16,8 +13,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { rootScope string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -28,38 +24,52 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - rootScope: rootScope, credential: credential, - options: options.Clone(), + rootScope: rootScope, + internal: internal, }, nil } +// NewConfigurationStoresClient creates a new instance of ConfigurationStoresClient. func (c *ClientFactory) NewConfigurationStoresClient() *ConfigurationStoresClient { - subClient, _ := NewConfigurationStoresClient(c.rootScope, c.credential, c.options) - return subClient + return &ConfigurationStoresClient{ + rootScope: c.rootScope, + internal: c.internal, + } } +// NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } +// NewPubSubBrokersClient creates a new instance of PubSubBrokersClient. func (c *ClientFactory) NewPubSubBrokersClient() *PubSubBrokersClient { - subClient, _ := NewPubSubBrokersClient(c.rootScope, c.credential, c.options) - return subClient + return &PubSubBrokersClient{ + rootScope: c.rootScope, + internal: c.internal, + } } +// NewSecretStoresClient creates a new instance of SecretStoresClient. func (c *ClientFactory) NewSecretStoresClient() *SecretStoresClient { - subClient, _ := NewSecretStoresClient(c.rootScope, c.credential, c.options) - return subClient + return &SecretStoresClient{ + rootScope: c.rootScope, + internal: c.internal, + } } +// NewStateStoresClient creates a new instance of StateStoresClient. func (c *ClientFactory) NewStateStoresClient() *StateStoresClient { - subClient, _ := NewStateStoresClient(c.rootScope, c.credential, c.options) - return subClient + return &StateStoresClient{ + rootScope: c.rootScope, + internal: c.internal, + } } diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_configurationstores_client.go b/pkg/daprrp/api/v20231001preview/zz_generated_configurationstores_client.go index 105be3a538..874737e7d2 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_configurationstores_client.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_configurationstores_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type ConfigurationStoresClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewConfigurationStoresClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConfigurationStoresClient, error) { - cl, err := arm.NewClient(moduleName+".ConfigurationStoresClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -60,10 +57,13 @@ func (client *ConfigurationStoresClient) BeginCreateOrUpdate(ctx context.Context } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConfigurationStoresClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[ConfigurationStoresClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ConfigurationStoresClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -73,6 +73,10 @@ func (client *ConfigurationStoresClient) BeginCreateOrUpdate(ctx context.Context // Generated from API version 2023-10-01-preview func (client *ConfigurationStoresClient) createOrUpdate(ctx context.Context, configurationStoreName string, resource DaprConfigurationStoreResource, options *ConfigurationStoresClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "ConfigurationStoresClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, configurationStoreName, resource, options) if err != nil { return nil, err @@ -89,7 +93,7 @@ func (client *ConfigurationStoresClient) createOrUpdate(ctx context.Context, con } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ConfigurationStoresClient) createOrUpdateCreateRequest(ctx context.Context, configurationStoreName string, resource DaprConfigurationStoreResource, options *ConfigurationStoresClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ConfigurationStoresClient) createOrUpdateCreateRequest(ctx context.Context, configurationStoreName string, resource DaprConfigurationStoreResource, _ *ConfigurationStoresClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/configurationStores/{configurationStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if configurationStoreName == "" { @@ -107,7 +111,7 @@ func (client *ConfigurationStoresClient) createOrUpdateCreateRequest(ctx context if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a DaprConfigurationStoreResource @@ -125,10 +129,13 @@ func (client *ConfigurationStoresClient) BeginDelete(ctx context.Context, config } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConfigurationStoresClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[ConfigurationStoresClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ConfigurationStoresClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -138,6 +145,10 @@ func (client *ConfigurationStoresClient) BeginDelete(ctx context.Context, config // Generated from API version 2023-10-01-preview func (client *ConfigurationStoresClient) deleteOperation(ctx context.Context, configurationStoreName string, options *ConfigurationStoresClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "ConfigurationStoresClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, configurationStoreName, options) if err != nil { return nil, err @@ -154,7 +165,7 @@ func (client *ConfigurationStoresClient) deleteOperation(ctx context.Context, co } // deleteCreateRequest creates the Delete request. -func (client *ConfigurationStoresClient) deleteCreateRequest(ctx context.Context, configurationStoreName string, options *ConfigurationStoresClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ConfigurationStoresClient) deleteCreateRequest(ctx context.Context, configurationStoreName string, _ *ConfigurationStoresClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/configurationStores/{configurationStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if configurationStoreName == "" { @@ -180,6 +191,10 @@ func (client *ConfigurationStoresClient) deleteCreateRequest(ctx context.Context // - options - ConfigurationStoresClientGetOptions contains the optional parameters for the ConfigurationStoresClient.Get method. func (client *ConfigurationStoresClient) Get(ctx context.Context, configurationStoreName string, options *ConfigurationStoresClientGetOptions) (ConfigurationStoresClientGetResponse, error) { var err error + const operationName = "ConfigurationStoresClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, configurationStoreName, options) if err != nil { return ConfigurationStoresClientGetResponse{}, err @@ -197,7 +212,7 @@ func (client *ConfigurationStoresClient) Get(ctx context.Context, configurationS } // getCreateRequest creates the Get request. -func (client *ConfigurationStoresClient) getCreateRequest(ctx context.Context, configurationStoreName string, options *ConfigurationStoresClientGetOptions) (*policy.Request, error) { +func (client *ConfigurationStoresClient) getCreateRequest(ctx context.Context, configurationStoreName string, _ *ConfigurationStoresClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/configurationStores/{configurationStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if configurationStoreName == "" { @@ -235,30 +250,25 @@ func (client *ConfigurationStoresClient) NewListByScopePager(options *Configurat return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ConfigurationStoresClientListByScopeResponse) (ConfigurationStoresClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ConfigurationStoresClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return ConfigurationStoresClientListByScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ConfigurationStoresClientListByScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ConfigurationStoresClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *ConfigurationStoresClient) listByScopeCreateRequest(ctx context.Context, options *ConfigurationStoresClientListByScopeOptions) (*policy.Request, error) { +func (client *ConfigurationStoresClient) listByScopeCreateRequest(ctx context.Context, _ *ConfigurationStoresClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/configurationStores" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -297,10 +307,13 @@ func (client *ConfigurationStoresClient) BeginUpdate(ctx context.Context, config } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ConfigurationStoresClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[ConfigurationStoresClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ConfigurationStoresClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -310,6 +323,10 @@ func (client *ConfigurationStoresClient) BeginUpdate(ctx context.Context, config // Generated from API version 2023-10-01-preview func (client *ConfigurationStoresClient) update(ctx context.Context, configurationStoreName string, properties DaprConfigurationStoreResourceUpdate, options *ConfigurationStoresClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "ConfigurationStoresClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, configurationStoreName, properties, options) if err != nil { return nil, err @@ -326,7 +343,7 @@ func (client *ConfigurationStoresClient) update(ctx context.Context, configurati } // updateCreateRequest creates the Update request. -func (client *ConfigurationStoresClient) updateCreateRequest(ctx context.Context, configurationStoreName string, properties DaprConfigurationStoreResourceUpdate, options *ConfigurationStoresClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ConfigurationStoresClient) updateCreateRequest(ctx context.Context, configurationStoreName string, properties DaprConfigurationStoreResourceUpdate, _ *ConfigurationStoresClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/configurationStores/{configurationStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if configurationStoreName == "" { @@ -344,6 +361,6 @@ func (client *ConfigurationStoresClient) updateCreateRequest(ctx context.Context if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_constants.go b/pkg/daprrp/api/v20231001preview/zz_generated_constants.go index dee57fba78..501ce6ab69 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_constants.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_constants.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -8,7 +5,7 @@ package v20231001preview const ( - moduleName = "v20231001preview" + moduleName = "github.com/radius-project/radius/pkg/daprrp/api/v20231001preview" moduleVersion = "v0.0.1" ) @@ -50,9 +47,9 @@ func PossibleCreatedByTypeValues() []CreatedByType { type IdentitySettingKind string const ( - // IdentitySettingKindAzureComWorkload - azure ad workload identity +// IdentitySettingKindAzureComWorkload - azure ad workload identity IdentitySettingKindAzureComWorkload IdentitySettingKind = "azure.com.workload" - // IdentitySettingKindUndefined - undefined identity +// IdentitySettingKindUndefined - undefined identity IdentitySettingKindUndefined IdentitySettingKind = "undefined" ) @@ -87,21 +84,21 @@ func PossibleOriginValues() []Origin { type ProvisioningState string const ( - // ProvisioningStateAccepted - The resource create request has been accepted +// ProvisioningStateAccepted - The resource create request has been accepted ProvisioningStateAccepted ProvisioningState = "Accepted" - // ProvisioningStateCanceled - The resource provisioning has been canceled +// ProvisioningStateCanceled - The resource provisioning has been canceled ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreating - The resource is being created +// ProvisioningStateCreating - The resource is being created ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting - The resource is being deleted +// ProvisioningStateDeleting - The resource is being deleted ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed - The resource provisioning has failed +// ProvisioningStateFailed - The resource provisioning has failed ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateProvisioning - The resource is being provisioned +// ProvisioningStateProvisioning - The resource is being provisioned ProvisioningStateProvisioning ProvisioningState = "Provisioning" - // ProvisioningStateSucceeded - The resource has been successfully provisioned +// ProvisioningStateSucceeded - The resource has been successfully provisioned ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating - The resource is being updated +// ProvisioningStateUpdating - The resource is being updated ProvisioningStateUpdating ProvisioningState = "Updating" ) @@ -125,9 +122,9 @@ func PossibleProvisioningStateValues() []ProvisioningState { type ResourceProvisioning string const ( - // ResourceProvisioningManual - The resource lifecycle will be managed by the user +// ResourceProvisioningManual - The resource lifecycle will be managed by the user ResourceProvisioningManual ResourceProvisioning = "manual" - // ResourceProvisioningRecipe - The resource lifecycle will be managed by Radius +// ResourceProvisioningRecipe - The resource lifecycle will be managed by Radius ResourceProvisioningRecipe ResourceProvisioning = "recipe" ) diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_interfaces.go b/pkg/daprrp/api/v20231001preview/zz_generated_interfaces.go index ff4b623cae..dd034e311a 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_interfaces.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_interfaces.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_models.go b/pkg/daprrp/api/v20231001preview/zz_generated_models.go index e6c350c4a7..c4b400ff08 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_models.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_models.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -12,395 +9,395 @@ import "time" // AzureResourceManagerCommonTypesTrackedResourceUpdate - The resource model definition for an Azure Resource Manager tracked // top level resource which has 'tags' and a 'location' type AzureResourceManagerCommonTypesTrackedResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // DaprConfigurationStoreProperties - Dapr configuration store portable resource properties type DaprConfigurationStoreProperties struct { - // REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to +// REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to Environment *string - // Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) +// Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) Application *string - // The name of the Dapr component to be used as a secret store +// The name of the Dapr component to be used as a secret store Auth *DaprResourceAuth - // The metadata for Dapr resource which must match the values specified in Dapr component spec +// The metadata for Dapr resource which must match the values specified in Dapr component spec Metadata map[string]*MetadataValue - // The recipe used to automatically deploy underlying infrastructure for the resource +// The recipe used to automatically deploy underlying infrastructure for the resource Recipe *Recipe - // Specifies how the underlying service/resource is provisioned and managed. +// Specifies how the underlying service/resource is provisioned and managed. ResourceProvisioning *ResourceProvisioning - // A collection of references to resources associated with the configuration store +// A collection of references to resources associated with the configuration store Resources []*ResourceReference - // Dapr component type which must matches the format used by Dapr Kubernetes configuration format +// Dapr component type which must matches the format used by Dapr Kubernetes configuration format Type *string - // Dapr component version +// Dapr component version Version *string - // READ-ONLY; The name of the Dapr component object. Use this value in your code when interacting with the Dapr client to +// READ-ONLY; The name of the Dapr component object. Use this value in your code when interacting with the Dapr client to // use the Dapr component. ComponentName *string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } // DaprConfigurationStoreResource - Dapr configuration store portable resource type DaprConfigurationStoreResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *DaprConfigurationStoreProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // DaprConfigurationStoreResourceListResult - The response of a DaprConfigurationStoreResource list operation. type DaprConfigurationStoreResourceListResult struct { - // REQUIRED; The DaprConfigurationStoreResource items on this page +// REQUIRED; The DaprConfigurationStoreResource items on this page Value []*DaprConfigurationStoreResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // DaprConfigurationStoreResourceUpdate - Dapr configuration store portable resource type DaprConfigurationStoreResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // DaprPubSubBrokerProperties - Dapr PubSubBroker portable resource properties type DaprPubSubBrokerProperties struct { - // REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to +// REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to Environment *string - // Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) +// Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) Application *string - // The name of the Dapr component to be used as a secret store +// The name of the Dapr component to be used as a secret store Auth *DaprResourceAuth - // The metadata for Dapr resource which must match the values specified in Dapr component spec +// The metadata for Dapr resource which must match the values specified in Dapr component spec Metadata map[string]*MetadataValue - // The recipe used to automatically deploy underlying infrastructure for the resource +// The recipe used to automatically deploy underlying infrastructure for the resource Recipe *Recipe - // Specifies how the underlying service/resource is provisioned and managed. +// Specifies how the underlying service/resource is provisioned and managed. ResourceProvisioning *ResourceProvisioning - // A collection of references to resources associated with the pubSubBroker +// A collection of references to resources associated with the pubSubBroker Resources []*ResourceReference - // Dapr component type which must matches the format used by Dapr Kubernetes configuration format +// Dapr component type which must matches the format used by Dapr Kubernetes configuration format Type *string - // Dapr component version +// Dapr component version Version *string - // READ-ONLY; The name of the Dapr component object. Use this value in your code when interacting with the Dapr client to +// READ-ONLY; The name of the Dapr component object. Use this value in your code when interacting with the Dapr client to // use the Dapr component. ComponentName *string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } // DaprPubSubBrokerResource - Dapr PubSubBroker portable resource type DaprPubSubBrokerResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *DaprPubSubBrokerProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // DaprPubSubBrokerResourceListResult - The response of a DaprPubSubBrokerResource list operation. type DaprPubSubBrokerResourceListResult struct { - // REQUIRED; The DaprPubSubBrokerResource items on this page +// REQUIRED; The DaprPubSubBrokerResource items on this page Value []*DaprPubSubBrokerResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // DaprPubSubBrokerResourceUpdate - Dapr PubSubBroker portable resource type DaprPubSubBrokerResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // DaprResourceAuth - Authentication properties for a Dapr component object type DaprResourceAuth struct { - // Secret store to fetch secrets from +// Secret store to fetch secrets from SecretStore *string } // DaprSecretStoreProperties - Dapr SecretStore portable resource properties type DaprSecretStoreProperties struct { - // REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to +// REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to Environment *string - // Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) +// Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) Application *string - // The metadata for Dapr resource which must match the values specified in Dapr component spec +// The metadata for Dapr resource which must match the values specified in Dapr component spec Metadata map[string]*MetadataValue - // The recipe used to automatically deploy underlying infrastructure for the resource +// The recipe used to automatically deploy underlying infrastructure for the resource Recipe *Recipe - // Specifies how the underlying service/resource is provisioned and managed. +// Specifies how the underlying service/resource is provisioned and managed. ResourceProvisioning *ResourceProvisioning - // Dapr component type which must matches the format used by Dapr Kubernetes configuration format +// Dapr component type which must matches the format used by Dapr Kubernetes configuration format Type *string - // Dapr component version +// Dapr component version Version *string - // READ-ONLY; The name of the Dapr component object. Use this value in your code when interacting with the Dapr client to +// READ-ONLY; The name of the Dapr component object. Use this value in your code when interacting with the Dapr client to // use the Dapr component. ComponentName *string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } // DaprSecretStoreResource - Dapr SecretStore portable resource type DaprSecretStoreResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *DaprSecretStoreProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // DaprSecretStoreResourceListResult - The response of a DaprSecretStoreResource list operation. type DaprSecretStoreResourceListResult struct { - // REQUIRED; The DaprSecretStoreResource items on this page +// REQUIRED; The DaprSecretStoreResource items on this page Value []*DaprSecretStoreResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // DaprSecretStoreResourceUpdate - Dapr SecretStore portable resource type DaprSecretStoreResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // DaprStateStoreProperties - Dapr StateStore portable resource properties type DaprStateStoreProperties struct { - // REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to +// REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to Environment *string - // Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) +// Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) Application *string - // The name of the Dapr component to be used as a secret store +// The name of the Dapr component to be used as a secret store Auth *DaprResourceAuth - // The metadata for Dapr resource which must match the values specified in Dapr component spec +// The metadata for Dapr resource which must match the values specified in Dapr component spec Metadata map[string]*MetadataValue - // The recipe used to automatically deploy underlying infrastructure for the resource +// The recipe used to automatically deploy underlying infrastructure for the resource Recipe *Recipe - // Specifies how the underlying service/resource is provisioned and managed. +// Specifies how the underlying service/resource is provisioned and managed. ResourceProvisioning *ResourceProvisioning - // A collection of references to resources associated with the state store +// A collection of references to resources associated with the state store Resources []*ResourceReference - // Dapr component type which must matches the format used by Dapr Kubernetes configuration format +// Dapr component type which must matches the format used by Dapr Kubernetes configuration format Type *string - // Dapr component version +// Dapr component version Version *string - // READ-ONLY; The name of the Dapr component object. Use this value in your code when interacting with the Dapr client to +// READ-ONLY; The name of the Dapr component object. Use this value in your code when interacting with the Dapr client to // use the Dapr component. ComponentName *string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } // DaprStateStoreResource - Dapr StateStore portable resource type DaprStateStoreResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *DaprStateStoreProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // DaprStateStoreResourceListResult - The response of a DaprStateStoreResource list operation. type DaprStateStoreResourceListResult struct { - // REQUIRED; The DaprStateStoreResource items on this page +// REQUIRED; The DaprStateStoreResource items on this page Value []*DaprStateStoreResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // DaprStateStoreResourceUpdate - Dapr StateStore portable resource type DaprStateStoreResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // EnvironmentCompute - Represents backing compute resource type EnvironmentCompute struct { - // REQUIRED; Discriminator property for EnvironmentCompute. +// REQUIRED; Discriminator property for EnvironmentCompute. Kind *string - // Configuration for supported external identity providers +// Configuration for supported external identity providers Identity *IdentitySettings - // The resource id of the compute resource for application environment. +// The resource id of the compute resource for application environment. ResourceID *string } @@ -409,62 +406,62 @@ func (e *EnvironmentCompute) GetEnvironmentCompute() *EnvironmentCompute { retur // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. +// READ-ONLY; The additional info. Info map[string]any - // READ-ONLY; The additional info type. +// READ-ONLY; The additional info type. Type *string } // ErrorDetail - The error detail. type ErrorDetail struct { - // READ-ONLY; The error additional info. +// READ-ONLY; The error additional info. AdditionalInfo []*ErrorAdditionalInfo - // READ-ONLY; The error code. +// READ-ONLY; The error code. Code *string - // READ-ONLY; The error details. +// READ-ONLY; The error details. Details []*ErrorDetail - // READ-ONLY; The error message. +// READ-ONLY; The error message. Message *string - // READ-ONLY; The error target. +// READ-ONLY; The error target. Target *string } // ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. // (This also follows the OData error response format.). type ErrorResponse struct { - // The error object. +// The error object. Error *ErrorDetail } // IdentitySettings is the external identity setting. type IdentitySettings struct { - // REQUIRED; kind of identity setting +// REQUIRED; kind of identity setting Kind *IdentitySettingKind - // The URI for your compute platform's OIDC issuer +// The URI for your compute platform's OIDC issuer OidcIssuer *string - // The resource ID of the provisioned identity +// The resource ID of the provisioned identity Resource *string } // KubernetesCompute - The Kubernetes compute configuration type KubernetesCompute struct { - // REQUIRED; Discriminator property for EnvironmentCompute. +// REQUIRED; Discriminator property for EnvironmentCompute. Kind *string - // REQUIRED; The namespace to use for the environment. +// REQUIRED; The namespace to use for the environment. Namespace *string - // Configuration for supported external identity providers +// Configuration for supported external identity providers Identity *IdentitySettings - // The resource id of the compute resource for application environment. +// The resource id of the compute resource for application environment. ResourceID *string } @@ -479,73 +476,73 @@ func (k *KubernetesCompute) GetEnvironmentCompute() *EnvironmentCompute { // MetadataValue - A single metadata for a Dapr component object type MetadataValue struct { - // A reference of a value in a secret store component +// A reference of a value in a secret store component SecretKeyRef *MetadataValueFromSecret - // The plain text value of the metadata +// The plain text value of the metadata Value *string } // MetadataValueFromSecret - A reference of a value in a secret store component. type MetadataValueFromSecret struct { - // REQUIRED; The field to select in the secret value. If the secret value is a string, it should be equal to the secret name +// REQUIRED; The field to select in the secret value. If the secret value is a string, it should be equal to the secret name Key *string - // REQUIRED; Secret name in the secret store component +// REQUIRED; Secret name in the secret store component Name *string } // NonRedundantDaprResourceProperties - The base properties of a Dapr component object. type NonRedundantDaprResourceProperties struct { - // The metadata for Dapr resource which must match the values specified in Dapr component spec +// The metadata for Dapr resource which must match the values specified in Dapr component spec Metadata map[string]*MetadataValue - // Dapr component type which must matches the format used by Dapr Kubernetes configuration format +// Dapr component type which must matches the format used by Dapr Kubernetes configuration format Type *string - // Dapr component version +// Dapr component version Version *string - // READ-ONLY; The name of the Dapr component object. Use this value in your code when interacting with the Dapr client to +// READ-ONLY; The name of the Dapr component object. Use this value in your code when interacting with the Dapr client to // use the Dapr component. ComponentName *string } // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // Localized display information for this particular operation. +// Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +// READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane +// READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane // operations. IsDataAction *bool - // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", +// READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", // "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 +// READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default // value is "user,system" Origin *Origin } // OperationDisplay - Localized display information for this particular operation. type OperationDisplay struct { - // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. +// READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual +// READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual // Machine", "Restart Virtual Machine". Operation *string - // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft +// READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft // Compute". Provider *string - // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job +// READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job // Schedule Collections". Resource *string } @@ -553,121 +550,121 @@ type OperationDisplay struct { // OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to // get the next set of results. type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). +// READ-ONLY; URL to get the next set of operation list results (if there are any). NextLink *string - // READ-ONLY; List of operations supported by the resource provider +// READ-ONLY; List of operations supported by the resource provider Value []*Operation } // OutputResource - Properties of an output resource. type OutputResource struct { - // The UCP resource ID of the underlying resource. +// The UCP resource ID of the underlying resource. ID *string - // The logical identifier scoped to the owning Radius resource. This is only needed or used when a resource has a dependency +// The logical identifier scoped to the owning Radius resource. This is only needed or used when a resource has a dependency // relationship. LocalIDs do not have any particular format or meaning beyond // being compared to determine dependency relationships. LocalID *string - // Determines whether Radius manages the lifecycle of the underlying resource. +// Determines whether Radius manages the lifecycle of the underlying resource. RadiusManaged *bool } // Recipe - The recipe used to automatically deploy underlying infrastructure for a portable resource type Recipe struct { - // REQUIRED; The name of the recipe within the environment to use +// REQUIRED; The name of the recipe within the environment to use Name *string - // Key/value parameters to pass into the recipe at deployment +// Key/value parameters to pass into the recipe at deployment Parameters map[string]any } // RecipeStatus - Recipe status at deployment time for a resource. type RecipeStatus struct { - // REQUIRED; TemplateKind is the kind of the recipe template used by the portable resource upon deployment. +// REQUIRED; TemplateKind is the kind of the recipe template used by the portable resource upon deployment. TemplateKind *string - // REQUIRED; TemplatePath is the path of the recipe consumed by the portable resource upon deployment. +// REQUIRED; TemplatePath is the path of the recipe consumed by the portable resource upon deployment. TemplatePath *string - // TemplateVersion is the version number of the template. +// TemplateVersion is the version number of the template. TemplateVersion *string } // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ResourceReference - Describes a reference to an existing resource type ResourceReference struct { - // REQUIRED; Resource id of an existing resource +// REQUIRED; Resource id of an existing resource ID *string } // ResourceStatus - Status of a resource. type ResourceStatus struct { - // The compute resource associated with the resource. +// The compute resource associated with the resource. Compute EnvironmentComputeClassification - // Properties of an output resource +// Properties of an output resource OutputResources []*OutputResource - // READ-ONLY; The recipe data at the time of deployment +// READ-ONLY; The recipe data at the time of deployment Recipe *RecipeStatus } // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { - // The timestamp of resource creation (UTC). +// The timestamp of resource creation (UTC). CreatedAt *time.Time - // The identity that created the resource. +// The identity that created the resource. CreatedBy *string - // The type of identity that created the resource. +// The type of identity that created the resource. CreatedByType *CreatedByType - // The timestamp of resource last modification (UTC) +// The timestamp of resource last modification (UTC) LastModifiedAt *time.Time - // The identity that last modified the resource. +// The identity that last modified the resource. LastModifiedBy *string - // The type of identity that last modified the resource. +// The type of identity that last modified the resource. LastModifiedByType *CreatedByType } // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_models_serde.go b/pkg/daprrp/api/v20231001preview/zz_generated_models_serde.go index 2db8519854..72a246e0dc 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_models_serde.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_models_serde.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -1489,10 +1486,10 @@ func (r *ResourceStatus) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -1508,7 +1505,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) @@ -1517,7 +1514,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) @@ -1591,7 +1588,7 @@ func populate(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_operations_client.go b/pkg/daprrp/api/v20231001preview/zz_generated_operations_client.go index 1d06869df2..0ce5f3a4e0 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_operations_client.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_operations_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -26,7 +23,7 @@ type OperationsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -46,30 +43,25 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return OperationsClientListResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return OperationsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Applications.Dapr/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_options.go b/pkg/daprrp/api/v20231001preview/zz_generated_options.go index e13a012369..768444955c 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_options.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_options.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -10,21 +7,21 @@ package v20231001preview // ConfigurationStoresClientBeginCreateOrUpdateOptions contains the optional parameters for the ConfigurationStoresClient.BeginCreateOrUpdate // method. type ConfigurationStoresClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // ConfigurationStoresClientBeginDeleteOptions contains the optional parameters for the ConfigurationStoresClient.BeginDelete // method. type ConfigurationStoresClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // ConfigurationStoresClientBeginUpdateOptions contains the optional parameters for the ConfigurationStoresClient.BeginUpdate // method. type ConfigurationStoresClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -47,19 +44,19 @@ type OperationsClientListOptions struct { // PubSubBrokersClientBeginCreateOrUpdateOptions contains the optional parameters for the PubSubBrokersClient.BeginCreateOrUpdate // method. type PubSubBrokersClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // PubSubBrokersClientBeginDeleteOptions contains the optional parameters for the PubSubBrokersClient.BeginDelete method. type PubSubBrokersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // PubSubBrokersClientBeginUpdateOptions contains the optional parameters for the PubSubBrokersClient.BeginUpdate method. type PubSubBrokersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -77,19 +74,19 @@ type PubSubBrokersClientListByScopeOptions struct { // SecretStoresClientBeginCreateOrUpdateOptions contains the optional parameters for the SecretStoresClient.BeginCreateOrUpdate // method. type SecretStoresClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // SecretStoresClientBeginDeleteOptions contains the optional parameters for the SecretStoresClient.BeginDelete method. type SecretStoresClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // SecretStoresClientBeginUpdateOptions contains the optional parameters for the SecretStoresClient.BeginUpdate method. type SecretStoresClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -106,19 +103,19 @@ type SecretStoresClientListByScopeOptions struct { // StateStoresClientBeginCreateOrUpdateOptions contains the optional parameters for the StateStoresClient.BeginCreateOrUpdate // method. type StateStoresClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // StateStoresClientBeginDeleteOptions contains the optional parameters for the StateStoresClient.BeginDelete method. type StateStoresClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // StateStoresClientBeginUpdateOptions contains the optional parameters for the StateStoresClient.BeginUpdate method. type StateStoresClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_polymorphic_helpers.go b/pkg/daprrp/api/v20231001preview/zz_generated_polymorphic_helpers.go index c574dd5eea..7b008f3d80 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_polymorphic_helpers.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_polymorphic_helpers.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -10,7 +7,7 @@ package v20231001preview import "encoding/json" func unmarshalEnvironmentComputeClassification(rawMsg json.RawMessage) (EnvironmentComputeClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_pubsubbrokers_client.go b/pkg/daprrp/api/v20231001preview/zz_generated_pubsubbrokers_client.go index 89946c0f4b..2b1b479622 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_pubsubbrokers_client.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_pubsubbrokers_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type PubSubBrokersClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPubSubBrokersClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PubSubBrokersClient, error) { - cl, err := arm.NewClient(moduleName+".PubSubBrokersClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -60,10 +57,13 @@ func (client *PubSubBrokersClient) BeginCreateOrUpdate(ctx context.Context, pubS } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PubSubBrokersClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[PubSubBrokersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PubSubBrokersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -73,6 +73,10 @@ func (client *PubSubBrokersClient) BeginCreateOrUpdate(ctx context.Context, pubS // Generated from API version 2023-10-01-preview func (client *PubSubBrokersClient) createOrUpdate(ctx context.Context, pubSubBrokerName string, resource DaprPubSubBrokerResource, options *PubSubBrokersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "PubSubBrokersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, pubSubBrokerName, resource, options) if err != nil { return nil, err @@ -89,7 +93,7 @@ func (client *PubSubBrokersClient) createOrUpdate(ctx context.Context, pubSubBro } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PubSubBrokersClient) createOrUpdateCreateRequest(ctx context.Context, pubSubBrokerName string, resource DaprPubSubBrokerResource, options *PubSubBrokersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *PubSubBrokersClient) createOrUpdateCreateRequest(ctx context.Context, pubSubBrokerName string, resource DaprPubSubBrokerResource, _ *PubSubBrokersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/pubSubBrokers/{pubSubBrokerName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if pubSubBrokerName == "" { @@ -107,7 +111,7 @@ func (client *PubSubBrokersClient) createOrUpdateCreateRequest(ctx context.Conte if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a DaprPubSubBrokerResource @@ -125,10 +129,13 @@ func (client *PubSubBrokersClient) BeginDelete(ctx context.Context, pubSubBroker } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PubSubBrokersClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[PubSubBrokersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PubSubBrokersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -138,6 +145,10 @@ func (client *PubSubBrokersClient) BeginDelete(ctx context.Context, pubSubBroker // Generated from API version 2023-10-01-preview func (client *PubSubBrokersClient) deleteOperation(ctx context.Context, pubSubBrokerName string, options *PubSubBrokersClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "PubSubBrokersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, pubSubBrokerName, options) if err != nil { return nil, err @@ -154,7 +165,7 @@ func (client *PubSubBrokersClient) deleteOperation(ctx context.Context, pubSubBr } // deleteCreateRequest creates the Delete request. -func (client *PubSubBrokersClient) deleteCreateRequest(ctx context.Context, pubSubBrokerName string, options *PubSubBrokersClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PubSubBrokersClient) deleteCreateRequest(ctx context.Context, pubSubBrokerName string, _ *PubSubBrokersClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/pubSubBrokers/{pubSubBrokerName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if pubSubBrokerName == "" { @@ -180,6 +191,10 @@ func (client *PubSubBrokersClient) deleteCreateRequest(ctx context.Context, pubS // - options - PubSubBrokersClientGetOptions contains the optional parameters for the PubSubBrokersClient.Get method. func (client *PubSubBrokersClient) Get(ctx context.Context, pubSubBrokerName string, options *PubSubBrokersClientGetOptions) (PubSubBrokersClientGetResponse, error) { var err error + const operationName = "PubSubBrokersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, pubSubBrokerName, options) if err != nil { return PubSubBrokersClientGetResponse{}, err @@ -197,7 +212,7 @@ func (client *PubSubBrokersClient) Get(ctx context.Context, pubSubBrokerName str } // getCreateRequest creates the Get request. -func (client *PubSubBrokersClient) getCreateRequest(ctx context.Context, pubSubBrokerName string, options *PubSubBrokersClientGetOptions) (*policy.Request, error) { +func (client *PubSubBrokersClient) getCreateRequest(ctx context.Context, pubSubBrokerName string, _ *PubSubBrokersClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/pubSubBrokers/{pubSubBrokerName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if pubSubBrokerName == "" { @@ -235,30 +250,25 @@ func (client *PubSubBrokersClient) NewListByScopePager(options *PubSubBrokersCli return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PubSubBrokersClientListByScopeResponse) (PubSubBrokersClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PubSubBrokersClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return PubSubBrokersClientListByScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PubSubBrokersClientListByScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PubSubBrokersClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *PubSubBrokersClient) listByScopeCreateRequest(ctx context.Context, options *PubSubBrokersClientListByScopeOptions) (*policy.Request, error) { +func (client *PubSubBrokersClient) listByScopeCreateRequest(ctx context.Context, _ *PubSubBrokersClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/pubSubBrokers" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -297,10 +307,13 @@ func (client *PubSubBrokersClient) BeginUpdate(ctx context.Context, pubSubBroker } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PubSubBrokersClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[PubSubBrokersClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PubSubBrokersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -310,6 +323,10 @@ func (client *PubSubBrokersClient) BeginUpdate(ctx context.Context, pubSubBroker // Generated from API version 2023-10-01-preview func (client *PubSubBrokersClient) update(ctx context.Context, pubSubBrokerName string, properties DaprPubSubBrokerResourceUpdate, options *PubSubBrokersClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "PubSubBrokersClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, pubSubBrokerName, properties, options) if err != nil { return nil, err @@ -326,7 +343,7 @@ func (client *PubSubBrokersClient) update(ctx context.Context, pubSubBrokerName } // updateCreateRequest creates the Update request. -func (client *PubSubBrokersClient) updateCreateRequest(ctx context.Context, pubSubBrokerName string, properties DaprPubSubBrokerResourceUpdate, options *PubSubBrokersClientBeginUpdateOptions) (*policy.Request, error) { +func (client *PubSubBrokersClient) updateCreateRequest(ctx context.Context, pubSubBrokerName string, properties DaprPubSubBrokerResourceUpdate, _ *PubSubBrokersClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/pubSubBrokers/{pubSubBrokerName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if pubSubBrokerName == "" { @@ -344,6 +361,6 @@ func (client *PubSubBrokersClient) updateCreateRequest(ctx context.Context, pubS if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_response_types.go b/pkg/daprrp/api/v20231001preview/zz_generated_responses.go similarity index 82% rename from pkg/daprrp/api/v20231001preview/zz_generated_response_types.go rename to pkg/daprrp/api/v20231001preview/zz_generated_responses.go index 7f6a637d06..f005a866ca 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_response_types.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_responses.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -9,7 +6,7 @@ package v20231001preview // ConfigurationStoresClientCreateOrUpdateResponse contains the response from method ConfigurationStoresClient.BeginCreateOrUpdate. type ConfigurationStoresClientCreateOrUpdateResponse struct { - // Dapr configuration store portable resource +// Dapr configuration store portable resource DaprConfigurationStoreResource } @@ -20,31 +17,31 @@ type ConfigurationStoresClientDeleteResponse struct { // ConfigurationStoresClientGetResponse contains the response from method ConfigurationStoresClient.Get. type ConfigurationStoresClientGetResponse struct { - // Dapr configuration store portable resource +// Dapr configuration store portable resource DaprConfigurationStoreResource } // ConfigurationStoresClientListByScopeResponse contains the response from method ConfigurationStoresClient.NewListByScopePager. type ConfigurationStoresClientListByScopeResponse struct { - // The response of a DaprConfigurationStoreResource list operation. +// The response of a DaprConfigurationStoreResource list operation. DaprConfigurationStoreResourceListResult } // ConfigurationStoresClientUpdateResponse contains the response from method ConfigurationStoresClient.BeginUpdate. type ConfigurationStoresClientUpdateResponse struct { - // Dapr configuration store portable resource +// Dapr configuration store portable resource DaprConfigurationStoreResource } // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. 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. +// 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 } // PubSubBrokersClientCreateOrUpdateResponse contains the response from method PubSubBrokersClient.BeginCreateOrUpdate. type PubSubBrokersClientCreateOrUpdateResponse struct { - // Dapr PubSubBroker portable resource +// Dapr PubSubBroker portable resource DaprPubSubBrokerResource } @@ -55,25 +52,25 @@ type PubSubBrokersClientDeleteResponse struct { // PubSubBrokersClientGetResponse contains the response from method PubSubBrokersClient.Get. type PubSubBrokersClientGetResponse struct { - // Dapr PubSubBroker portable resource +// Dapr PubSubBroker portable resource DaprPubSubBrokerResource } // PubSubBrokersClientListByScopeResponse contains the response from method PubSubBrokersClient.NewListByScopePager. type PubSubBrokersClientListByScopeResponse struct { - // The response of a DaprPubSubBrokerResource list operation. +// The response of a DaprPubSubBrokerResource list operation. DaprPubSubBrokerResourceListResult } // PubSubBrokersClientUpdateResponse contains the response from method PubSubBrokersClient.BeginUpdate. type PubSubBrokersClientUpdateResponse struct { - // Dapr PubSubBroker portable resource +// Dapr PubSubBroker portable resource DaprPubSubBrokerResource } // SecretStoresClientCreateOrUpdateResponse contains the response from method SecretStoresClient.BeginCreateOrUpdate. type SecretStoresClientCreateOrUpdateResponse struct { - // Dapr SecretStore portable resource +// Dapr SecretStore portable resource DaprSecretStoreResource } @@ -84,25 +81,25 @@ type SecretStoresClientDeleteResponse struct { // SecretStoresClientGetResponse contains the response from method SecretStoresClient.Get. type SecretStoresClientGetResponse struct { - // Dapr SecretStore portable resource +// Dapr SecretStore portable resource DaprSecretStoreResource } // SecretStoresClientListByScopeResponse contains the response from method SecretStoresClient.NewListByScopePager. type SecretStoresClientListByScopeResponse struct { - // The response of a DaprSecretStoreResource list operation. +// The response of a DaprSecretStoreResource list operation. DaprSecretStoreResourceListResult } // SecretStoresClientUpdateResponse contains the response from method SecretStoresClient.BeginUpdate. type SecretStoresClientUpdateResponse struct { - // Dapr SecretStore portable resource +// Dapr SecretStore portable resource DaprSecretStoreResource } // StateStoresClientCreateOrUpdateResponse contains the response from method StateStoresClient.BeginCreateOrUpdate. type StateStoresClientCreateOrUpdateResponse struct { - // Dapr StateStore portable resource +// Dapr StateStore portable resource DaprStateStoreResource } @@ -113,19 +110,19 @@ type StateStoresClientDeleteResponse struct { // StateStoresClientGetResponse contains the response from method StateStoresClient.Get. type StateStoresClientGetResponse struct { - // Dapr StateStore portable resource +// Dapr StateStore portable resource DaprStateStoreResource } // StateStoresClientListByScopeResponse contains the response from method StateStoresClient.NewListByScopePager. type StateStoresClientListByScopeResponse struct { - // The response of a DaprStateStoreResource list operation. +// The response of a DaprStateStoreResource list operation. DaprStateStoreResourceListResult } // StateStoresClientUpdateResponse contains the response from method StateStoresClient.BeginUpdate. type StateStoresClientUpdateResponse struct { - // Dapr StateStore portable resource +// Dapr StateStore portable resource DaprStateStoreResource } diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_secretstores_client.go b/pkg/daprrp/api/v20231001preview/zz_generated_secretstores_client.go index c25f5df8af..01d7b4a40a 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_secretstores_client.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_secretstores_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type SecretStoresClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewSecretStoresClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecretStoresClient, error) { - cl, err := arm.NewClient(moduleName+".SecretStoresClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -60,10 +57,13 @@ func (client *SecretStoresClient) BeginCreateOrUpdate(ctx context.Context, secre } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecretStoresClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[SecretStoresClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SecretStoresClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -73,6 +73,10 @@ func (client *SecretStoresClient) BeginCreateOrUpdate(ctx context.Context, secre // Generated from API version 2023-10-01-preview func (client *SecretStoresClient) createOrUpdate(ctx context.Context, secretStoreName string, resource DaprSecretStoreResource, options *SecretStoresClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "SecretStoresClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, secretStoreName, resource, options) if err != nil { return nil, err @@ -89,7 +93,7 @@ func (client *SecretStoresClient) createOrUpdate(ctx context.Context, secretStor } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *SecretStoresClient) createOrUpdateCreateRequest(ctx context.Context, secretStoreName string, resource DaprSecretStoreResource, options *SecretStoresClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *SecretStoresClient) createOrUpdateCreateRequest(ctx context.Context, secretStoreName string, resource DaprSecretStoreResource, _ *SecretStoresClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/secretStores/{secretStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if secretStoreName == "" { @@ -107,7 +111,7 @@ func (client *SecretStoresClient) createOrUpdateCreateRequest(ctx context.Contex if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a DaprSecretStoreResource @@ -125,10 +129,13 @@ func (client *SecretStoresClient) BeginDelete(ctx context.Context, secretStoreNa } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecretStoresClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[SecretStoresClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SecretStoresClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -138,6 +145,10 @@ func (client *SecretStoresClient) BeginDelete(ctx context.Context, secretStoreNa // Generated from API version 2023-10-01-preview func (client *SecretStoresClient) deleteOperation(ctx context.Context, secretStoreName string, options *SecretStoresClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "SecretStoresClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, secretStoreName, options) if err != nil { return nil, err @@ -154,7 +165,7 @@ func (client *SecretStoresClient) deleteOperation(ctx context.Context, secretSto } // deleteCreateRequest creates the Delete request. -func (client *SecretStoresClient) deleteCreateRequest(ctx context.Context, secretStoreName string, options *SecretStoresClientBeginDeleteOptions) (*policy.Request, error) { +func (client *SecretStoresClient) deleteCreateRequest(ctx context.Context, secretStoreName string, _ *SecretStoresClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/secretStores/{secretStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if secretStoreName == "" { @@ -180,6 +191,10 @@ func (client *SecretStoresClient) deleteCreateRequest(ctx context.Context, secre // - options - SecretStoresClientGetOptions contains the optional parameters for the SecretStoresClient.Get method. func (client *SecretStoresClient) Get(ctx context.Context, secretStoreName string, options *SecretStoresClientGetOptions) (SecretStoresClientGetResponse, error) { var err error + const operationName = "SecretStoresClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, secretStoreName, options) if err != nil { return SecretStoresClientGetResponse{}, err @@ -197,7 +212,7 @@ func (client *SecretStoresClient) Get(ctx context.Context, secretStoreName strin } // getCreateRequest creates the Get request. -func (client *SecretStoresClient) getCreateRequest(ctx context.Context, secretStoreName string, options *SecretStoresClientGetOptions) (*policy.Request, error) { +func (client *SecretStoresClient) getCreateRequest(ctx context.Context, secretStoreName string, _ *SecretStoresClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/secretStores/{secretStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if secretStoreName == "" { @@ -235,30 +250,25 @@ func (client *SecretStoresClient) NewListByScopePager(options *SecretStoresClien return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *SecretStoresClientListByScopeResponse) (SecretStoresClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SecretStoresClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return SecretStoresClientListByScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SecretStoresClientListByScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return SecretStoresClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *SecretStoresClient) listByScopeCreateRequest(ctx context.Context, options *SecretStoresClientListByScopeOptions) (*policy.Request, error) { +func (client *SecretStoresClient) listByScopeCreateRequest(ctx context.Context, _ *SecretStoresClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/secretStores" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -297,10 +307,13 @@ func (client *SecretStoresClient) BeginUpdate(ctx context.Context, secretStoreNa } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SecretStoresClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[SecretStoresClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SecretStoresClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -310,6 +323,10 @@ func (client *SecretStoresClient) BeginUpdate(ctx context.Context, secretStoreNa // Generated from API version 2023-10-01-preview func (client *SecretStoresClient) update(ctx context.Context, secretStoreName string, properties DaprSecretStoreResourceUpdate, options *SecretStoresClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "SecretStoresClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, secretStoreName, properties, options) if err != nil { return nil, err @@ -326,7 +343,7 @@ func (client *SecretStoresClient) update(ctx context.Context, secretStoreName st } // updateCreateRequest creates the Update request. -func (client *SecretStoresClient) updateCreateRequest(ctx context.Context, secretStoreName string, properties DaprSecretStoreResourceUpdate, options *SecretStoresClientBeginUpdateOptions) (*policy.Request, error) { +func (client *SecretStoresClient) updateCreateRequest(ctx context.Context, secretStoreName string, properties DaprSecretStoreResourceUpdate, _ *SecretStoresClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/secretStores/{secretStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if secretStoreName == "" { @@ -344,6 +361,6 @@ func (client *SecretStoresClient) updateCreateRequest(ctx context.Context, secre if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_statestores_client.go b/pkg/daprrp/api/v20231001preview/zz_generated_statestores_client.go index b456bdc177..9dbd33457c 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_statestores_client.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_statestores_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type StateStoresClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewStateStoresClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StateStoresClient, error) { - cl, err := arm.NewClient(moduleName+".StateStoresClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -60,10 +57,13 @@ func (client *StateStoresClient) BeginCreateOrUpdate(ctx context.Context, stateS } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[StateStoresClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[StateStoresClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[StateStoresClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -73,6 +73,10 @@ func (client *StateStoresClient) BeginCreateOrUpdate(ctx context.Context, stateS // Generated from API version 2023-10-01-preview func (client *StateStoresClient) createOrUpdate(ctx context.Context, stateStoreName string, resource DaprStateStoreResource, options *StateStoresClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "StateStoresClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, stateStoreName, resource, options) if err != nil { return nil, err @@ -89,7 +93,7 @@ func (client *StateStoresClient) createOrUpdate(ctx context.Context, stateStoreN } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *StateStoresClient) createOrUpdateCreateRequest(ctx context.Context, stateStoreName string, resource DaprStateStoreResource, options *StateStoresClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *StateStoresClient) createOrUpdateCreateRequest(ctx context.Context, stateStoreName string, resource DaprStateStoreResource, _ *StateStoresClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/stateStores/{stateStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if stateStoreName == "" { @@ -107,7 +111,7 @@ func (client *StateStoresClient) createOrUpdateCreateRequest(ctx context.Context if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a DaprStateStoreResource @@ -124,10 +128,13 @@ func (client *StateStoresClient) BeginDelete(ctx context.Context, stateStoreName } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[StateStoresClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[StateStoresClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[StateStoresClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -137,6 +144,10 @@ func (client *StateStoresClient) BeginDelete(ctx context.Context, stateStoreName // Generated from API version 2023-10-01-preview func (client *StateStoresClient) deleteOperation(ctx context.Context, stateStoreName string, options *StateStoresClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "StateStoresClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, stateStoreName, options) if err != nil { return nil, err @@ -153,7 +164,7 @@ func (client *StateStoresClient) deleteOperation(ctx context.Context, stateStore } // deleteCreateRequest creates the Delete request. -func (client *StateStoresClient) deleteCreateRequest(ctx context.Context, stateStoreName string, options *StateStoresClientBeginDeleteOptions) (*policy.Request, error) { +func (client *StateStoresClient) deleteCreateRequest(ctx context.Context, stateStoreName string, _ *StateStoresClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/stateStores/{stateStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if stateStoreName == "" { @@ -179,6 +190,10 @@ func (client *StateStoresClient) deleteCreateRequest(ctx context.Context, stateS // - options - StateStoresClientGetOptions contains the optional parameters for the StateStoresClient.Get method. func (client *StateStoresClient) Get(ctx context.Context, stateStoreName string, options *StateStoresClientGetOptions) (StateStoresClientGetResponse, error) { var err error + const operationName = "StateStoresClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, stateStoreName, options) if err != nil { return StateStoresClientGetResponse{}, err @@ -196,7 +211,7 @@ func (client *StateStoresClient) Get(ctx context.Context, stateStoreName string, } // getCreateRequest creates the Get request. -func (client *StateStoresClient) getCreateRequest(ctx context.Context, stateStoreName string, options *StateStoresClientGetOptions) (*policy.Request, error) { +func (client *StateStoresClient) getCreateRequest(ctx context.Context, stateStoreName string, _ *StateStoresClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/stateStores/{stateStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if stateStoreName == "" { @@ -234,30 +249,25 @@ func (client *StateStoresClient) NewListByScopePager(options *StateStoresClientL return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *StateStoresClientListByScopeResponse) (StateStoresClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "StateStoresClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return StateStoresClientListByScopeResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return StateStoresClientListByScopeResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return StateStoresClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *StateStoresClient) listByScopeCreateRequest(ctx context.Context, options *StateStoresClientListByScopeOptions) (*policy.Request, error) { +func (client *StateStoresClient) listByScopeCreateRequest(ctx context.Context, _ *StateStoresClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/stateStores" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -295,10 +305,13 @@ func (client *StateStoresClient) BeginUpdate(ctx context.Context, stateStoreName } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[StateStoresClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[StateStoresClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[StateStoresClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -308,6 +321,10 @@ func (client *StateStoresClient) BeginUpdate(ctx context.Context, stateStoreName // Generated from API version 2023-10-01-preview func (client *StateStoresClient) update(ctx context.Context, stateStoreName string, properties DaprStateStoreResourceUpdate, options *StateStoresClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "StateStoresClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, stateStoreName, properties, options) if err != nil { return nil, err @@ -324,7 +341,7 @@ func (client *StateStoresClient) update(ctx context.Context, stateStoreName stri } // updateCreateRequest creates the Update request. -func (client *StateStoresClient) updateCreateRequest(ctx context.Context, stateStoreName string, properties DaprStateStoreResourceUpdate, options *StateStoresClientBeginUpdateOptions) (*policy.Request, error) { +func (client *StateStoresClient) updateCreateRequest(ctx context.Context, stateStoreName string, properties DaprStateStoreResourceUpdate, _ *StateStoresClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Dapr/stateStores/{stateStoreName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if stateStoreName == "" { @@ -342,6 +359,6 @@ func (client *StateStoresClient) updateCreateRequest(ctx context.Context, stateS if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/daprrp/api/v20231001preview/zz_generated_time_rfc3339.go b/pkg/daprrp/api/v20231001preview/zz_generated_time_rfc3339.go index 948a6660cd..bbe5fcce12 100644 --- a/pkg/daprrp/api/v20231001preview/zz_generated_time_rfc3339.go +++ b/pkg/daprrp/api/v20231001preview/zz_generated_time_rfc3339.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -21,51 +18,78 @@ import ( +// 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+)*"*$`) + const ( - utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` - utcLayout = "2006-01-02T15:04:05.999999999" - rfc3339JSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) -// 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+)*"*$`) - -type timeRFC3339 time.Time +type dateTimeRFC3339 time.Time -func (t timeRFC3339) MarshalJSON() (json []byte, err error) { +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { tt := time.Time(t) return tt.MarshalJSON() } -func (t timeRFC3339) MarshalText() (text []byte, err error) { +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { tt := time.Time(t) return tt.MarshalText() } -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcLayoutJSON - if tzOffsetRegex.Match(data) { - layout = rfc3339JSON +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { - layout := utcLayout - if tzOffsetRegex.Match(data) { +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) Parse(layout, value string) error { +func (t *dateTimeRFC3339) Parse(layout, value string) error { p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) + *t = dateTimeRFC3339(p) return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { @@ -74,14 +98,14 @@ func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { } else if reflect.ValueOf(t).IsNil() { return } - m[k] = (*timeRFC3339)(t) + m[k] = (*dateTimeRFC3339)(t) } -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { return nil } - var aux timeRFC3339 + var aux dateTimeRFC3339 if err := json.Unmarshal(data, &aux); err != nil { return fmt.Errorf("struct field %s: %v", fn, err) } diff --git a/pkg/ucp/api/README.md b/pkg/ucp/api/README.md index 7806ab3941..169ee1afa6 100644 --- a/pkg/ucp/api/README.md +++ b/pkg/ucp/api/README.md @@ -45,7 +45,8 @@ The following configuration generates track2 go models and client. ```yaml $(tag) != '' version: 3.*.* -use: "@autorest/go@4.0.0-preview.55" +use: "@autorest/go@4.0.0-preview.69" +module: "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" module-version: 0.0.1 file-prefix: zz_generated_ license-header: "Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information.\nCode generated by Microsoft (R) AutoRest Code Generator.\nChanges may cause incorrect behavior and will be lost if the code is regenerated." diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_apiversions_server.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_apiversions_server.go new file mode 100644 index 0000000000..0050096780 --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_apiversions_server.go @@ -0,0 +1,310 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/ucp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// APIVersionsServer is a fake server for instances of the v20231001preview.APIVersionsClient type. +type APIVersionsServer struct{ + // BeginCreateOrUpdate is the fake for method APIVersionsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, apiVersionName string, resource v20231001preview.APIVersionResource, options *v20231001preview.APIVersionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.APIVersionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method APIVersionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, apiVersionName string, options *v20231001preview.APIVersionsClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.APIVersionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method APIVersionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, apiVersionName string, options *v20231001preview.APIVersionsClientGetOptions) (resp azfake.Responder[v20231001preview.APIVersionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method APIVersionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(planeName string, resourceProviderName string, resourceTypeName string, options *v20231001preview.APIVersionsClientListOptions) (resp azfake.PagerResponder[v20231001preview.APIVersionsClientListResponse]) + +} + +// NewAPIVersionsServerTransport creates a new instance of APIVersionsServerTransport with the provided implementation. +// The returned APIVersionsServerTransport instance is connected to an instance of v20231001preview.APIVersionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAPIVersionsServerTransport(srv *APIVersionsServer) *APIVersionsServerTransport { + return &APIVersionsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.APIVersionsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.APIVersionsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[v20231001preview.APIVersionsClientListResponse]](), + } +} + +// APIVersionsServerTransport connects instances of v20231001preview.APIVersionsClient to instances of APIVersionsServer. +// Don't use this type directly, use NewAPIVersionsServerTransport instead. +type APIVersionsServerTransport struct { + srv *APIVersionsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.APIVersionsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.APIVersionsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[v20231001preview.APIVersionsClientListResponse]] +} + +// Do implements the policy.Transporter interface for APIVersionsServerTransport. +func (a *APIVersionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *APIVersionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if apiVersionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = apiVersionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "APIVersionsClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "APIVersionsClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "APIVersionsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "APIVersionsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *APIVersionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcetypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/apiversions/(?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[v20231001preview.APIVersionResource](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + resourceTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceTypeName")]) + if err != nil { + return nil, err + } + apiVersionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("apiVersionName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), planeNameParam, resourceProviderNameParam, resourceTypeNameParam, apiVersionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + a.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + a.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + a.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (a *APIVersionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcetypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/apiversions/(?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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + resourceTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceTypeName")]) + if err != nil { + return nil, err + } + apiVersionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("apiVersionName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), planeNameParam, resourceProviderNameParam, resourceTypeNameParam, apiVersionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *APIVersionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcetypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/apiversions/(?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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + resourceTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceTypeName")]) + if err != nil { + return nil, err + } + apiVersionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("apiVersionName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), planeNameParam, resourceProviderNameParam, resourceTypeNameParam, apiVersionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).APIVersionResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *APIVersionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := a.newListPager.get(req) + if newListPager == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcetypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/apiversions` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + resourceTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceTypeName")]) + if err != nil { + return nil, err + } +resp := a.srv.NewListPager(planeNameParam, resourceProviderNameParam, resourceTypeNameParam, nil) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.APIVersionsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + a.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to APIVersionsServerTransport +var apiVersionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_awscredentials_server.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_awscredentials_server.go new file mode 100644 index 0000000000..bad6241902 --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_awscredentials_server.go @@ -0,0 +1,295 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/ucp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// AwsCredentialsServer is a fake server for instances of the v20231001preview.AwsCredentialsClient type. +type AwsCredentialsServer struct{ + // CreateOrUpdate is the fake for method AwsCredentialsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, planeName string, credentialName string, resource v20231001preview.AwsCredentialResource, options *v20231001preview.AwsCredentialsClientCreateOrUpdateOptions) (resp azfake.Responder[v20231001preview.AwsCredentialsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method AwsCredentialsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, planeName string, credentialName string, options *v20231001preview.AwsCredentialsClientDeleteOptions) (resp azfake.Responder[v20231001preview.AwsCredentialsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AwsCredentialsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, planeName string, credentialName string, options *v20231001preview.AwsCredentialsClientGetOptions) (resp azfake.Responder[v20231001preview.AwsCredentialsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method AwsCredentialsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(planeName string, options *v20231001preview.AwsCredentialsClientListOptions) (resp azfake.PagerResponder[v20231001preview.AwsCredentialsClientListResponse]) + + // Update is the fake for method AwsCredentialsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, planeName string, credentialName string, properties v20231001preview.AwsCredentialResourceTagsUpdate, options *v20231001preview.AwsCredentialsClientUpdateOptions) (resp azfake.Responder[v20231001preview.AwsCredentialsClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewAwsCredentialsServerTransport creates a new instance of AwsCredentialsServerTransport with the provided implementation. +// The returned AwsCredentialsServerTransport instance is connected to an instance of v20231001preview.AwsCredentialsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAwsCredentialsServerTransport(srv *AwsCredentialsServer) *AwsCredentialsServerTransport { + return &AwsCredentialsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[v20231001preview.AwsCredentialsClientListResponse]](), + } +} + +// AwsCredentialsServerTransport connects instances of v20231001preview.AwsCredentialsClient to instances of AwsCredentialsServer. +// Don't use this type directly, use NewAwsCredentialsServerTransport instead. +type AwsCredentialsServerTransport struct { + srv *AwsCredentialsServer + newListPager *tracker[azfake.PagerResponder[v20231001preview.AwsCredentialsClientListResponse]] +} + +// Do implements the policy.Transporter interface for AwsCredentialsServerTransport. +func (a *AwsCredentialsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *AwsCredentialsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if awsCredentialsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = awsCredentialsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AwsCredentialsClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "AwsCredentialsClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "AwsCredentialsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AwsCredentialsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AwsCredentialsClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *AwsCredentialsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/planes/aws/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.AWS/credentials/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.AwsCredentialResource](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + credentialNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("credentialName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.CreateOrUpdate(req.Context(), planeNameParam, credentialNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AwsCredentialResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AwsCredentialsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if a.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/planes/aws/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.AWS/credentials/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + credentialNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("credentialName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Delete(req.Context(), planeNameParam, credentialNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AwsCredentialsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/planes/aws/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.AWS/credentials/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + credentialNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("credentialName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), planeNameParam, credentialNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AwsCredentialResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AwsCredentialsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := a.newListPager.get(req) + if newListPager == nil { + const regexStr = `/planes/aws/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.AWS/credentials` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } +resp := a.srv.NewListPager(planeNameParam, nil) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.AwsCredentialsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + a.newListPager.remove(req) + } + return resp, nil +} + +func (a *AwsCredentialsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if a.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/planes/aws/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.AWS/credentials/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.AwsCredentialResourceTagsUpdate](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + credentialNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("credentialName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Update(req.Context(), planeNameParam, credentialNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AwsCredentialResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to AwsCredentialsServerTransport +var awsCredentialsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_awsplanes_server.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_awsplanes_server.go new file mode 100644 index 0000000000..ccb43ad22e --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_awsplanes_server.go @@ -0,0 +1,308 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/ucp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// AwsPlanesServer is a fake server for instances of the v20231001preview.AwsPlanesClient type. +type AwsPlanesServer struct{ + // BeginCreateOrUpdate is the fake for method AwsPlanesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, planeName string, resource v20231001preview.AwsPlaneResource, options *v20231001preview.AwsPlanesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.AwsPlanesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method AwsPlanesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, planeName string, options *v20231001preview.AwsPlanesClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.AwsPlanesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AwsPlanesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, planeName string, options *v20231001preview.AwsPlanesClientGetOptions) (resp azfake.Responder[v20231001preview.AwsPlanesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method AwsPlanesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *v20231001preview.AwsPlanesClientListOptions) (resp azfake.PagerResponder[v20231001preview.AwsPlanesClientListResponse]) + + // BeginUpdate is the fake for method AwsPlanesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, planeName string, properties v20231001preview.AwsPlaneResourceTagsUpdate, options *v20231001preview.AwsPlanesClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.AwsPlanesClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewAwsPlanesServerTransport creates a new instance of AwsPlanesServerTransport with the provided implementation. +// The returned AwsPlanesServerTransport instance is connected to an instance of v20231001preview.AwsPlanesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAwsPlanesServerTransport(srv *AwsPlanesServer) *AwsPlanesServerTransport { + return &AwsPlanesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.AwsPlanesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.AwsPlanesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[v20231001preview.AwsPlanesClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.AwsPlanesClientUpdateResponse]](), + } +} + +// AwsPlanesServerTransport connects instances of v20231001preview.AwsPlanesClient to instances of AwsPlanesServer. +// Don't use this type directly, use NewAwsPlanesServerTransport instead. +type AwsPlanesServerTransport struct { + srv *AwsPlanesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.AwsPlanesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.AwsPlanesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[v20231001preview.AwsPlanesClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.AwsPlanesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for AwsPlanesServerTransport. +func (a *AwsPlanesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *AwsPlanesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if awsPlanesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = awsPlanesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AwsPlanesClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AwsPlanesClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AwsPlanesClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AwsPlanesClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AwsPlanesClient.BeginUpdate": + res.resp, res.err = a.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *AwsPlanesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/planes/aws/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.AwsPlaneResource](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), planeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + a.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + a.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + a.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (a *AwsPlanesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/planes/aws/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), planeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *AwsPlanesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/planes/aws/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), planeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AwsPlaneResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AwsPlanesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := a.newListPager.get(req) + if newListPager == nil { +resp := a.srv.NewListPager(nil) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.AwsPlanesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + a.newListPager.remove(req) + } + return resp, nil +} + +func (a *AwsPlanesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := a.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/planes/aws/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.AwsPlaneResourceTagsUpdate](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginUpdate(req.Context(), planeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + a.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + a.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to AwsPlanesServerTransport +var awsPlanesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_azurecredentials_server.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_azurecredentials_server.go new file mode 100644 index 0000000000..e4151d61d5 --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_azurecredentials_server.go @@ -0,0 +1,295 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/ucp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// AzureCredentialsServer is a fake server for instances of the v20231001preview.AzureCredentialsClient type. +type AzureCredentialsServer struct{ + // CreateOrUpdate is the fake for method AzureCredentialsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, planeName string, credentialName string, resource v20231001preview.AzureCredentialResource, options *v20231001preview.AzureCredentialsClientCreateOrUpdateOptions) (resp azfake.Responder[v20231001preview.AzureCredentialsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method AzureCredentialsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, planeName string, credentialName string, options *v20231001preview.AzureCredentialsClientDeleteOptions) (resp azfake.Responder[v20231001preview.AzureCredentialsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AzureCredentialsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, planeName string, credentialName string, options *v20231001preview.AzureCredentialsClientGetOptions) (resp azfake.Responder[v20231001preview.AzureCredentialsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method AzureCredentialsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(planeName string, options *v20231001preview.AzureCredentialsClientListOptions) (resp azfake.PagerResponder[v20231001preview.AzureCredentialsClientListResponse]) + + // Update is the fake for method AzureCredentialsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, planeName string, credentialName string, properties v20231001preview.AzureCredentialResourceTagsUpdate, options *v20231001preview.AzureCredentialsClientUpdateOptions) (resp azfake.Responder[v20231001preview.AzureCredentialsClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewAzureCredentialsServerTransport creates a new instance of AzureCredentialsServerTransport with the provided implementation. +// The returned AzureCredentialsServerTransport instance is connected to an instance of v20231001preview.AzureCredentialsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAzureCredentialsServerTransport(srv *AzureCredentialsServer) *AzureCredentialsServerTransport { + return &AzureCredentialsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[v20231001preview.AzureCredentialsClientListResponse]](), + } +} + +// AzureCredentialsServerTransport connects instances of v20231001preview.AzureCredentialsClient to instances of AzureCredentialsServer. +// Don't use this type directly, use NewAzureCredentialsServerTransport instead. +type AzureCredentialsServerTransport struct { + srv *AzureCredentialsServer + newListPager *tracker[azfake.PagerResponder[v20231001preview.AzureCredentialsClientListResponse]] +} + +// Do implements the policy.Transporter interface for AzureCredentialsServerTransport. +func (a *AzureCredentialsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *AzureCredentialsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if azureCredentialsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = azureCredentialsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AzureCredentialsClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "AzureCredentialsClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "AzureCredentialsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AzureCredentialsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AzureCredentialsClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *AzureCredentialsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/planes/azure/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Azure/credentials/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.AzureCredentialResource](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + credentialNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("credentialName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.CreateOrUpdate(req.Context(), planeNameParam, credentialNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureCredentialResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AzureCredentialsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if a.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/planes/azure/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Azure/credentials/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + credentialNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("credentialName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Delete(req.Context(), planeNameParam, credentialNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AzureCredentialsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/planes/azure/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Azure/credentials/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + credentialNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("credentialName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), planeNameParam, credentialNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureCredentialResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AzureCredentialsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := a.newListPager.get(req) + if newListPager == nil { + const regexStr = `/planes/azure/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Azure/credentials` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } +resp := a.srv.NewListPager(planeNameParam, nil) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.AzureCredentialsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + a.newListPager.remove(req) + } + return resp, nil +} + +func (a *AzureCredentialsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if a.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/planes/azure/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Azure/credentials/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.AzureCredentialResourceTagsUpdate](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + credentialNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("credentialName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Update(req.Context(), planeNameParam, credentialNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureCredentialResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to AzureCredentialsServerTransport +var azureCredentialsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_azureplanes_server.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_azureplanes_server.go new file mode 100644 index 0000000000..13f7a03c9a --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_azureplanes_server.go @@ -0,0 +1,308 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/ucp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// AzurePlanesServer is a fake server for instances of the v20231001preview.AzurePlanesClient type. +type AzurePlanesServer struct{ + // BeginCreateOrUpdate is the fake for method AzurePlanesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, planeName string, resource v20231001preview.AzurePlaneResource, options *v20231001preview.AzurePlanesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.AzurePlanesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method AzurePlanesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, planeName string, options *v20231001preview.AzurePlanesClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.AzurePlanesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AzurePlanesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, planeName string, options *v20231001preview.AzurePlanesClientGetOptions) (resp azfake.Responder[v20231001preview.AzurePlanesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method AzurePlanesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *v20231001preview.AzurePlanesClientListOptions) (resp azfake.PagerResponder[v20231001preview.AzurePlanesClientListResponse]) + + // BeginUpdate is the fake for method AzurePlanesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, planeName string, properties v20231001preview.AzurePlaneResourceTagsUpdate, options *v20231001preview.AzurePlanesClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.AzurePlanesClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewAzurePlanesServerTransport creates a new instance of AzurePlanesServerTransport with the provided implementation. +// The returned AzurePlanesServerTransport instance is connected to an instance of v20231001preview.AzurePlanesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAzurePlanesServerTransport(srv *AzurePlanesServer) *AzurePlanesServerTransport { + return &AzurePlanesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.AzurePlanesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.AzurePlanesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[v20231001preview.AzurePlanesClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.AzurePlanesClientUpdateResponse]](), + } +} + +// AzurePlanesServerTransport connects instances of v20231001preview.AzurePlanesClient to instances of AzurePlanesServer. +// Don't use this type directly, use NewAzurePlanesServerTransport instead. +type AzurePlanesServerTransport struct { + srv *AzurePlanesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.AzurePlanesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.AzurePlanesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[v20231001preview.AzurePlanesClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.AzurePlanesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for AzurePlanesServerTransport. +func (a *AzurePlanesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *AzurePlanesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if azurePlanesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = azurePlanesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AzurePlanesClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AzurePlanesClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AzurePlanesClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AzurePlanesClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AzurePlanesClient.BeginUpdate": + res.resp, res.err = a.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *AzurePlanesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/planes/azure/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.AzurePlaneResource](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), planeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + a.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + a.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + a.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (a *AzurePlanesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/planes/azure/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), planeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + a.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *AzurePlanesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/planes/azure/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), planeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzurePlaneResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AzurePlanesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := a.newListPager.get(req) + if newListPager == nil { +resp := a.srv.NewListPager(nil) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.AzurePlanesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + a.newListPager.remove(req) + } + return resp, nil +} + +func (a *AzurePlanesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := a.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/planes/azure/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.AzurePlaneResourceTagsUpdate](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginUpdate(req.Context(), planeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + a.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + a.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to AzurePlanesServerTransport +var azurePlanesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_internal.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_internal.go new file mode 100644 index 0000000000..0c62457a83 --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_internal.go @@ -0,0 +1,66 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_locations_server.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_locations_server.go new file mode 100644 index 0000000000..cf97d09ddd --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_locations_server.go @@ -0,0 +1,294 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/ucp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// LocationsServer is a fake server for instances of the v20231001preview.LocationsClient type. +type LocationsServer struct{ + // BeginCreateOrUpdate is the fake for method LocationsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, planeName string, resourceProviderName string, locationName string, resource v20231001preview.LocationResource, options *v20231001preview.LocationsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.LocationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method LocationsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, planeName string, resourceProviderName string, locationName string, options *v20231001preview.LocationsClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.LocationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method LocationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, planeName string, resourceProviderName string, locationName string, options *v20231001preview.LocationsClientGetOptions) (resp azfake.Responder[v20231001preview.LocationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method LocationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(planeName string, resourceProviderName string, options *v20231001preview.LocationsClientListOptions) (resp azfake.PagerResponder[v20231001preview.LocationsClientListResponse]) + +} + +// NewLocationsServerTransport creates a new instance of LocationsServerTransport with the provided implementation. +// The returned LocationsServerTransport instance is connected to an instance of v20231001preview.LocationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewLocationsServerTransport(srv *LocationsServer) *LocationsServerTransport { + return &LocationsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.LocationsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.LocationsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[v20231001preview.LocationsClientListResponse]](), + } +} + +// LocationsServerTransport connects instances of v20231001preview.LocationsClient to instances of LocationsServer. +// Don't use this type directly, use NewLocationsServerTransport instead. +type LocationsServerTransport struct { + srv *LocationsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.LocationsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.LocationsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[v20231001preview.LocationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for LocationsServerTransport. +func (l *LocationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return l.dispatchToMethodFake(req, method) +} + +func (l *LocationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if locationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = locationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "LocationsClient.BeginCreateOrUpdate": + res.resp, res.err = l.dispatchBeginCreateOrUpdate(req) + case "LocationsClient.BeginDelete": + res.resp, res.err = l.dispatchBeginDelete(req) + case "LocationsClient.Get": + res.resp, res.err = l.dispatchGet(req) + case "LocationsClient.NewListPager": + res.resp, res.err = l.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (l *LocationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if l.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := l.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/locations/(?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[v20231001preview.LocationResource](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.BeginCreateOrUpdate(req.Context(), planeNameParam, resourceProviderNameParam, locationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + l.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + l.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + l.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (l *LocationsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if l.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := l.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/locations/(?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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.BeginDelete(req.Context(), planeNameParam, resourceProviderNameParam, locationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + l.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + l.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + l.beginDelete.remove(req) + } + + return resp, nil +} + +func (l *LocationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if l.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/locations/(?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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + if err != nil { + return nil, err + } + respr, errRespr := l.srv.Get(req.Context(), planeNameParam, resourceProviderNameParam, locationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).LocationResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (l *LocationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if l.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := l.newListPager.get(req) + if newListPager == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/locations` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } +resp := l.srv.NewListPager(planeNameParam, resourceProviderNameParam, nil) + newListPager = &resp + l.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.LocationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + l.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + l.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to LocationsServerTransport +var locationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_planes_server.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_planes_server.go new file mode 100644 index 0000000000..b361998914 --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_planes_server.go @@ -0,0 +1,118 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + 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/radius-project/radius/pkg/ucp/api/v20231001preview" + "net/http" +) + +// PlanesServer is a fake server for instances of the v20231001preview.PlanesClient type. +type PlanesServer struct{ + // NewListPlanesPager is the fake for method PlanesClient.NewListPlanesPager + // HTTP status codes to indicate success: http.StatusOK + NewListPlanesPager func(options *v20231001preview.PlanesClientListPlanesOptions) (resp azfake.PagerResponder[v20231001preview.PlanesClientListPlanesResponse]) + +} + +// NewPlanesServerTransport creates a new instance of PlanesServerTransport with the provided implementation. +// The returned PlanesServerTransport instance is connected to an instance of v20231001preview.PlanesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPlanesServerTransport(srv *PlanesServer) *PlanesServerTransport { + return &PlanesServerTransport{ + srv: srv, + newListPlanesPager: newTracker[azfake.PagerResponder[v20231001preview.PlanesClientListPlanesResponse]](), + } +} + +// PlanesServerTransport connects instances of v20231001preview.PlanesClient to instances of PlanesServer. +// Don't use this type directly, use NewPlanesServerTransport instead. +type PlanesServerTransport struct { + srv *PlanesServer + newListPlanesPager *tracker[azfake.PagerResponder[v20231001preview.PlanesClientListPlanesResponse]] +} + +// Do implements the policy.Transporter interface for PlanesServerTransport. +func (p *PlanesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *PlanesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if planesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = planesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PlanesClient.NewListPlanesPager": + res.resp, res.err = p.dispatchNewListPlanesPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (p *PlanesServerTransport) dispatchNewListPlanesPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPlanesPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPlanesPager not implemented")} + } + newListPlanesPager := p.newListPlanesPager.get(req) + if newListPlanesPager == nil { +resp := p.srv.NewListPlanesPager(nil) + newListPlanesPager = &resp + p.newListPlanesPager.add(req, newListPlanesPager) + server.PagerResponderInjectNextLinks(newListPlanesPager, req, func(page *v20231001preview.PlanesClientListPlanesResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPlanesPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPlanesPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPlanesPager) { + p.newListPlanesPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to PlanesServerTransport +var planesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_radiusplanes_server.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_radiusplanes_server.go new file mode 100644 index 0000000000..3271c005e4 --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_radiusplanes_server.go @@ -0,0 +1,308 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/ucp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// RadiusPlanesServer is a fake server for instances of the v20231001preview.RadiusPlanesClient type. +type RadiusPlanesServer struct{ + // BeginCreateOrUpdate is the fake for method RadiusPlanesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, planeName string, resource v20231001preview.RadiusPlaneResource, options *v20231001preview.RadiusPlanesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.RadiusPlanesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method RadiusPlanesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, planeName string, options *v20231001preview.RadiusPlanesClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.RadiusPlanesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method RadiusPlanesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, planeName string, options *v20231001preview.RadiusPlanesClientGetOptions) (resp azfake.Responder[v20231001preview.RadiusPlanesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method RadiusPlanesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *v20231001preview.RadiusPlanesClientListOptions) (resp azfake.PagerResponder[v20231001preview.RadiusPlanesClientListResponse]) + + // BeginUpdate is the fake for method RadiusPlanesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, planeName string, properties v20231001preview.RadiusPlaneResourceTagsUpdate, options *v20231001preview.RadiusPlanesClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.RadiusPlanesClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewRadiusPlanesServerTransport creates a new instance of RadiusPlanesServerTransport with the provided implementation. +// The returned RadiusPlanesServerTransport instance is connected to an instance of v20231001preview.RadiusPlanesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewRadiusPlanesServerTransport(srv *RadiusPlanesServer) *RadiusPlanesServerTransport { + return &RadiusPlanesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.RadiusPlanesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.RadiusPlanesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[v20231001preview.RadiusPlanesClientListResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.RadiusPlanesClientUpdateResponse]](), + } +} + +// RadiusPlanesServerTransport connects instances of v20231001preview.RadiusPlanesClient to instances of RadiusPlanesServer. +// Don't use this type directly, use NewRadiusPlanesServerTransport instead. +type RadiusPlanesServerTransport struct { + srv *RadiusPlanesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.RadiusPlanesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.RadiusPlanesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[v20231001preview.RadiusPlanesClientListResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.RadiusPlanesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for RadiusPlanesServerTransport. +func (r *RadiusPlanesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return r.dispatchToMethodFake(req, method) +} + +func (r *RadiusPlanesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if radiusPlanesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = radiusPlanesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RadiusPlanesClient.BeginCreateOrUpdate": + res.resp, res.err = r.dispatchBeginCreateOrUpdate(req) + case "RadiusPlanesClient.BeginDelete": + res.resp, res.err = r.dispatchBeginDelete(req) + case "RadiusPlanesClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RadiusPlanesClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + case "RadiusPlanesClient.BeginUpdate": + res.resp, res.err = r.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (r *RadiusPlanesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := r.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.RadiusPlaneResource](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginCreateOrUpdate(req.Context(), planeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + r.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + r.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + r.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (r *RadiusPlanesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if r.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := r.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginDelete(req.Context(), planeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + r.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + r.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + r.beginDelete.remove(req) + } + + return resp, nil +} + +func (r *RadiusPlanesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if r.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Get(req.Context(), planeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RadiusPlaneResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *RadiusPlanesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if r.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := r.newListPager.get(req) + if newListPager == nil { +resp := r.srv.NewListPager(nil) + newListPager = &resp + r.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.RadiusPlanesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + r.newListPager.remove(req) + } + return resp, nil +} + +func (r *RadiusPlanesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := r.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.RadiusPlaneResourceTagsUpdate](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginUpdate(req.Context(), planeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + r.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + r.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + r.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to RadiusPlanesServerTransport +var radiusPlanesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_resourcegroups_server.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_resourcegroups_server.go new file mode 100644 index 0000000000..c66d567bcd --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_resourcegroups_server.go @@ -0,0 +1,295 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/ucp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// ResourceGroupsServer is a fake server for instances of the v20231001preview.ResourceGroupsClient type. +type ResourceGroupsServer struct{ + // CreateOrUpdate is the fake for method ResourceGroupsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, planeName string, resourceGroupName string, resource v20231001preview.ResourceGroupResource, options *v20231001preview.ResourceGroupsClientCreateOrUpdateOptions) (resp azfake.Responder[v20231001preview.ResourceGroupsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method ResourceGroupsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, planeName string, resourceGroupName string, options *v20231001preview.ResourceGroupsClientDeleteOptions) (resp azfake.Responder[v20231001preview.ResourceGroupsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ResourceGroupsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, planeName string, resourceGroupName string, options *v20231001preview.ResourceGroupsClientGetOptions) (resp azfake.Responder[v20231001preview.ResourceGroupsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ResourceGroupsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(planeName string, options *v20231001preview.ResourceGroupsClientListOptions) (resp azfake.PagerResponder[v20231001preview.ResourceGroupsClientListResponse]) + + // Update is the fake for method ResourceGroupsClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, planeName string, resourceGroupName string, properties v20231001preview.ResourceGroupResourceTagsUpdate, options *v20231001preview.ResourceGroupsClientUpdateOptions) (resp azfake.Responder[v20231001preview.ResourceGroupsClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewResourceGroupsServerTransport creates a new instance of ResourceGroupsServerTransport with the provided implementation. +// The returned ResourceGroupsServerTransport instance is connected to an instance of v20231001preview.ResourceGroupsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewResourceGroupsServerTransport(srv *ResourceGroupsServer) *ResourceGroupsServerTransport { + return &ResourceGroupsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[v20231001preview.ResourceGroupsClientListResponse]](), + } +} + +// ResourceGroupsServerTransport connects instances of v20231001preview.ResourceGroupsClient to instances of ResourceGroupsServer. +// Don't use this type directly, use NewResourceGroupsServerTransport instead. +type ResourceGroupsServerTransport struct { + srv *ResourceGroupsServer + newListPager *tracker[azfake.PagerResponder[v20231001preview.ResourceGroupsClientListResponse]] +} + +// Do implements the policy.Transporter interface for ResourceGroupsServerTransport. +func (r *ResourceGroupsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return r.dispatchToMethodFake(req, method) +} + +func (r *ResourceGroupsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if resourceGroupsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = resourceGroupsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ResourceGroupsClient.CreateOrUpdate": + res.resp, res.err = r.dispatchCreateOrUpdate(req) + case "ResourceGroupsClient.Delete": + res.resp, res.err = r.dispatchDelete(req) + case "ResourceGroupsClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "ResourceGroupsClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + case "ResourceGroupsClient.Update": + res.resp, res.err = r.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (r *ResourceGroupsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if r.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.ResourceGroupResource](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.CreateOrUpdate(req.Context(), planeNameParam, resourceGroupNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ResourceGroupResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *ResourceGroupsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if r.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Delete(req.Context(), planeNameParam, resourceGroupNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *ResourceGroupsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if r.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Get(req.Context(), planeNameParam, resourceGroupNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ResourceGroupResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *ResourceGroupsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if r.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := r.newListPager.get(req) + if newListPager == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } +resp := r.srv.NewListPager(planeNameParam, nil) + newListPager = &resp + r.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.ResourceGroupsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + r.newListPager.remove(req) + } + return resp, nil +} + +func (r *ResourceGroupsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if r.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.ResourceGroupResourceTagsUpdate](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Update(req.Context(), planeNameParam, resourceGroupNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ResourceGroupResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ResourceGroupsServerTransport +var resourceGroupsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_resourceproviders_server.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_resourceproviders_server.go new file mode 100644 index 0000000000..138f9aaceb --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_resourceproviders_server.go @@ -0,0 +1,362 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/ucp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// ResourceProvidersServer is a fake server for instances of the v20231001preview.ResourceProvidersClient type. +type ResourceProvidersServer struct{ + // BeginCreateOrUpdate is the fake for method ResourceProvidersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, planeName string, resourceProviderName string, resource v20231001preview.ResourceProviderResource, options *v20231001preview.ResourceProvidersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.ResourceProvidersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ResourceProvidersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, planeName string, resourceProviderName string, options *v20231001preview.ResourceProvidersClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.ResourceProvidersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ResourceProvidersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, planeName string, resourceProviderName string, options *v20231001preview.ResourceProvidersClientGetOptions) (resp azfake.Responder[v20231001preview.ResourceProvidersClientGetResponse], errResp azfake.ErrorResponder) + + // GetProviderSummary is the fake for method ResourceProvidersClient.GetProviderSummary + // HTTP status codes to indicate success: http.StatusOK + GetProviderSummary func(ctx context.Context, planeName string, resourceProviderName string, options *v20231001preview.ResourceProvidersClientGetProviderSummaryOptions) (resp azfake.Responder[v20231001preview.ResourceProvidersClientGetProviderSummaryResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ResourceProvidersClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(planeName string, options *v20231001preview.ResourceProvidersClientListOptions) (resp azfake.PagerResponder[v20231001preview.ResourceProvidersClientListResponse]) + + // NewListProviderSummariesPager is the fake for method ResourceProvidersClient.NewListProviderSummariesPager + // HTTP status codes to indicate success: http.StatusOK + NewListProviderSummariesPager func(planeName string, options *v20231001preview.ResourceProvidersClientListProviderSummariesOptions) (resp azfake.PagerResponder[v20231001preview.ResourceProvidersClientListProviderSummariesResponse]) + +} + +// NewResourceProvidersServerTransport creates a new instance of ResourceProvidersServerTransport with the provided implementation. +// The returned ResourceProvidersServerTransport instance is connected to an instance of v20231001preview.ResourceProvidersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewResourceProvidersServerTransport(srv *ResourceProvidersServer) *ResourceProvidersServerTransport { + return &ResourceProvidersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.ResourceProvidersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.ResourceProvidersClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[v20231001preview.ResourceProvidersClientListResponse]](), + newListProviderSummariesPager: newTracker[azfake.PagerResponder[v20231001preview.ResourceProvidersClientListProviderSummariesResponse]](), + } +} + +// ResourceProvidersServerTransport connects instances of v20231001preview.ResourceProvidersClient to instances of ResourceProvidersServer. +// Don't use this type directly, use NewResourceProvidersServerTransport instead. +type ResourceProvidersServerTransport struct { + srv *ResourceProvidersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.ResourceProvidersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.ResourceProvidersClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[v20231001preview.ResourceProvidersClientListResponse]] + newListProviderSummariesPager *tracker[azfake.PagerResponder[v20231001preview.ResourceProvidersClientListProviderSummariesResponse]] +} + +// Do implements the policy.Transporter interface for ResourceProvidersServerTransport. +func (r *ResourceProvidersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return r.dispatchToMethodFake(req, method) +} + +func (r *ResourceProvidersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if resourceProvidersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = resourceProvidersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ResourceProvidersClient.BeginCreateOrUpdate": + res.resp, res.err = r.dispatchBeginCreateOrUpdate(req) + case "ResourceProvidersClient.BeginDelete": + res.resp, res.err = r.dispatchBeginDelete(req) + case "ResourceProvidersClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "ResourceProvidersClient.GetProviderSummary": + res.resp, res.err = r.dispatchGetProviderSummary(req) + case "ResourceProvidersClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + case "ResourceProvidersClient.NewListProviderSummariesPager": + res.resp, res.err = r.dispatchNewListProviderSummariesPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (r *ResourceProvidersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := r.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.ResourceProviderResource](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginCreateOrUpdate(req.Context(), planeNameParam, resourceProviderNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + r.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + r.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + r.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (r *ResourceProvidersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if r.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := r.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginDelete(req.Context(), planeNameParam, resourceProviderNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + r.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + r.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + r.beginDelete.remove(req) + } + + return resp, nil +} + +func (r *ResourceProvidersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if r.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Get(req.Context(), planeNameParam, resourceProviderNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ResourceProviderResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *ResourceProvidersServerTransport) dispatchGetProviderSummary(req *http.Request) (*http.Response, error) { + if r.srv.GetProviderSummary == nil { + return nil, &nonRetriableError{errors.New("fake for method GetProviderSummary not implemented")} + } + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.GetProviderSummary(req.Context(), planeNameParam, resourceProviderNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ResourceProviderSummary, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *ResourceProvidersServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if r.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := r.newListPager.get(req) + if newListPager == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } +resp := r.srv.NewListPager(planeNameParam, nil) + newListPager = &resp + r.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.ResourceProvidersClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + r.newListPager.remove(req) + } + return resp, nil +} + +func (r *ResourceProvidersServerTransport) dispatchNewListProviderSummariesPager(req *http.Request) (*http.Response, error) { + if r.srv.NewListProviderSummariesPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListProviderSummariesPager not implemented")} + } + newListProviderSummariesPager := r.newListProviderSummariesPager.get(req) + if newListProviderSummariesPager == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } +resp := r.srv.NewListProviderSummariesPager(planeNameParam, nil) + newListProviderSummariesPager = &resp + r.newListProviderSummariesPager.add(req, newListProviderSummariesPager) + server.PagerResponderInjectNextLinks(newListProviderSummariesPager, req, func(page *v20231001preview.ResourceProvidersClientListProviderSummariesResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListProviderSummariesPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListProviderSummariesPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListProviderSummariesPager) { + r.newListProviderSummariesPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ResourceProvidersServerTransport +var resourceProvidersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_resources_server.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_resources_server.go new file mode 100644 index 0000000000..39f575e452 --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_resources_server.go @@ -0,0 +1,134 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + 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/radius-project/radius/pkg/ucp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// ResourcesServer is a fake server for instances of the v20231001preview.ResourcesClient type. +type ResourcesServer struct{ + // NewListPager is the fake for method ResourcesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(planeName string, resourceGroupName string, options *v20231001preview.ResourcesClientListOptions) (resp azfake.PagerResponder[v20231001preview.ResourcesClientListResponse]) + +} + +// NewResourcesServerTransport creates a new instance of ResourcesServerTransport with the provided implementation. +// The returned ResourcesServerTransport instance is connected to an instance of v20231001preview.ResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewResourcesServerTransport(srv *ResourcesServer) *ResourcesServerTransport { + return &ResourcesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[v20231001preview.ResourcesClientListResponse]](), + } +} + +// ResourcesServerTransport connects instances of v20231001preview.ResourcesClient to instances of ResourcesServer. +// Don't use this type directly, use NewResourcesServerTransport instead. +type ResourcesServerTransport struct { + srv *ResourcesServer + newListPager *tracker[azfake.PagerResponder[v20231001preview.ResourcesClientListResponse]] +} + +// Do implements the policy.Transporter interface for ResourcesServerTransport. +func (r *ResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return r.dispatchToMethodFake(req, method) +} + +func (r *ResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if resourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = resourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ResourcesClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (r *ResourcesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if r.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := r.newListPager.get(req) + if newListPager == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resources` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } +resp := r.srv.NewListPager(planeNameParam, resourceGroupNameParam, nil) + newListPager = &resp + r.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.ResourcesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + r.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ResourcesServerTransport +var resourcesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_resourcetypes_server.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_resourcetypes_server.go new file mode 100644 index 0000000000..d745f522d0 --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_resourcetypes_server.go @@ -0,0 +1,294 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/ucp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// ResourceTypesServer is a fake server for instances of the v20231001preview.ResourceTypesClient type. +type ResourceTypesServer struct{ + // BeginCreateOrUpdate is the fake for method ResourceTypesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, resource v20231001preview.ResourceTypeResource, options *v20231001preview.ResourceTypesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.ResourceTypesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ResourceTypesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *v20231001preview.ResourceTypesClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.ResourceTypesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ResourceTypesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *v20231001preview.ResourceTypesClientGetOptions) (resp azfake.Responder[v20231001preview.ResourceTypesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ResourceTypesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(planeName string, resourceProviderName string, options *v20231001preview.ResourceTypesClientListOptions) (resp azfake.PagerResponder[v20231001preview.ResourceTypesClientListResponse]) + +} + +// NewResourceTypesServerTransport creates a new instance of ResourceTypesServerTransport with the provided implementation. +// The returned ResourceTypesServerTransport instance is connected to an instance of v20231001preview.ResourceTypesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewResourceTypesServerTransport(srv *ResourceTypesServer) *ResourceTypesServerTransport { + return &ResourceTypesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.ResourceTypesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.ResourceTypesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[v20231001preview.ResourceTypesClientListResponse]](), + } +} + +// ResourceTypesServerTransport connects instances of v20231001preview.ResourceTypesClient to instances of ResourceTypesServer. +// Don't use this type directly, use NewResourceTypesServerTransport instead. +type ResourceTypesServerTransport struct { + srv *ResourceTypesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.ResourceTypesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.ResourceTypesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[v20231001preview.ResourceTypesClientListResponse]] +} + +// Do implements the policy.Transporter interface for ResourceTypesServerTransport. +func (r *ResourceTypesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return r.dispatchToMethodFake(req, method) +} + +func (r *ResourceTypesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if resourceTypesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = resourceTypesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ResourceTypesClient.BeginCreateOrUpdate": + res.resp, res.err = r.dispatchBeginCreateOrUpdate(req) + case "ResourceTypesClient.BeginDelete": + res.resp, res.err = r.dispatchBeginDelete(req) + case "ResourceTypesClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "ResourceTypesClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (r *ResourceTypesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := r.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcetypes/(?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[v20231001preview.ResourceTypeResource](req) + if err != nil { + return nil, err + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + resourceTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceTypeName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginCreateOrUpdate(req.Context(), planeNameParam, resourceProviderNameParam, resourceTypeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + r.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + r.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + r.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (r *ResourceTypesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if r.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := r.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcetypes/(?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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + resourceTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceTypeName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginDelete(req.Context(), planeNameParam, resourceProviderNameParam, resourceTypeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + r.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + r.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + r.beginDelete.remove(req) + } + + return resp, nil +} + +func (r *ResourceTypesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if r.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcetypes/(?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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } + resourceTypeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceTypeName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Get(req.Context(), planeNameParam, resourceProviderNameParam, resourceTypeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ResourceTypeResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *ResourceTypesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if r.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := r.newListPager.get(req) + if newListPager == nil { + const regexStr = `/planes/radius/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/System\.Resources/resourceproviders/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcetypes` + 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) + } + planeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("planeName")]) + if err != nil { + return nil, err + } + resourceProviderNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceProviderName")]) + if err != nil { + return nil, err + } +resp := r.srv.NewListPager(planeNameParam, resourceProviderNameParam, nil) + newListPager = &resp + r.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.ResourceTypesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + r.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ResourceTypesServerTransport +var resourceTypesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_server_factory.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_server_factory.go new file mode 100644 index 0000000000..90ceab79c8 --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_server_factory.go @@ -0,0 +1,150 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the v20231001preview.ClientFactory type. +type ServerFactory struct { + // APIVersionsServer contains the fakes for client APIVersionsClient + APIVersionsServer APIVersionsServer + + // AwsCredentialsServer contains the fakes for client AwsCredentialsClient + AwsCredentialsServer AwsCredentialsServer + + // AwsPlanesServer contains the fakes for client AwsPlanesClient + AwsPlanesServer AwsPlanesServer + + // AzureCredentialsServer contains the fakes for client AzureCredentialsClient + AzureCredentialsServer AzureCredentialsServer + + // AzurePlanesServer contains the fakes for client AzurePlanesClient + AzurePlanesServer AzurePlanesServer + + // LocationsServer contains the fakes for client LocationsClient + LocationsServer LocationsServer + + // PlanesServer contains the fakes for client PlanesClient + PlanesServer PlanesServer + + // RadiusPlanesServer contains the fakes for client RadiusPlanesClient + RadiusPlanesServer RadiusPlanesServer + + // ResourceGroupsServer contains the fakes for client ResourceGroupsClient + ResourceGroupsServer ResourceGroupsServer + + // ResourceProvidersServer contains the fakes for client ResourceProvidersClient + ResourceProvidersServer ResourceProvidersServer + + // ResourceTypesServer contains the fakes for client ResourceTypesClient + ResourceTypesServer ResourceTypesServer + + // ResourcesServer contains the fakes for client ResourcesClient + ResourcesServer ResourcesServer + +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of v20231001preview.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of v20231001preview.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trAPIVersionsServer *APIVersionsServerTransport + trAwsCredentialsServer *AwsCredentialsServerTransport + trAwsPlanesServer *AwsPlanesServerTransport + trAzureCredentialsServer *AzureCredentialsServerTransport + trAzurePlanesServer *AzurePlanesServerTransport + trLocationsServer *LocationsServerTransport + trPlanesServer *PlanesServerTransport + trRadiusPlanesServer *RadiusPlanesServerTransport + trResourceGroupsServer *ResourceGroupsServerTransport + trResourceProvidersServer *ResourceProvidersServerTransport + trResourceTypesServer *ResourceTypesServerTransport + trResourcesServer *ResourcesServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "APIVersionsClient": + initServer(s, &s.trAPIVersionsServer, func() *APIVersionsServerTransport { return NewAPIVersionsServerTransport(&s.srv.APIVersionsServer) }) + resp, err = s.trAPIVersionsServer.Do(req) + case "AwsCredentialsClient": + initServer(s, &s.trAwsCredentialsServer, func() *AwsCredentialsServerTransport { return NewAwsCredentialsServerTransport(&s.srv.AwsCredentialsServer) }) + resp, err = s.trAwsCredentialsServer.Do(req) + case "AwsPlanesClient": + initServer(s, &s.trAwsPlanesServer, func() *AwsPlanesServerTransport { return NewAwsPlanesServerTransport(&s.srv.AwsPlanesServer) }) + resp, err = s.trAwsPlanesServer.Do(req) + case "AzureCredentialsClient": + initServer(s, &s.trAzureCredentialsServer, func() *AzureCredentialsServerTransport { return NewAzureCredentialsServerTransport(&s.srv.AzureCredentialsServer) }) + resp, err = s.trAzureCredentialsServer.Do(req) + case "AzurePlanesClient": + initServer(s, &s.trAzurePlanesServer, func() *AzurePlanesServerTransport { return NewAzurePlanesServerTransport(&s.srv.AzurePlanesServer) }) + resp, err = s.trAzurePlanesServer.Do(req) + case "LocationsClient": + initServer(s, &s.trLocationsServer, func() *LocationsServerTransport { return NewLocationsServerTransport(&s.srv.LocationsServer) }) + resp, err = s.trLocationsServer.Do(req) + case "PlanesClient": + initServer(s, &s.trPlanesServer, func() *PlanesServerTransport { return NewPlanesServerTransport(&s.srv.PlanesServer) }) + resp, err = s.trPlanesServer.Do(req) + case "RadiusPlanesClient": + initServer(s, &s.trRadiusPlanesServer, func() *RadiusPlanesServerTransport { return NewRadiusPlanesServerTransport(&s.srv.RadiusPlanesServer) }) + resp, err = s.trRadiusPlanesServer.Do(req) + case "ResourceGroupsClient": + initServer(s, &s.trResourceGroupsServer, func() *ResourceGroupsServerTransport { return NewResourceGroupsServerTransport(&s.srv.ResourceGroupsServer) }) + resp, err = s.trResourceGroupsServer.Do(req) + case "ResourceProvidersClient": + initServer(s, &s.trResourceProvidersServer, func() *ResourceProvidersServerTransport { return NewResourceProvidersServerTransport(&s.srv.ResourceProvidersServer) }) + resp, err = s.trResourceProvidersServer.Do(req) + case "ResourceTypesClient": + initServer(s, &s.trResourceTypesServer, func() *ResourceTypesServerTransport { return NewResourceTypesServerTransport(&s.srv.ResourceTypesServer) }) + resp, err = s.trResourceTypesServer.Do(req) + case "ResourcesClient": + initServer(s, &s.trResourcesServer, func() *ResourcesServerTransport { return NewResourcesServerTransport(&s.srv.ResourcesServer) }) + resp, err = s.trResourcesServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/pkg/ucp/api/v20231001preview/fake/zz_generated_time_rfc3339.go b/pkg/ucp/api/v20231001preview/fake/zz_generated_time_rfc3339.go new file mode 100644 index 0000000000..83c75cddc6 --- /dev/null +++ b/pkg/ucp/api/v20231001preview/fake/zz_generated_time_rfc3339.go @@ -0,0 +1,114 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + + + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + + + +// 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+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +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 + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go b/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go index 213af38bf7..7910252031 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_apiversions_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -29,7 +26,7 @@ type APIVersionsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAPIVersionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*APIVersionsClient, error) { - cl, err := arm.NewClient(moduleName+".APIVersionsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -58,10 +55,13 @@ func (client *APIVersionsClient) BeginCreateOrUpdate(ctx context.Context, planeN } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[APIVersionsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[APIVersionsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[APIVersionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -71,6 +71,10 @@ func (client *APIVersionsClient) BeginCreateOrUpdate(ctx context.Context, planeN // Generated from API version 2023-10-01-preview func (client *APIVersionsClient) createOrUpdate(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, apiVersionName string, resource APIVersionResource, options *APIVersionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "APIVersionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, planeName, resourceProviderName, resourceTypeName, apiVersionName, resource, options) if err != nil { return nil, err @@ -87,7 +91,7 @@ func (client *APIVersionsClient) createOrUpdate(ctx context.Context, planeName s } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *APIVersionsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, apiVersionName string, resource APIVersionResource, options *APIVersionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *APIVersionsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, apiVersionName string, resource APIVersionResource, _ *APIVersionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/apiversions/{apiVersionName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -116,7 +120,7 @@ func (client *APIVersionsClient) createOrUpdateCreateRequest(ctx context.Context if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete an API version. @@ -136,10 +140,13 @@ func (client *APIVersionsClient) BeginDelete(ctx context.Context, planeName stri } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[APIVersionsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[APIVersionsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[APIVersionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -149,6 +156,10 @@ func (client *APIVersionsClient) BeginDelete(ctx context.Context, planeName stri // Generated from API version 2023-10-01-preview func (client *APIVersionsClient) deleteOperation(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, apiVersionName string, options *APIVersionsClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "APIVersionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, planeName, resourceProviderName, resourceTypeName, apiVersionName, options) if err != nil { return nil, err @@ -165,7 +176,7 @@ func (client *APIVersionsClient) deleteOperation(ctx context.Context, planeName } // deleteCreateRequest creates the Delete request. -func (client *APIVersionsClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, apiVersionName string, options *APIVersionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *APIVersionsClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, apiVersionName string, _ *APIVersionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/apiversions/{apiVersionName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -205,6 +216,10 @@ func (client *APIVersionsClient) deleteCreateRequest(ctx context.Context, planeN // - options - APIVersionsClientGetOptions contains the optional parameters for the APIVersionsClient.Get method. func (client *APIVersionsClient) Get(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, apiVersionName string, options *APIVersionsClientGetOptions) (APIVersionsClientGetResponse, error) { var err error + const operationName = "APIVersionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, planeName, resourceProviderName, resourceTypeName, apiVersionName, options) if err != nil { return APIVersionsClientGetResponse{}, err @@ -222,7 +237,7 @@ func (client *APIVersionsClient) Get(ctx context.Context, planeName string, reso } // getCreateRequest creates the Get request. -func (client *APIVersionsClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, apiVersionName string, options *APIVersionsClientGetOptions) (*policy.Request, error) { +func (client *APIVersionsClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, apiVersionName string, _ *APIVersionsClientGetOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/apiversions/{apiVersionName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -273,30 +288,25 @@ func (client *APIVersionsClient) NewListPager(planeName string, resourceProvider return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *APIVersionsClientListResponse) (APIVersionsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, planeName, resourceProviderName, resourceTypeName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "APIVersionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, planeName, resourceProviderName, resourceTypeName, options) + }, nil) if err != nil { return APIVersionsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return APIVersionsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return APIVersionsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *APIVersionsClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *APIVersionsClientListOptions) (*policy.Request, error) { +func (client *APIVersionsClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, _ *APIVersionsClientListOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}/apiversions" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") diff --git a/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go b/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go index c6ec74d5ae..20c91b7411 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_awscredentials_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -29,7 +26,7 @@ type AwsCredentialsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAwsCredentialsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AwsCredentialsClient, error) { - cl, err := arm.NewClient(moduleName+".AwsCredentialsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -50,6 +47,10 @@ func NewAwsCredentialsClient(credential azcore.TokenCredential, options *arm.Cli // method. func (client *AwsCredentialsClient) CreateOrUpdate(ctx context.Context, planeName string, credentialName string, resource AwsCredentialResource, options *AwsCredentialsClientCreateOrUpdateOptions) (AwsCredentialsClientCreateOrUpdateResponse, error) { var err error + const operationName = "AwsCredentialsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, planeName, credentialName, resource, options) if err != nil { return AwsCredentialsClientCreateOrUpdateResponse{}, err @@ -67,7 +68,7 @@ func (client *AwsCredentialsClient) CreateOrUpdate(ctx context.Context, planeNam } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AwsCredentialsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, credentialName string, resource AwsCredentialResource, options *AwsCredentialsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AwsCredentialsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, credentialName string, resource AwsCredentialResource, _ *AwsCredentialsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { @@ -85,7 +86,7 @@ func (client *AwsCredentialsClient) createOrUpdateCreateRequest(ctx context.Cont if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -106,6 +107,10 @@ func (client *AwsCredentialsClient) createOrUpdateHandleResponse(resp *http.Resp // - options - AwsCredentialsClientDeleteOptions contains the optional parameters for the AwsCredentialsClient.Delete method. func (client *AwsCredentialsClient) Delete(ctx context.Context, planeName string, credentialName string, options *AwsCredentialsClientDeleteOptions) (AwsCredentialsClientDeleteResponse, error) { var err error + const operationName = "AwsCredentialsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, planeName, credentialName, options) if err != nil { return AwsCredentialsClientDeleteResponse{}, err @@ -122,7 +127,7 @@ func (client *AwsCredentialsClient) Delete(ctx context.Context, planeName string } // deleteCreateRequest creates the Delete request. -func (client *AwsCredentialsClient) deleteCreateRequest(ctx context.Context, planeName string, credentialName string, options *AwsCredentialsClientDeleteOptions) (*policy.Request, error) { +func (client *AwsCredentialsClient) deleteCreateRequest(ctx context.Context, planeName string, credentialName string, _ *AwsCredentialsClientDeleteOptions) (*policy.Request, error) { urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { @@ -149,6 +154,10 @@ func (client *AwsCredentialsClient) deleteCreateRequest(ctx context.Context, pla // - options - AwsCredentialsClientGetOptions contains the optional parameters for the AwsCredentialsClient.Get method. func (client *AwsCredentialsClient) Get(ctx context.Context, planeName string, credentialName string, options *AwsCredentialsClientGetOptions) (AwsCredentialsClientGetResponse, error) { var err error + const operationName = "AwsCredentialsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, planeName, credentialName, options) if err != nil { return AwsCredentialsClientGetResponse{}, err @@ -166,7 +175,7 @@ func (client *AwsCredentialsClient) Get(ctx context.Context, planeName string, c } // getCreateRequest creates the Get request. -func (client *AwsCredentialsClient) getCreateRequest(ctx context.Context, planeName string, credentialName string, options *AwsCredentialsClientGetOptions) (*policy.Request, error) { +func (client *AwsCredentialsClient) getCreateRequest(ctx context.Context, planeName string, credentialName string, _ *AwsCredentialsClientGetOptions) (*policy.Request, error) { urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { @@ -204,30 +213,25 @@ func (client *AwsCredentialsClient) NewListPager(planeName string, options *AwsC return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *AwsCredentialsClientListResponse) (AwsCredentialsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, planeName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return AwsCredentialsClientListResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AwsCredentialsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, planeName, options) + }, nil) if err != nil { return AwsCredentialsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AwsCredentialsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *AwsCredentialsClient) listCreateRequest(ctx context.Context, planeName string, options *AwsCredentialsClientListOptions) (*policy.Request, error) { +func (client *AwsCredentialsClient) listCreateRequest(ctx context.Context, planeName string, _ *AwsCredentialsClientListOptions) (*policy.Request, error) { urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -260,6 +264,10 @@ func (client *AwsCredentialsClient) listHandleResponse(resp *http.Response) (Aws // - options - AwsCredentialsClientUpdateOptions contains the optional parameters for the AwsCredentialsClient.Update method. func (client *AwsCredentialsClient) Update(ctx context.Context, planeName string, credentialName string, properties AwsCredentialResourceTagsUpdate, options *AwsCredentialsClientUpdateOptions) (AwsCredentialsClientUpdateResponse, error) { var err error + const operationName = "AwsCredentialsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, planeName, credentialName, properties, options) if err != nil { return AwsCredentialsClientUpdateResponse{}, err @@ -277,7 +285,7 @@ func (client *AwsCredentialsClient) Update(ctx context.Context, planeName string } // updateCreateRequest creates the Update request. -func (client *AwsCredentialsClient) updateCreateRequest(ctx context.Context, planeName string, credentialName string, properties AwsCredentialResourceTagsUpdate, options *AwsCredentialsClientUpdateOptions) (*policy.Request, error) { +func (client *AwsCredentialsClient) updateCreateRequest(ctx context.Context, planeName string, credentialName string, properties AwsCredentialResourceTagsUpdate, _ *AwsCredentialsClientUpdateOptions) (*policy.Request, error) { urlPath := "/planes/aws/{planeName}/providers/System.AWS/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { @@ -295,7 +303,7 @@ func (client *AwsCredentialsClient) updateCreateRequest(ctx context.Context, pla if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } // updateHandleResponse handles the Update response. diff --git a/pkg/ucp/api/v20231001preview/zz_generated_awsplanes_client.go b/pkg/ucp/api/v20231001preview/zz_generated_awsplanes_client.go index 0893b35077..18444b3475 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_awsplanes_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_awsplanes_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -29,7 +26,7 @@ type AwsPlanesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAwsPlanesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AwsPlanesClient, error) { - cl, err := arm.NewClient(moduleName+".AwsPlanesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -55,10 +52,13 @@ func (client *AwsPlanesClient) BeginCreateOrUpdate(ctx context.Context, planeNam } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AwsPlanesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[AwsPlanesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AwsPlanesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -68,6 +68,10 @@ func (client *AwsPlanesClient) BeginCreateOrUpdate(ctx context.Context, planeNam // Generated from API version 2023-10-01-preview func (client *AwsPlanesClient) createOrUpdate(ctx context.Context, planeName string, resource AwsPlaneResource, options *AwsPlanesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "AwsPlanesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, planeName, resource, options) if err != nil { return nil, err @@ -84,7 +88,7 @@ func (client *AwsPlanesClient) createOrUpdate(ctx context.Context, planeName str } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AwsPlanesClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resource AwsPlaneResource, options *AwsPlanesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AwsPlanesClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resource AwsPlaneResource, _ *AwsPlanesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/planes/aws/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -101,7 +105,7 @@ func (client *AwsPlanesClient) createOrUpdateCreateRequest(ctx context.Context, if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a plane @@ -118,10 +122,13 @@ func (client *AwsPlanesClient) BeginDelete(ctx context.Context, planeName string } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AwsPlanesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[AwsPlanesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AwsPlanesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -131,6 +138,10 @@ func (client *AwsPlanesClient) BeginDelete(ctx context.Context, planeName string // Generated from API version 2023-10-01-preview func (client *AwsPlanesClient) deleteOperation(ctx context.Context, planeName string, options *AwsPlanesClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "AwsPlanesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, planeName, options) if err != nil { return nil, err @@ -147,7 +158,7 @@ func (client *AwsPlanesClient) deleteOperation(ctx context.Context, planeName st } // deleteCreateRequest creates the Delete request. -func (client *AwsPlanesClient) deleteCreateRequest(ctx context.Context, planeName string, options *AwsPlanesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *AwsPlanesClient) deleteCreateRequest(ctx context.Context, planeName string, _ *AwsPlanesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/planes/aws/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -172,6 +183,10 @@ func (client *AwsPlanesClient) deleteCreateRequest(ctx context.Context, planeNam // - options - AwsPlanesClientGetOptions contains the optional parameters for the AwsPlanesClient.Get method. func (client *AwsPlanesClient) Get(ctx context.Context, planeName string, options *AwsPlanesClientGetOptions) (AwsPlanesClientGetResponse, error) { var err error + const operationName = "AwsPlanesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, planeName, options) if err != nil { return AwsPlanesClientGetResponse{}, err @@ -189,7 +204,7 @@ func (client *AwsPlanesClient) Get(ctx context.Context, planeName string, option } // getCreateRequest creates the Get request. -func (client *AwsPlanesClient) getCreateRequest(ctx context.Context, planeName string, options *AwsPlanesClientGetOptions) (*policy.Request, error) { +func (client *AwsPlanesClient) getCreateRequest(ctx context.Context, planeName string, _ *AwsPlanesClientGetOptions) (*policy.Request, error) { urlPath := "/planes/aws/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -225,30 +240,25 @@ func (client *AwsPlanesClient) NewListPager(options *AwsPlanesClientListOptions) return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *AwsPlanesClientListResponse) (AwsPlanesClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AwsPlanesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return AwsPlanesClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AwsPlanesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AwsPlanesClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *AwsPlanesClient) listCreateRequest(ctx context.Context, options *AwsPlanesClientListOptions) (*policy.Request, error) { +func (client *AwsPlanesClient) listCreateRequest(ctx context.Context, _ *AwsPlanesClientListOptions) (*policy.Request, error) { urlPath := "/planes/aws" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -285,10 +295,13 @@ func (client *AwsPlanesClient) BeginUpdate(ctx context.Context, planeName string } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AwsPlanesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[AwsPlanesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AwsPlanesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -298,6 +311,10 @@ func (client *AwsPlanesClient) BeginUpdate(ctx context.Context, planeName string // Generated from API version 2023-10-01-preview func (client *AwsPlanesClient) update(ctx context.Context, planeName string, properties AwsPlaneResourceTagsUpdate, options *AwsPlanesClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "AwsPlanesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, planeName, properties, options) if err != nil { return nil, err @@ -314,7 +331,7 @@ func (client *AwsPlanesClient) update(ctx context.Context, planeName string, pro } // updateCreateRequest creates the Update request. -func (client *AwsPlanesClient) updateCreateRequest(ctx context.Context, planeName string, properties AwsPlaneResourceTagsUpdate, options *AwsPlanesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *AwsPlanesClient) updateCreateRequest(ctx context.Context, planeName string, properties AwsPlaneResourceTagsUpdate, _ *AwsPlanesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/planes/aws/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -331,6 +348,6 @@ func (client *AwsPlanesClient) updateCreateRequest(ctx context.Context, planeNam if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go b/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go index b9f110905d..10e95efd04 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_azurecredentials_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -29,7 +26,7 @@ type AzureCredentialsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAzureCredentialsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureCredentialsClient, error) { - cl, err := arm.NewClient(moduleName+".AzureCredentialsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -50,6 +47,10 @@ func NewAzureCredentialsClient(credential azcore.TokenCredential, options *arm.C // method. func (client *AzureCredentialsClient) CreateOrUpdate(ctx context.Context, planeName string, credentialName string, resource AzureCredentialResource, options *AzureCredentialsClientCreateOrUpdateOptions) (AzureCredentialsClientCreateOrUpdateResponse, error) { var err error + const operationName = "AzureCredentialsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, planeName, credentialName, resource, options) if err != nil { return AzureCredentialsClientCreateOrUpdateResponse{}, err @@ -67,7 +68,7 @@ func (client *AzureCredentialsClient) CreateOrUpdate(ctx context.Context, planeN } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AzureCredentialsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, credentialName string, resource AzureCredentialResource, options *AzureCredentialsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AzureCredentialsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, credentialName string, resource AzureCredentialResource, _ *AzureCredentialsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { @@ -85,7 +86,7 @@ func (client *AzureCredentialsClient) createOrUpdateCreateRequest(ctx context.Co if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -106,6 +107,10 @@ func (client *AzureCredentialsClient) createOrUpdateHandleResponse(resp *http.Re // - options - AzureCredentialsClientDeleteOptions contains the optional parameters for the AzureCredentialsClient.Delete method. func (client *AzureCredentialsClient) Delete(ctx context.Context, planeName string, credentialName string, options *AzureCredentialsClientDeleteOptions) (AzureCredentialsClientDeleteResponse, error) { var err error + const operationName = "AzureCredentialsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, planeName, credentialName, options) if err != nil { return AzureCredentialsClientDeleteResponse{}, err @@ -122,7 +127,7 @@ func (client *AzureCredentialsClient) Delete(ctx context.Context, planeName stri } // deleteCreateRequest creates the Delete request. -func (client *AzureCredentialsClient) deleteCreateRequest(ctx context.Context, planeName string, credentialName string, options *AzureCredentialsClientDeleteOptions) (*policy.Request, error) { +func (client *AzureCredentialsClient) deleteCreateRequest(ctx context.Context, planeName string, credentialName string, _ *AzureCredentialsClientDeleteOptions) (*policy.Request, error) { urlPath := "/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { @@ -149,6 +154,10 @@ func (client *AzureCredentialsClient) deleteCreateRequest(ctx context.Context, p // - options - AzureCredentialsClientGetOptions contains the optional parameters for the AzureCredentialsClient.Get method. func (client *AzureCredentialsClient) Get(ctx context.Context, planeName string, credentialName string, options *AzureCredentialsClientGetOptions) (AzureCredentialsClientGetResponse, error) { var err error + const operationName = "AzureCredentialsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, planeName, credentialName, options) if err != nil { return AzureCredentialsClientGetResponse{}, err @@ -166,7 +175,7 @@ func (client *AzureCredentialsClient) Get(ctx context.Context, planeName string, } // getCreateRequest creates the Get request. -func (client *AzureCredentialsClient) getCreateRequest(ctx context.Context, planeName string, credentialName string, options *AzureCredentialsClientGetOptions) (*policy.Request, error) { +func (client *AzureCredentialsClient) getCreateRequest(ctx context.Context, planeName string, credentialName string, _ *AzureCredentialsClientGetOptions) (*policy.Request, error) { urlPath := "/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { @@ -205,30 +214,25 @@ func (client *AzureCredentialsClient) NewListPager(planeName string, options *Az return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *AzureCredentialsClientListResponse) (AzureCredentialsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, planeName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return AzureCredentialsClientListResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzureCredentialsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, planeName, options) + }, nil) if err != nil { return AzureCredentialsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AzureCredentialsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *AzureCredentialsClient) listCreateRequest(ctx context.Context, planeName string, options *AzureCredentialsClientListOptions) (*policy.Request, error) { +func (client *AzureCredentialsClient) listCreateRequest(ctx context.Context, planeName string, _ *AzureCredentialsClientListOptions) (*policy.Request, error) { urlPath := "/planes/azure/{planeName}/providers/System.Azure/credentials" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -261,6 +265,10 @@ func (client *AzureCredentialsClient) listHandleResponse(resp *http.Response) (A // - options - AzureCredentialsClientUpdateOptions contains the optional parameters for the AzureCredentialsClient.Update method. func (client *AzureCredentialsClient) Update(ctx context.Context, planeName string, credentialName string, properties AzureCredentialResourceTagsUpdate, options *AzureCredentialsClientUpdateOptions) (AzureCredentialsClientUpdateResponse, error) { var err error + const operationName = "AzureCredentialsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, planeName, credentialName, properties, options) if err != nil { return AzureCredentialsClientUpdateResponse{}, err @@ -278,7 +286,7 @@ func (client *AzureCredentialsClient) Update(ctx context.Context, planeName stri } // updateCreateRequest creates the Update request. -func (client *AzureCredentialsClient) updateCreateRequest(ctx context.Context, planeName string, credentialName string, properties AzureCredentialResourceTagsUpdate, options *AzureCredentialsClientUpdateOptions) (*policy.Request, error) { +func (client *AzureCredentialsClient) updateCreateRequest(ctx context.Context, planeName string, credentialName string, properties AzureCredentialResourceTagsUpdate, _ *AzureCredentialsClientUpdateOptions) (*policy.Request, error) { urlPath := "/planes/azure/{planeName}/providers/System.Azure/credentials/{credentialName}" urlPath = strings.ReplaceAll(urlPath, "{planeName}", planeName) if credentialName == "" { @@ -296,7 +304,7 @@ func (client *AzureCredentialsClient) updateCreateRequest(ctx context.Context, p if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } // updateHandleResponse handles the Update response. diff --git a/pkg/ucp/api/v20231001preview/zz_generated_azureplanes_client.go b/pkg/ucp/api/v20231001preview/zz_generated_azureplanes_client.go index 6c84d1a79d..aa247ba136 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_azureplanes_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_azureplanes_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -29,7 +26,7 @@ type AzurePlanesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewAzurePlanesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AzurePlanesClient, error) { - cl, err := arm.NewClient(moduleName+".AzurePlanesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -55,10 +52,13 @@ func (client *AzurePlanesClient) BeginCreateOrUpdate(ctx context.Context, planeN } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzurePlanesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[AzurePlanesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzurePlanesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -68,6 +68,10 @@ func (client *AzurePlanesClient) BeginCreateOrUpdate(ctx context.Context, planeN // Generated from API version 2023-10-01-preview func (client *AzurePlanesClient) createOrUpdate(ctx context.Context, planeName string, resource AzurePlaneResource, options *AzurePlanesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "AzurePlanesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, planeName, resource, options) if err != nil { return nil, err @@ -84,7 +88,7 @@ func (client *AzurePlanesClient) createOrUpdate(ctx context.Context, planeName s } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AzurePlanesClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resource AzurePlaneResource, options *AzurePlanesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AzurePlanesClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resource AzurePlaneResource, _ *AzurePlanesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/planes/azure/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -101,7 +105,7 @@ func (client *AzurePlanesClient) createOrUpdateCreateRequest(ctx context.Context if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a plane @@ -118,10 +122,13 @@ func (client *AzurePlanesClient) BeginDelete(ctx context.Context, planeName stri } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzurePlanesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[AzurePlanesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzurePlanesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -131,6 +138,10 @@ func (client *AzurePlanesClient) BeginDelete(ctx context.Context, planeName stri // Generated from API version 2023-10-01-preview func (client *AzurePlanesClient) deleteOperation(ctx context.Context, planeName string, options *AzurePlanesClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "AzurePlanesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, planeName, options) if err != nil { return nil, err @@ -147,7 +158,7 @@ func (client *AzurePlanesClient) deleteOperation(ctx context.Context, planeName } // deleteCreateRequest creates the Delete request. -func (client *AzurePlanesClient) deleteCreateRequest(ctx context.Context, planeName string, options *AzurePlanesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *AzurePlanesClient) deleteCreateRequest(ctx context.Context, planeName string, _ *AzurePlanesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/planes/azure/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -172,6 +183,10 @@ func (client *AzurePlanesClient) deleteCreateRequest(ctx context.Context, planeN // - options - AzurePlanesClientGetOptions contains the optional parameters for the AzurePlanesClient.Get method. func (client *AzurePlanesClient) Get(ctx context.Context, planeName string, options *AzurePlanesClientGetOptions) (AzurePlanesClientGetResponse, error) { var err error + const operationName = "AzurePlanesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, planeName, options) if err != nil { return AzurePlanesClientGetResponse{}, err @@ -189,7 +204,7 @@ func (client *AzurePlanesClient) Get(ctx context.Context, planeName string, opti } // getCreateRequest creates the Get request. -func (client *AzurePlanesClient) getCreateRequest(ctx context.Context, planeName string, options *AzurePlanesClientGetOptions) (*policy.Request, error) { +func (client *AzurePlanesClient) getCreateRequest(ctx context.Context, planeName string, _ *AzurePlanesClientGetOptions) (*policy.Request, error) { urlPath := "/planes/azure/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -225,30 +240,25 @@ func (client *AzurePlanesClient) NewListPager(options *AzurePlanesClientListOpti return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *AzurePlanesClientListResponse) (AzurePlanesClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AzurePlanesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return AzurePlanesClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzurePlanesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return AzurePlanesClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *AzurePlanesClient) listCreateRequest(ctx context.Context, options *AzurePlanesClientListOptions) (*policy.Request, error) { +func (client *AzurePlanesClient) listCreateRequest(ctx context.Context, _ *AzurePlanesClientListOptions) (*policy.Request, error) { urlPath := "/planes/azure" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -285,10 +295,13 @@ func (client *AzurePlanesClient) BeginUpdate(ctx context.Context, planeName stri } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzurePlanesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[AzurePlanesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AzurePlanesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -298,6 +311,10 @@ func (client *AzurePlanesClient) BeginUpdate(ctx context.Context, planeName stri // Generated from API version 2023-10-01-preview func (client *AzurePlanesClient) update(ctx context.Context, planeName string, properties AzurePlaneResourceTagsUpdate, options *AzurePlanesClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "AzurePlanesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, planeName, properties, options) if err != nil { return nil, err @@ -314,7 +331,7 @@ func (client *AzurePlanesClient) update(ctx context.Context, planeName string, p } // updateCreateRequest creates the Update request. -func (client *AzurePlanesClient) updateCreateRequest(ctx context.Context, planeName string, properties AzurePlaneResourceTagsUpdate, options *AzurePlanesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *AzurePlanesClient) updateCreateRequest(ctx context.Context, planeName string, properties AzurePlaneResourceTagsUpdate, _ *AzurePlanesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/planes/azure/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -331,6 +348,6 @@ func (client *AzurePlanesClient) updateCreateRequest(ctx context.Context, planeN if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_client_factory.go b/pkg/ucp/api/v20231001preview/zz_generated_client_factory.go index 0c94e56ab6..7c853971e7 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_client_factory.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_client_factory.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -15,8 +12,7 @@ import ( // ClientFactory is a client factory used to create any client in this module. // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -24,73 +20,96 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory( credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - credential: credential, - options: options.Clone(), + internal: internal, }, nil } +// NewAPIVersionsClient creates a new instance of APIVersionsClient. func (c *ClientFactory) NewAPIVersionsClient() *APIVersionsClient { - subClient, _ := NewAPIVersionsClient(c.credential, c.options) - return subClient + return &APIVersionsClient{ + internal: c.internal, + } } +// NewAwsCredentialsClient creates a new instance of AwsCredentialsClient. func (c *ClientFactory) NewAwsCredentialsClient() *AwsCredentialsClient { - subClient, _ := NewAwsCredentialsClient(c.credential, c.options) - return subClient + return &AwsCredentialsClient{ + internal: c.internal, + } } +// NewAwsPlanesClient creates a new instance of AwsPlanesClient. func (c *ClientFactory) NewAwsPlanesClient() *AwsPlanesClient { - subClient, _ := NewAwsPlanesClient(c.credential, c.options) - return subClient + return &AwsPlanesClient{ + internal: c.internal, + } } +// NewAzureCredentialsClient creates a new instance of AzureCredentialsClient. func (c *ClientFactory) NewAzureCredentialsClient() *AzureCredentialsClient { - subClient, _ := NewAzureCredentialsClient(c.credential, c.options) - return subClient + return &AzureCredentialsClient{ + internal: c.internal, + } } +// NewAzurePlanesClient creates a new instance of AzurePlanesClient. func (c *ClientFactory) NewAzurePlanesClient() *AzurePlanesClient { - subClient, _ := NewAzurePlanesClient(c.credential, c.options) - return subClient + return &AzurePlanesClient{ + internal: c.internal, + } } +// NewLocationsClient creates a new instance of LocationsClient. func (c *ClientFactory) NewLocationsClient() *LocationsClient { - subClient, _ := NewLocationsClient(c.credential, c.options) - return subClient + return &LocationsClient{ + internal: c.internal, + } } +// NewPlanesClient creates a new instance of PlanesClient. func (c *ClientFactory) NewPlanesClient() *PlanesClient { - subClient, _ := NewPlanesClient(c.credential, c.options) - return subClient + return &PlanesClient{ + internal: c.internal, + } } +// NewRadiusPlanesClient creates a new instance of RadiusPlanesClient. func (c *ClientFactory) NewRadiusPlanesClient() *RadiusPlanesClient { - subClient, _ := NewRadiusPlanesClient(c.credential, c.options) - return subClient + return &RadiusPlanesClient{ + internal: c.internal, + } } +// NewResourceGroupsClient creates a new instance of ResourceGroupsClient. func (c *ClientFactory) NewResourceGroupsClient() *ResourceGroupsClient { - subClient, _ := NewResourceGroupsClient(c.credential, c.options) - return subClient + return &ResourceGroupsClient{ + internal: c.internal, + } } +// NewResourceProvidersClient creates a new instance of ResourceProvidersClient. func (c *ClientFactory) NewResourceProvidersClient() *ResourceProvidersClient { - subClient, _ := NewResourceProvidersClient(c.credential, c.options) - return subClient + return &ResourceProvidersClient{ + internal: c.internal, + } } +// NewResourceTypesClient creates a new instance of ResourceTypesClient. func (c *ClientFactory) NewResourceTypesClient() *ResourceTypesClient { - subClient, _ := NewResourceTypesClient(c.credential, c.options) - return subClient + return &ResourceTypesClient{ + internal: c.internal, + } } +// NewResourcesClient creates a new instance of ResourcesClient. func (c *ClientFactory) NewResourcesClient() *ResourcesClient { - subClient, _ := NewResourcesClient(c.credential, c.options) - return subClient + return &ResourcesClient{ + internal: c.internal, + } } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_constants.go b/pkg/ucp/api/v20231001preview/zz_generated_constants.go index 58588d91ac..d33f42c138 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_constants.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_constants.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -8,7 +5,7 @@ package v20231001preview const ( - moduleName = "v20231001preview" + moduleName = "github.com/radius-project/radius/pkg/ucp/api/v20231001preview" moduleVersion = "v0.0.1" ) @@ -16,9 +13,9 @@ const ( type AWSCredentialKind string const ( - // AWSCredentialKindAccessKey - The AWS Access Key credential +// AWSCredentialKindAccessKey - The AWS Access Key credential AWSCredentialKindAccessKey AWSCredentialKind = "AccessKey" - // AWSCredentialKindIRSA - AWS IAM roles for service accounts. For more information, please see: https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html +// AWSCredentialKindIRSA - AWS IAM roles for service accounts. For more information, please see: https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html AWSCredentialKindIRSA AWSCredentialKind = "IRSA" ) @@ -34,9 +31,9 @@ func PossibleAWSCredentialKindValues() []AWSCredentialKind { type AzureCredentialKind string const ( - // AzureCredentialKindServicePrincipal - The Service Principal Credential +// AzureCredentialKindServicePrincipal - The Service Principal Credential AzureCredentialKindServicePrincipal AzureCredentialKind = "ServicePrincipal" - // AzureCredentialKindWorkloadIdentity - The Workload Identity Credential +// AzureCredentialKindWorkloadIdentity - The Workload Identity Credential AzureCredentialKindWorkloadIdentity AzureCredentialKind = "WorkloadIdentity" ) @@ -72,7 +69,7 @@ func PossibleCreatedByTypeValues() []CreatedByType { type CredentialStorageKind string const ( - // CredentialStorageKindInternal - Internal credential storage +// CredentialStorageKindInternal - Internal credential storage CredentialStorageKindInternal CredentialStorageKind = "Internal" CredentialStorageKindString CredentialStorageKind = "string" ) @@ -89,21 +86,21 @@ func PossibleCredentialStorageKindValues() []CredentialStorageKind { type ProvisioningState string const ( - // ProvisioningStateAccepted - The resource create request has been accepted +// ProvisioningStateAccepted - The resource create request has been accepted ProvisioningStateAccepted ProvisioningState = "Accepted" - // ProvisioningStateCanceled - The resource provisioning has been canceled +// ProvisioningStateCanceled - The resource provisioning has been canceled ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreating - The resource is being created +// ProvisioningStateCreating - The resource is being created ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting - The resource is being deleted +// ProvisioningStateDeleting - The resource is being deleted ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed - The resource provisioning has failed +// ProvisioningStateFailed - The resource provisioning has failed ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateProvisioning - The resource is being provisioned +// ProvisioningStateProvisioning - The resource is being provisioned ProvisioningStateProvisioning ProvisioningState = "Provisioning" - // ProvisioningStateSucceeded - The resource has been successfully provisioned +// ProvisioningStateSucceeded - The resource has been successfully provisioned ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating - The resource is being updated +// ProvisioningStateUpdating - The resource is being updated ProvisioningStateUpdating ProvisioningState = "Updating" ) diff --git a/pkg/ucp/api/v20231001preview/zz_generated_interfaces.go b/pkg/ucp/api/v20231001preview/zz_generated_interfaces.go index 3ace1ee706..5a6e4bf4d0 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_interfaces.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_interfaces.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. diff --git a/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go b/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go index 01e75c698f..69cd3764d6 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_locations_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -29,7 +26,7 @@ type LocationsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewLocationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationsClient, error) { - cl, err := arm.NewClient(moduleName+".LocationsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -58,10 +55,13 @@ func (client *LocationsClient) BeginCreateOrUpdate(ctx context.Context, planeNam } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LocationsClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[LocationsClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[LocationsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -72,6 +72,10 @@ func (client *LocationsClient) BeginCreateOrUpdate(ctx context.Context, planeNam // Generated from API version 2023-10-01-preview func (client *LocationsClient) createOrUpdate(ctx context.Context, planeName string, resourceProviderName string, locationName string, resource LocationResource, options *LocationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "LocationsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, planeName, resourceProviderName, locationName, resource, options) if err != nil { return nil, err @@ -88,7 +92,7 @@ func (client *LocationsClient) createOrUpdate(ctx context.Context, planeName str } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *LocationsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, locationName string, resource LocationResource, options *LocationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *LocationsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, locationName string, resource LocationResource, _ *LocationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations/{locationName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -113,7 +117,7 @@ func (client *LocationsClient) createOrUpdateCreateRequest(ctx context.Context, if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a location. The location resource represents a logical location where the resource provider operates. @@ -132,10 +136,13 @@ func (client *LocationsClient) BeginDelete(ctx context.Context, planeName string } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[LocationsClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[LocationsClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[LocationsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -145,6 +152,10 @@ func (client *LocationsClient) BeginDelete(ctx context.Context, planeName string // Generated from API version 2023-10-01-preview func (client *LocationsClient) deleteOperation(ctx context.Context, planeName string, resourceProviderName string, locationName string, options *LocationsClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "LocationsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, planeName, resourceProviderName, locationName, options) if err != nil { return nil, err @@ -161,7 +172,7 @@ func (client *LocationsClient) deleteOperation(ctx context.Context, planeName st } // deleteCreateRequest creates the Delete request. -func (client *LocationsClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, locationName string, options *LocationsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *LocationsClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, locationName string, _ *LocationsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations/{locationName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -196,6 +207,10 @@ func (client *LocationsClient) deleteCreateRequest(ctx context.Context, planeNam // - options - LocationsClientGetOptions contains the optional parameters for the LocationsClient.Get method. func (client *LocationsClient) Get(ctx context.Context, planeName string, resourceProviderName string, locationName string, options *LocationsClientGetOptions) (LocationsClientGetResponse, error) { var err error + const operationName = "LocationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, planeName, resourceProviderName, locationName, options) if err != nil { return LocationsClientGetResponse{}, err @@ -213,7 +228,7 @@ func (client *LocationsClient) Get(ctx context.Context, planeName string, resour } // getCreateRequest creates the Get request. -func (client *LocationsClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, locationName string, options *LocationsClientGetOptions) (*policy.Request, error) { +func (client *LocationsClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, locationName string, _ *LocationsClientGetOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations/{locationName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -259,30 +274,25 @@ func (client *LocationsClient) NewListPager(planeName string, resourceProviderNa return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *LocationsClientListResponse) (LocationsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, planeName, resourceProviderName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "LocationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, planeName, resourceProviderName, options) + }, nil) if err != nil { return LocationsClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return LocationsClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return LocationsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *LocationsClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *LocationsClientListOptions) (*policy.Request, error) { +func (client *LocationsClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, _ *LocationsClientListOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/locations" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") diff --git a/pkg/ucp/api/v20231001preview/zz_generated_models.go b/pkg/ucp/api/v20231001preview/zz_generated_models.go index 0edd7cf8b4..60d60656dd 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_models.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_models.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -11,53 +8,53 @@ import "time" // APIVersionProperties - The properties of an API version. type APIVersionProperties struct { - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } // APIVersionResource - The resource type for defining an API version of a resource type supported by the containing resource // provider. type APIVersionResource struct { - // The resource-specific properties for this resource. +// The resource-specific properties for this resource. Properties *APIVersionProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // APIVersionResourceListResult - The response of a ApiVersionResource list operation. type APIVersionResourceListResult struct { - // REQUIRED; The ApiVersionResource items on this page +// REQUIRED; The ApiVersionResource items on this page Value []*APIVersionResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // AwsAccessKeyCredentialProperties - AWS credential properties for Access Key type AwsAccessKeyCredentialProperties struct { - // REQUIRED; Access key ID for AWS identity +// REQUIRED; Access key ID for AWS identity AccessKeyID *string - // REQUIRED; The AWS credential kind +// REQUIRED; The AWS credential kind Kind *AWSCredentialKind - // REQUIRED; Secret Access Key for AWS identity +// REQUIRED; Secret Access Key for AWS identity SecretAccessKey *string - // REQUIRED; The storage properties +// REQUIRED; The storage properties Storage CredentialStoragePropertiesClassification - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } @@ -71,10 +68,10 @@ func (a *AwsAccessKeyCredentialProperties) GetAwsCredentialProperties() *AwsCred // AwsCredentialProperties - AWS Credential properties type AwsCredentialProperties struct { - // REQUIRED; The AWS credential kind +// REQUIRED; The AWS credential kind Kind *AWSCredentialKind - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } @@ -84,55 +81,55 @@ func (a *AwsCredentialProperties) GetAwsCredentialProperties() *AwsCredentialPro // AwsCredentialResource - Concrete tracked resource types can be created by aliasing this type using a specific property // type. type AwsCredentialResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties AwsCredentialPropertiesClassification - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // AwsCredentialResourceListResult - The response of a AwsCredentialResource list operation. type AwsCredentialResourceListResult struct { - // REQUIRED; The AwsCredentialResource items on this page +// REQUIRED; The AwsCredentialResource items on this page Value []*AwsCredentialResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // AwsCredentialResourceTagsUpdate - The type used for updating tags in AwsCredentialResource resources. type AwsCredentialResourceTagsUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string } // AwsIRSACredentialProperties - AWS credential properties for IAM Roles for Service Accounts (IRSA) type AwsIRSACredentialProperties struct { - // REQUIRED; The AWS credential kind +// REQUIRED; The AWS credential kind Kind *AWSCredentialKind - // REQUIRED; RoleARN for AWS IRSA identity +// REQUIRED; RoleARN for AWS IRSA identity RoleARN *string - // REQUIRED; The storage properties +// REQUIRED; The storage properties Storage CredentialStoragePropertiesClassification - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } @@ -146,55 +143,55 @@ func (a *AwsIRSACredentialProperties) GetAwsCredentialProperties() *AwsCredentia // AwsPlaneResource - The AWS plane resource type AwsPlaneResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *AwsPlaneResourceProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // AwsPlaneResourceListResult - The response of a AwsPlaneResource list operation. type AwsPlaneResourceListResult struct { - // REQUIRED; The AwsPlaneResource items on this page +// REQUIRED; The AwsPlaneResource items on this page Value []*AwsPlaneResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // AwsPlaneResourceProperties - The Plane properties. type AwsPlaneResourceProperties struct { - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } // AwsPlaneResourceTagsUpdate - The type used for updating tags in AwsPlaneResource resources. type AwsPlaneResourceTagsUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string } // AzureCredentialProperties - The base properties of Azure Credential type AzureCredentialProperties struct { - // REQUIRED; The kind of Azure credential +// REQUIRED; The kind of Azure credential Kind *AzureCredentialKind - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } @@ -203,109 +200,109 @@ func (a *AzureCredentialProperties) GetAzureCredentialProperties() *AzureCredent // AzureCredentialResource - Represents Azure Credential Resource type AzureCredentialResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties AzureCredentialPropertiesClassification - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // AzureCredentialResourceListResult - The response of a AzureCredentialResource list operation. type AzureCredentialResourceListResult struct { - // REQUIRED; The AzureCredentialResource items on this page +// REQUIRED; The AzureCredentialResource items on this page Value []*AzureCredentialResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // AzureCredentialResourceTagsUpdate - The type used for updating tags in AzureCredentialResource resources. type AzureCredentialResourceTagsUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string } // AzurePlaneResource - The Azure plane resource. type AzurePlaneResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *AzurePlaneResourceProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // AzurePlaneResourceListResult - The response of a AzurePlaneResource list operation. type AzurePlaneResourceListResult struct { - // REQUIRED; The AzurePlaneResource items on this page +// REQUIRED; The AzurePlaneResource items on this page Value []*AzurePlaneResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // AzurePlaneResourceProperties - The Plane properties. type AzurePlaneResourceProperties struct { - // REQUIRED; The URL used to proxy requests. +// REQUIRED; The URL used to proxy requests. URL *string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } // AzurePlaneResourceTagsUpdate - The type used for updating tags in AzurePlaneResource resources. type AzurePlaneResourceTagsUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string } // AzureServicePrincipalProperties - The properties of Azure Service Principal credential storage type AzureServicePrincipalProperties struct { - // REQUIRED; clientId for ServicePrincipal +// REQUIRED; clientId for ServicePrincipal ClientID *string - // REQUIRED; secret for ServicePrincipal +// REQUIRED; secret for ServicePrincipal ClientSecret *string - // REQUIRED; The kind of Azure credential +// REQUIRED; The kind of Azure credential Kind *AzureCredentialKind - // REQUIRED; The storage properties +// REQUIRED; The storage properties Storage CredentialStoragePropertiesClassification - // REQUIRED; tenantId for ServicePrincipal +// REQUIRED; tenantId for ServicePrincipal TenantID *string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } @@ -319,19 +316,19 @@ func (a *AzureServicePrincipalProperties) GetAzureCredentialProperties() *AzureC // AzureWorkloadIdentityProperties - The properties of Azure Workload Identity credential storage type AzureWorkloadIdentityProperties struct { - // REQUIRED; clientId for WorkloadIdentity +// REQUIRED; clientId for WorkloadIdentity ClientID *string - // REQUIRED; The kind of Azure credential +// REQUIRED; The kind of Azure credential Kind *AzureCredentialKind - // REQUIRED; The storage properties +// REQUIRED; The storage properties Storage CredentialStoragePropertiesClassification - // REQUIRED; tenantId for WorkloadIdentity +// REQUIRED; tenantId for WorkloadIdentity TenantID *string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } @@ -346,25 +343,25 @@ func (a *AzureWorkloadIdentityProperties) GetAzureCredentialProperties() *AzureC // ComponentsKhmx01SchemasGenericresourceAllof0 - Concrete proxy resource types can be created by aliasing this type using // a specific property type. type ComponentsKhmx01SchemasGenericresourceAllof0 struct { - // The resource-specific properties for this resource. +// The resource-specific properties for this resource. Properties map[string]any - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // CredentialStorageProperties - The base credential storage properties type CredentialStorageProperties struct { - // REQUIRED; The kind of credential storage +// REQUIRED; The kind of credential storage Kind *CredentialStorageKind } @@ -373,110 +370,110 @@ func (c *CredentialStorageProperties) GetCredentialStorageProperties() *Credenti // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. +// READ-ONLY; The additional info. Info map[string]any - // READ-ONLY; The additional info type. +// READ-ONLY; The additional info type. Type *string } // ErrorDetail - The error detail. type ErrorDetail struct { - // READ-ONLY; The error additional info. +// READ-ONLY; The error additional info. AdditionalInfo []*ErrorAdditionalInfo - // READ-ONLY; The error code. +// READ-ONLY; The error code. Code *string - // READ-ONLY; The error details. +// READ-ONLY; The error details. Details []*ErrorDetail - // READ-ONLY; The error message. +// READ-ONLY; The error message. Message *string - // READ-ONLY; The error target. +// READ-ONLY; The error target. Target *string } // ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. // (This also follows the OData error response format.). type ErrorResponse struct { - // The error object. +// The error object. Error *ErrorDetail } // GenericPlaneResource - The generic representation of a plane resource type GenericPlaneResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *GenericPlaneResourceProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // GenericPlaneResourceListResult - The response of a GenericPlaneResource list operation. type GenericPlaneResourceListResult struct { - // REQUIRED; The GenericPlaneResource items on this page +// REQUIRED; The GenericPlaneResource items on this page Value []*GenericPlaneResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // GenericPlaneResourceProperties - The properties of the generic representation of a plane resource. type GenericPlaneResourceProperties struct { - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } // GenericResource - Represents resource data. type GenericResource struct { - // The resource-specific properties for this resource. +// The resource-specific properties for this resource. Properties map[string]any - // READ-ONLY; The name of resource +// READ-ONLY; The name of resource Name *string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // GenericResourceListResult - The response of a GenericResource list operation. type GenericResourceListResult struct { - // REQUIRED; The GenericResource items on this page +// REQUIRED; The GenericResource items on this page Value []*GenericResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // InternalCredentialStorageProperties - Internal credential storage properties type InternalCredentialStorageProperties struct { - // REQUIRED; The kind of credential storage +// REQUIRED; The kind of credential storage Kind *CredentialStorageKind - // READ-ONLY; The name of secret stored. +// READ-ONLY; The name of secret stored. SecretName *string } @@ -489,326 +486,326 @@ func (i *InternalCredentialStorageProperties) GetCredentialStorageProperties() * // LocationProperties - The properties of a location. type LocationProperties struct { - // Address of a resource provider implementation. +// Address of a resource provider implementation. Address *string - // Configuration for resource types supported by the location. +// Configuration for resource types supported by the location. ResourceTypes map[string]*LocationResourceType - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } // LocationResource - The resource type for defining a location of the containing resource provider. The location resource // represents a logical location where the resource provider operates. type LocationResource struct { - // The resource-specific properties for this resource. +// The resource-specific properties for this resource. Properties *LocationProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // LocationResourceListResult - The response of a LocationResource list operation. type LocationResourceListResult struct { - // REQUIRED; The LocationResource items on this page +// REQUIRED; The LocationResource items on this page Value []*LocationResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // LocationResourceType - The configuration for a resource type in a specific location. type LocationResourceType struct { - // The configuration for API versions of a resource type supported by the location. +// The configuration for API versions of a resource type supported by the location. APIVersions map[string]map[string]any } // PagedResourceProviderSummary - Paged collection of ResourceProviderSummary items type PagedResourceProviderSummary struct { - // REQUIRED; The ResourceProviderSummary items on this page +// REQUIRED; The ResourceProviderSummary items on this page Value []*ResourceProviderSummary - // The link to the next page of items +// The link to the next page of items NextLink *string } // PlaneNameParameter - The Plane Name parameter. type PlaneNameParameter struct { - // REQUIRED; The name of the plane +// REQUIRED; The name of the plane PlaneName *string } // ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a // location type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // RadiusPlaneResource - The Radius plane resource. type RadiusPlaneResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *RadiusPlaneResourceProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // RadiusPlaneResourceListResult - The response of a RadiusPlaneResource list operation. type RadiusPlaneResourceListResult struct { - // REQUIRED; The RadiusPlaneResource items on this page +// REQUIRED; The RadiusPlaneResource items on this page Value []*RadiusPlaneResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // RadiusPlaneResourceProperties - The Plane properties. type RadiusPlaneResourceProperties struct { - // REQUIRED; Resource Providers for UCP Native Plane +// REQUIRED; Resource Providers for UCP Native Plane ResourceProviders map[string]*string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } // RadiusPlaneResourceTagsUpdate - The type used for updating tags in RadiusPlaneResource resources. type RadiusPlaneResourceTagsUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string } // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ResourceGroupProperties - The resource group resource properties type ResourceGroupProperties struct { - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } // ResourceGroupResource - The resource group resource type ResourceGroupResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // The resource-specific properties for this resource. +// The resource-specific properties for this resource. Properties *ResourceGroupProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ResourceGroupResourceListResult - The response of a ResourceGroupResource list operation. type ResourceGroupResourceListResult struct { - // REQUIRED; The ResourceGroupResource items on this page +// REQUIRED; The ResourceGroupResource items on this page Value []*ResourceGroupResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // ResourceGroupResourceTagsUpdate - The type used for updating tags in ResourceGroupResource resources. type ResourceGroupResourceTagsUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string } // ResourceProviderProperties - The properties of a resource provider. type ResourceProviderProperties struct { - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } // ResourceProviderResource - The resource type for defining a resource provider. type ResourceProviderResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // The resource-specific properties for this resource. +// The resource-specific properties for this resource. Properties *ResourceProviderProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ResourceProviderResourceListResult - The response of a ResourceProviderResource list operation. type ResourceProviderResourceListResult struct { - // REQUIRED; The ResourceProviderResource items on this page +// REQUIRED; The ResourceProviderResource items on this page Value []*ResourceProviderResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // ResourceProviderSummary - The summary of a resource provider configuration. This type is optimized for querying resource // providers and supported types. type ResourceProviderSummary struct { - // REQUIRED; The resource provider locations. +// REQUIRED; The resource provider locations. Locations map[string]map[string]any - // REQUIRED; The resource provider name. +// REQUIRED; The resource provider name. Name *string - // REQUIRED; The resource types supported by the resource provider. +// REQUIRED; The resource types supported by the resource provider. ResourceTypes map[string]*ResourceProviderSummaryResourceType } // ResourceProviderSummaryResourceType - A resource type and its versions. type ResourceProviderSummaryResourceType struct { - // REQUIRED; API versions supported by the resource type. +// REQUIRED; API versions supported by the resource type. APIVersions map[string]map[string]any - // The default api version for the resource type. +// The default api version for the resource type. DefaultAPIVersion *string } // ResourceTypeProperties - The properties of a resource type. type ResourceTypeProperties struct { - // The default api version for the resource type. +// The default api version for the resource type. DefaultAPIVersion *string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } // ResourceTypeResource - The resource type for defining a resource type supported by the containing resource provider. type ResourceTypeResource struct { - // The resource-specific properties for this resource. +// The resource-specific properties for this resource. Properties *ResourceTypeProperties - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ResourceTypeResourceListResult - The response of a ResourceTypeResource list operation. type ResourceTypeResourceListResult struct { - // REQUIRED; The ResourceTypeResource items on this page +// REQUIRED; The ResourceTypeResource items on this page Value []*ResourceTypeResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { - // The timestamp of resource creation (UTC). +// The timestamp of resource creation (UTC). CreatedAt *time.Time - // The identity that created the resource. +// The identity that created the resource. CreatedBy *string - // The type of identity that created the resource. +// The type of identity that created the resource. CreatedByType *CreatedByType - // The timestamp of resource last modification (UTC) +// The timestamp of resource last modification (UTC) LastModifiedAt *time.Time - // The identity that last modified the resource. +// The identity that last modified the resource. LastModifiedBy *string - // The type of identity that last modified the resource. +// The type of identity that last modified the resource. LastModifiedByType *CreatedByType } // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_models_serde.go b/pkg/ucp/api/v20231001preview/zz_generated_models_serde.go index f62e590dfd..d14f7211b2 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_models_serde.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_models_serde.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -2059,10 +2056,10 @@ func (r *ResourceTypeResourceListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -2078,7 +2075,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) @@ -2087,7 +2084,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) @@ -2161,7 +2158,7 @@ func populate(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/pkg/ucp/api/v20231001preview/zz_generated_options.go b/pkg/ucp/api/v20231001preview/zz_generated_options.go index 56132691bd..328b389ef5 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_options.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_options.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -10,13 +7,13 @@ package v20231001preview // APIVersionsClientBeginCreateOrUpdateOptions contains the optional parameters for the APIVersionsClient.BeginCreateOrUpdate // method. type APIVersionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // APIVersionsClientBeginDeleteOptions contains the optional parameters for the APIVersionsClient.BeginDelete method. type APIVersionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -59,19 +56,19 @@ type AwsCredentialsClientUpdateOptions struct { // AwsPlanesClientBeginCreateOrUpdateOptions contains the optional parameters for the AwsPlanesClient.BeginCreateOrUpdate // method. type AwsPlanesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // AwsPlanesClientBeginDeleteOptions contains the optional parameters for the AwsPlanesClient.BeginDelete method. type AwsPlanesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // AwsPlanesClientBeginUpdateOptions contains the optional parameters for the AwsPlanesClient.BeginUpdate method. type AwsPlanesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -114,19 +111,19 @@ type AzureCredentialsClientUpdateOptions struct { // AzurePlanesClientBeginCreateOrUpdateOptions contains the optional parameters for the AzurePlanesClient.BeginCreateOrUpdate // method. type AzurePlanesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // AzurePlanesClientBeginDeleteOptions contains the optional parameters for the AzurePlanesClient.BeginDelete method. type AzurePlanesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // AzurePlanesClientBeginUpdateOptions contains the optional parameters for the AzurePlanesClient.BeginUpdate method. type AzurePlanesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -143,13 +140,13 @@ type AzurePlanesClientListOptions struct { // LocationsClientBeginCreateOrUpdateOptions contains the optional parameters for the LocationsClient.BeginCreateOrUpdate // method. type LocationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // LocationsClientBeginDeleteOptions contains the optional parameters for the LocationsClient.BeginDelete method. type LocationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -171,19 +168,19 @@ type PlanesClientListPlanesOptions struct { // RadiusPlanesClientBeginCreateOrUpdateOptions contains the optional parameters for the RadiusPlanesClient.BeginCreateOrUpdate // method. type RadiusPlanesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // RadiusPlanesClientBeginDeleteOptions contains the optional parameters for the RadiusPlanesClient.BeginDelete method. type RadiusPlanesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // RadiusPlanesClientBeginUpdateOptions contains the optional parameters for the RadiusPlanesClient.BeginUpdate method. type RadiusPlanesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -226,14 +223,14 @@ type ResourceGroupsClientUpdateOptions struct { // ResourceProvidersClientBeginCreateOrUpdateOptions contains the optional parameters for the ResourceProvidersClient.BeginCreateOrUpdate // method. type ResourceProvidersClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // ResourceProvidersClientBeginDeleteOptions contains the optional parameters for the ResourceProvidersClient.BeginDelete // method. type ResourceProvidersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } @@ -262,13 +259,13 @@ type ResourceProvidersClientListProviderSummariesOptions struct { // ResourceTypesClientBeginCreateOrUpdateOptions contains the optional parameters for the ResourceTypesClient.BeginCreateOrUpdate // method. type ResourceTypesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // ResourceTypesClientBeginDeleteOptions contains the optional parameters for the ResourceTypesClient.BeginDelete method. type ResourceTypesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go b/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go index 56574fd314..3b17a63a8f 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_planes_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -26,7 +23,7 @@ type PlanesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewPlanesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PlanesClient, error) { - cl, err := arm.NewClient(moduleName+".PlanesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -46,30 +43,25 @@ func (client *PlanesClient) NewListPlanesPager(options *PlanesClientListPlanesOp return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *PlanesClientListPlanesResponse) (PlanesClientListPlanesResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listPlanesCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return PlanesClientListPlanesResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PlanesClient.NewListPlanesPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listPlanesCreateRequest(ctx, options) + }, nil) if err != nil { return PlanesClientListPlanesResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PlanesClientListPlanesResponse{}, runtime.NewResponseError(resp) - } return client.listPlanesHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listPlanesCreateRequest creates the ListPlanes request. -func (client *PlanesClient) listPlanesCreateRequest(ctx context.Context, options *PlanesClientListPlanesOptions) (*policy.Request, error) { +func (client *PlanesClient) listPlanesCreateRequest(ctx context.Context, _ *PlanesClientListPlanesOptions) (*policy.Request, error) { urlPath := "/planes" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/pkg/ucp/api/v20231001preview/zz_generated_polymorphic_helpers.go b/pkg/ucp/api/v20231001preview/zz_generated_polymorphic_helpers.go index 062b4f23b6..18232f5f30 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_polymorphic_helpers.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_polymorphic_helpers.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -10,7 +7,7 @@ package v20231001preview import "encoding/json" func unmarshalAwsCredentialPropertiesClassification(rawMsg json.RawMessage) (AwsCredentialPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -33,7 +30,7 @@ func unmarshalAwsCredentialPropertiesClassification(rawMsg json.RawMessage) (Aws } func unmarshalAzureCredentialPropertiesClassification(rawMsg json.RawMessage) (AzureCredentialPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -56,7 +53,7 @@ func unmarshalAzureCredentialPropertiesClassification(rawMsg json.RawMessage) (A } func unmarshalCredentialStoragePropertiesClassification(rawMsg json.RawMessage) (CredentialStoragePropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any diff --git a/pkg/ucp/api/v20231001preview/zz_generated_radiusplanes_client.go b/pkg/ucp/api/v20231001preview/zz_generated_radiusplanes_client.go index 6db7939e22..cc2b4d362f 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_radiusplanes_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_radiusplanes_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -29,7 +26,7 @@ type RadiusPlanesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewRadiusPlanesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*RadiusPlanesClient, error) { - cl, err := arm.NewClient(moduleName+".RadiusPlanesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -55,10 +52,13 @@ func (client *RadiusPlanesClient) BeginCreateOrUpdate(ctx context.Context, plane } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RadiusPlanesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[RadiusPlanesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RadiusPlanesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -68,6 +68,10 @@ func (client *RadiusPlanesClient) BeginCreateOrUpdate(ctx context.Context, plane // Generated from API version 2023-10-01-preview func (client *RadiusPlanesClient) createOrUpdate(ctx context.Context, planeName string, resource RadiusPlaneResource, options *RadiusPlanesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "RadiusPlanesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, planeName, resource, options) if err != nil { return nil, err @@ -84,7 +88,7 @@ func (client *RadiusPlanesClient) createOrUpdate(ctx context.Context, planeName } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *RadiusPlanesClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resource RadiusPlaneResource, options *RadiusPlanesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *RadiusPlanesClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resource RadiusPlaneResource, _ *RadiusPlanesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -101,7 +105,7 @@ func (client *RadiusPlanesClient) createOrUpdateCreateRequest(ctx context.Contex if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a plane @@ -119,10 +123,13 @@ func (client *RadiusPlanesClient) BeginDelete(ctx context.Context, planeName str } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RadiusPlanesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[RadiusPlanesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RadiusPlanesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -132,6 +139,10 @@ func (client *RadiusPlanesClient) BeginDelete(ctx context.Context, planeName str // Generated from API version 2023-10-01-preview func (client *RadiusPlanesClient) deleteOperation(ctx context.Context, planeName string, options *RadiusPlanesClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "RadiusPlanesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, planeName, options) if err != nil { return nil, err @@ -148,7 +159,7 @@ func (client *RadiusPlanesClient) deleteOperation(ctx context.Context, planeName } // deleteCreateRequest creates the Delete request. -func (client *RadiusPlanesClient) deleteCreateRequest(ctx context.Context, planeName string, options *RadiusPlanesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *RadiusPlanesClient) deleteCreateRequest(ctx context.Context, planeName string, _ *RadiusPlanesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -173,6 +184,10 @@ func (client *RadiusPlanesClient) deleteCreateRequest(ctx context.Context, plane // - options - RadiusPlanesClientGetOptions contains the optional parameters for the RadiusPlanesClient.Get method. func (client *RadiusPlanesClient) Get(ctx context.Context, planeName string, options *RadiusPlanesClientGetOptions) (RadiusPlanesClientGetResponse, error) { var err error + const operationName = "RadiusPlanesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, planeName, options) if err != nil { return RadiusPlanesClientGetResponse{}, err @@ -190,7 +205,7 @@ func (client *RadiusPlanesClient) Get(ctx context.Context, planeName string, opt } // getCreateRequest creates the Get request. -func (client *RadiusPlanesClient) getCreateRequest(ctx context.Context, planeName string, options *RadiusPlanesClientGetOptions) (*policy.Request, error) { +func (client *RadiusPlanesClient) getCreateRequest(ctx context.Context, planeName string, _ *RadiusPlanesClientGetOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -226,30 +241,25 @@ func (client *RadiusPlanesClient) NewListPager(options *RadiusPlanesClientListOp return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *RadiusPlanesClientListResponse) (RadiusPlanesClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RadiusPlanesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return RadiusPlanesClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return RadiusPlanesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RadiusPlanesClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *RadiusPlanesClient) listCreateRequest(ctx context.Context, options *RadiusPlanesClientListOptions) (*policy.Request, error) { +func (client *RadiusPlanesClient) listCreateRequest(ctx context.Context, _ *RadiusPlanesClientListOptions) (*policy.Request, error) { urlPath := "/planes/radius" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -287,10 +297,13 @@ func (client *RadiusPlanesClient) BeginUpdate(ctx context.Context, planeName str } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RadiusPlanesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[RadiusPlanesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RadiusPlanesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -300,6 +313,10 @@ func (client *RadiusPlanesClient) BeginUpdate(ctx context.Context, planeName str // Generated from API version 2023-10-01-preview func (client *RadiusPlanesClient) update(ctx context.Context, planeName string, properties RadiusPlaneResourceTagsUpdate, options *RadiusPlanesClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "RadiusPlanesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, planeName, properties, options) if err != nil { return nil, err @@ -316,7 +333,7 @@ func (client *RadiusPlanesClient) update(ctx context.Context, planeName string, } // updateCreateRequest creates the Update request. -func (client *RadiusPlanesClient) updateCreateRequest(ctx context.Context, planeName string, properties RadiusPlaneResourceTagsUpdate, options *RadiusPlanesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *RadiusPlanesClient) updateCreateRequest(ctx context.Context, planeName string, properties RadiusPlaneResourceTagsUpdate, _ *RadiusPlanesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -333,6 +350,6 @@ func (client *RadiusPlanesClient) updateCreateRequest(ctx context.Context, plane if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go index bcb851c724..04d4d452e6 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourcegroups_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -29,7 +26,7 @@ type ResourceGroupsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewResourceGroupsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceGroupsClient, error) { - cl, err := arm.NewClient(moduleName+".ResourceGroupsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -50,6 +47,10 @@ func NewResourceGroupsClient(credential azcore.TokenCredential, options *arm.Cli // method. func (client *ResourceGroupsClient) CreateOrUpdate(ctx context.Context, planeName string, resourceGroupName string, resource ResourceGroupResource, options *ResourceGroupsClientCreateOrUpdateOptions) (ResourceGroupsClientCreateOrUpdateResponse, error) { var err error + const operationName = "ResourceGroupsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, planeName, resourceGroupName, resource, options) if err != nil { return ResourceGroupsClientCreateOrUpdateResponse{}, err @@ -67,7 +68,7 @@ func (client *ResourceGroupsClient) CreateOrUpdate(ctx context.Context, planeNam } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ResourceGroupsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceGroupName string, resource ResourceGroupResource, options *ResourceGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ResourceGroupsClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceGroupName string, resource ResourceGroupResource, _ *ResourceGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -88,7 +89,7 @@ func (client *ResourceGroupsClient) createOrUpdateCreateRequest(ctx context.Cont if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // createOrUpdateHandleResponse handles the CreateOrUpdate response. @@ -109,6 +110,10 @@ func (client *ResourceGroupsClient) createOrUpdateHandleResponse(resp *http.Resp // - options - ResourceGroupsClientDeleteOptions contains the optional parameters for the ResourceGroupsClient.Delete method. func (client *ResourceGroupsClient) Delete(ctx context.Context, planeName string, resourceGroupName string, options *ResourceGroupsClientDeleteOptions) (ResourceGroupsClientDeleteResponse, error) { var err error + const operationName = "ResourceGroupsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, planeName, resourceGroupName, options) if err != nil { return ResourceGroupsClientDeleteResponse{}, err @@ -125,7 +130,7 @@ func (client *ResourceGroupsClient) Delete(ctx context.Context, planeName string } // deleteCreateRequest creates the Delete request. -func (client *ResourceGroupsClient) deleteCreateRequest(ctx context.Context, planeName string, resourceGroupName string, options *ResourceGroupsClientDeleteOptions) (*policy.Request, error) { +func (client *ResourceGroupsClient) deleteCreateRequest(ctx context.Context, planeName string, resourceGroupName string, _ *ResourceGroupsClientDeleteOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -155,6 +160,10 @@ func (client *ResourceGroupsClient) deleteCreateRequest(ctx context.Context, pla // - options - ResourceGroupsClientGetOptions contains the optional parameters for the ResourceGroupsClient.Get method. func (client *ResourceGroupsClient) Get(ctx context.Context, planeName string, resourceGroupName string, options *ResourceGroupsClientGetOptions) (ResourceGroupsClientGetResponse, error) { var err error + const operationName = "ResourceGroupsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, planeName, resourceGroupName, options) if err != nil { return ResourceGroupsClientGetResponse{}, err @@ -172,7 +181,7 @@ func (client *ResourceGroupsClient) Get(ctx context.Context, planeName string, r } // getCreateRequest creates the Get request. -func (client *ResourceGroupsClient) getCreateRequest(ctx context.Context, planeName string, resourceGroupName string, options *ResourceGroupsClientGetOptions) (*policy.Request, error) { +func (client *ResourceGroupsClient) getCreateRequest(ctx context.Context, planeName string, resourceGroupName string, _ *ResourceGroupsClientGetOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -213,30 +222,25 @@ func (client *ResourceGroupsClient) NewListPager(planeName string, options *Reso return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ResourceGroupsClientListResponse) (ResourceGroupsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, planeName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ResourceGroupsClientListResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ResourceGroupsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, planeName, options) + }, nil) if err != nil { return ResourceGroupsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceGroupsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *ResourceGroupsClient) listCreateRequest(ctx context.Context, planeName string, options *ResourceGroupsClientListOptions) (*policy.Request, error) { +func (client *ResourceGroupsClient) listCreateRequest(ctx context.Context, planeName string, _ *ResourceGroupsClientListOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/resourcegroups" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -272,6 +276,10 @@ func (client *ResourceGroupsClient) listHandleResponse(resp *http.Response) (Res // - options - ResourceGroupsClientUpdateOptions contains the optional parameters for the ResourceGroupsClient.Update method. func (client *ResourceGroupsClient) Update(ctx context.Context, planeName string, resourceGroupName string, properties ResourceGroupResourceTagsUpdate, options *ResourceGroupsClientUpdateOptions) (ResourceGroupsClientUpdateResponse, error) { var err error + const operationName = "ResourceGroupsClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, planeName, resourceGroupName, properties, options) if err != nil { return ResourceGroupsClientUpdateResponse{}, err @@ -289,7 +297,7 @@ func (client *ResourceGroupsClient) Update(ctx context.Context, planeName string } // updateCreateRequest creates the Update request. -func (client *ResourceGroupsClient) updateCreateRequest(ctx context.Context, planeName string, resourceGroupName string, properties ResourceGroupResourceTagsUpdate, options *ResourceGroupsClientUpdateOptions) (*policy.Request, error) { +func (client *ResourceGroupsClient) updateCreateRequest(ctx context.Context, planeName string, resourceGroupName string, properties ResourceGroupResourceTagsUpdate, _ *ResourceGroupsClientUpdateOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -310,7 +318,7 @@ func (client *ResourceGroupsClient) updateCreateRequest(ctx context.Context, pla if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } // updateHandleResponse handles the Update response. diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go index dd8f52981f..964c587bb8 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourceproviders_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -29,7 +26,7 @@ type ResourceProvidersClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewResourceProvidersClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceProvidersClient, error) { - cl, err := arm.NewClient(moduleName+".ResourceProvidersClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -56,10 +53,13 @@ func (client *ResourceProvidersClient) BeginCreateOrUpdate(ctx context.Context, } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ResourceProvidersClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[ResourceProvidersClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ResourceProvidersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -69,6 +69,10 @@ func (client *ResourceProvidersClient) BeginCreateOrUpdate(ctx context.Context, // Generated from API version 2023-10-01-preview func (client *ResourceProvidersClient) createOrUpdate(ctx context.Context, planeName string, resourceProviderName string, resource ResourceProviderResource, options *ResourceProvidersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "ResourceProvidersClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, planeName, resourceProviderName, resource, options) if err != nil { return nil, err @@ -85,7 +89,7 @@ func (client *ResourceProvidersClient) createOrUpdate(ctx context.Context, plane } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ResourceProvidersClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resource ResourceProviderResource, options *ResourceProvidersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ResourceProvidersClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resource ResourceProviderResource, _ *ResourceProvidersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -106,7 +110,7 @@ func (client *ResourceProvidersClient) createOrUpdateCreateRequest(ctx context.C if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a resource provider @@ -125,10 +129,13 @@ func (client *ResourceProvidersClient) BeginDelete(ctx context.Context, planeNam } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ResourceProvidersClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[ResourceProvidersClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ResourceProvidersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -138,6 +145,10 @@ func (client *ResourceProvidersClient) BeginDelete(ctx context.Context, planeNam // Generated from API version 2023-10-01-preview func (client *ResourceProvidersClient) deleteOperation(ctx context.Context, planeName string, resourceProviderName string, options *ResourceProvidersClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "ResourceProvidersClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, planeName, resourceProviderName, options) if err != nil { return nil, err @@ -154,7 +165,7 @@ func (client *ResourceProvidersClient) deleteOperation(ctx context.Context, plan } // deleteCreateRequest creates the Delete request. -func (client *ResourceProvidersClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *ResourceProvidersClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ResourceProvidersClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, _ *ResourceProvidersClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -184,6 +195,10 @@ func (client *ResourceProvidersClient) deleteCreateRequest(ctx context.Context, // - options - ResourceProvidersClientGetOptions contains the optional parameters for the ResourceProvidersClient.Get method. func (client *ResourceProvidersClient) Get(ctx context.Context, planeName string, resourceProviderName string, options *ResourceProvidersClientGetOptions) (ResourceProvidersClientGetResponse, error) { var err error + const operationName = "ResourceProvidersClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, planeName, resourceProviderName, options) if err != nil { return ResourceProvidersClientGetResponse{}, err @@ -201,7 +216,7 @@ func (client *ResourceProvidersClient) Get(ctx context.Context, planeName string } // getCreateRequest creates the Get request. -func (client *ResourceProvidersClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *ResourceProvidersClientGetOptions) (*policy.Request, error) { +func (client *ResourceProvidersClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, _ *ResourceProvidersClientGetOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -242,6 +257,10 @@ func (client *ResourceProvidersClient) getHandleResponse(resp *http.Response) (R // method. func (client *ResourceProvidersClient) GetProviderSummary(ctx context.Context, planeName string, resourceProviderName string, options *ResourceProvidersClientGetProviderSummaryOptions) (ResourceProvidersClientGetProviderSummaryResponse, error) { var err error + const operationName = "ResourceProvidersClient.GetProviderSummary" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getProviderSummaryCreateRequest(ctx, planeName, resourceProviderName, options) if err != nil { return ResourceProvidersClientGetProviderSummaryResponse{}, err @@ -259,7 +278,7 @@ func (client *ResourceProvidersClient) GetProviderSummary(ctx context.Context, p } // getProviderSummaryCreateRequest creates the GetProviderSummary request. -func (client *ResourceProvidersClient) getProviderSummaryCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *ResourceProvidersClientGetProviderSummaryOptions) (*policy.Request, error) { +func (client *ResourceProvidersClient) getProviderSummaryCreateRequest(ctx context.Context, planeName string, resourceProviderName string, _ *ResourceProvidersClientGetProviderSummaryOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/{resourceProviderName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -301,30 +320,25 @@ func (client *ResourceProvidersClient) NewListPager(planeName string, options *R return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ResourceProvidersClientListResponse) (ResourceProvidersClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, planeName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ResourceProvidersClientListResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ResourceProvidersClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, planeName, options) + }, nil) if err != nil { return ResourceProvidersClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceProvidersClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *ResourceProvidersClient) listCreateRequest(ctx context.Context, planeName string, options *ResourceProvidersClientListOptions) (*policy.Request, error) { +func (client *ResourceProvidersClient) listCreateRequest(ctx context.Context, planeName string, _ *ResourceProvidersClientListOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -363,30 +377,25 @@ func (client *ResourceProvidersClient) NewListProviderSummariesPager(planeName s return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ResourceProvidersClientListProviderSummariesResponse) (ResourceProvidersClientListProviderSummariesResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listProviderSummariesCreateRequest(ctx, planeName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ResourceProvidersClient.NewListProviderSummariesPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listProviderSummariesCreateRequest(ctx, planeName, options) + }, nil) if err != nil { return ResourceProvidersClientListProviderSummariesResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ResourceProvidersClientListProviderSummariesResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceProvidersClientListProviderSummariesResponse{}, runtime.NewResponseError(resp) - } return client.listProviderSummariesHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listProviderSummariesCreateRequest creates the ListProviderSummaries request. -func (client *ResourceProvidersClient) listProviderSummariesCreateRequest(ctx context.Context, planeName string, options *ResourceProvidersClientListProviderSummariesOptions) (*policy.Request, error) { +func (client *ResourceProvidersClient) listProviderSummariesCreateRequest(ctx context.Context, planeName string, _ *ResourceProvidersClientListProviderSummariesOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go index f9ade005f0..6c331970ad 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resources_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -29,7 +26,7 @@ type ResourcesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewResourcesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourcesClient, error) { - cl, err := arm.NewClient(moduleName+".ResourcesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -51,30 +48,25 @@ func (client *ResourcesClient) NewListPager(planeName string, resourceGroupName return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ResourcesClientListResponse) (ResourcesClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, planeName, resourceGroupName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return ResourcesClientListResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ResourcesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, planeName, resourceGroupName, options) + }, nil) if err != nil { return ResourcesClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourcesClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *ResourcesClient) listCreateRequest(ctx context.Context, planeName string, resourceGroupName string, options *ResourcesClientListOptions) (*policy.Request, error) { +func (client *ResourcesClient) listCreateRequest(ctx context.Context, planeName string, resourceGroupName string, _ *ResourcesClientListOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/resourcegroups/{resourceGroupName}/resources" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") diff --git a/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go b/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go index e1e8e2cfcb..d3dba9d47d 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_resourcetypes_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -29,7 +26,7 @@ type ResourceTypesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewResourceTypesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ResourceTypesClient, error) { - cl, err := arm.NewClient(moduleName+".ResourceTypesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -57,10 +54,13 @@ func (client *ResourceTypesClient) BeginCreateOrUpdate(ctx context.Context, plan } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ResourceTypesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[ResourceTypesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ResourceTypesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -70,6 +70,10 @@ func (client *ResourceTypesClient) BeginCreateOrUpdate(ctx context.Context, plan // Generated from API version 2023-10-01-preview func (client *ResourceTypesClient) createOrUpdate(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, resource ResourceTypeResource, options *ResourceTypesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "ResourceTypesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, planeName, resourceProviderName, resourceTypeName, resource, options) if err != nil { return nil, err @@ -86,7 +90,7 @@ func (client *ResourceTypesClient) createOrUpdate(ctx context.Context, planeName } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ResourceTypesClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, resource ResourceTypeResource, options *ResourceTypesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ResourceTypesClient) createOrUpdateCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, resource ResourceTypeResource, _ *ResourceTypesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -111,7 +115,7 @@ func (client *ResourceTypesClient) createOrUpdateCreateRequest(ctx context.Conte if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a resource type @@ -131,10 +135,13 @@ func (client *ResourceTypesClient) BeginDelete(ctx context.Context, planeName st } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ResourceTypesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[ResourceTypesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ResourceTypesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -144,6 +151,10 @@ func (client *ResourceTypesClient) BeginDelete(ctx context.Context, planeName st // Generated from API version 2023-10-01-preview func (client *ResourceTypesClient) deleteOperation(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *ResourceTypesClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "ResourceTypesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, planeName, resourceProviderName, resourceTypeName, options) if err != nil { return nil, err @@ -160,7 +171,7 @@ func (client *ResourceTypesClient) deleteOperation(ctx context.Context, planeNam } // deleteCreateRequest creates the Delete request. -func (client *ResourceTypesClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *ResourceTypesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ResourceTypesClient) deleteCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, _ *ResourceTypesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -195,6 +206,10 @@ func (client *ResourceTypesClient) deleteCreateRequest(ctx context.Context, plan // - options - ResourceTypesClientGetOptions contains the optional parameters for the ResourceTypesClient.Get method. func (client *ResourceTypesClient) Get(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *ResourceTypesClientGetOptions) (ResourceTypesClientGetResponse, error) { var err error + const operationName = "ResourceTypesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, planeName, resourceProviderName, resourceTypeName, options) if err != nil { return ResourceTypesClientGetResponse{}, err @@ -212,7 +227,7 @@ func (client *ResourceTypesClient) Get(ctx context.Context, planeName string, re } // getCreateRequest creates the Get request. -func (client *ResourceTypesClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, options *ResourceTypesClientGetOptions) (*policy.Request, error) { +func (client *ResourceTypesClient) getCreateRequest(ctx context.Context, planeName string, resourceProviderName string, resourceTypeName string, _ *ResourceTypesClientGetOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes/{resourceTypeName}" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") @@ -258,30 +273,25 @@ func (client *ResourceTypesClient) NewListPager(planeName string, resourceProvid return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *ResourceTypesClientListResponse) (ResourceTypesClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, planeName, resourceProviderName, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ResourceTypesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, planeName, resourceProviderName, options) + }, nil) if err != nil { return ResourceTypesClientListResponse{}, err } - resp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ResourceTypesClientListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ResourceTypesClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *ResourceTypesClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, options *ResourceTypesClientListOptions) (*policy.Request, error) { +func (client *ResourceTypesClient) listCreateRequest(ctx context.Context, planeName string, resourceProviderName string, _ *ResourceTypesClientListOptions) (*policy.Request, error) { urlPath := "/planes/radius/{planeName}/providers/System.Resources/resourceproviders/{resourceProviderName}/resourcetypes" if planeName == "" { return nil, errors.New("parameter planeName cannot be empty") diff --git a/pkg/ucp/api/v20231001preview/zz_generated_response_types.go b/pkg/ucp/api/v20231001preview/zz_generated_responses.go similarity index 79% rename from pkg/ucp/api/v20231001preview/zz_generated_response_types.go rename to pkg/ucp/api/v20231001preview/zz_generated_responses.go index c5e912f122..6182837a98 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_response_types.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_responses.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -9,7 +6,7 @@ package v20231001preview // APIVersionsClientCreateOrUpdateResponse contains the response from method APIVersionsClient.BeginCreateOrUpdate. type APIVersionsClientCreateOrUpdateResponse struct { - // The resource type for defining an API version of a resource type supported by the containing resource provider. +// The resource type for defining an API version of a resource type supported by the containing resource provider. APIVersionResource } @@ -20,19 +17,19 @@ type APIVersionsClientDeleteResponse struct { // APIVersionsClientGetResponse contains the response from method APIVersionsClient.Get. type APIVersionsClientGetResponse struct { - // The resource type for defining an API version of a resource type supported by the containing resource provider. +// The resource type for defining an API version of a resource type supported by the containing resource provider. APIVersionResource } // APIVersionsClientListResponse contains the response from method APIVersionsClient.NewListPager. type APIVersionsClientListResponse struct { - // The response of a ApiVersionResource list operation. +// The response of a ApiVersionResource list operation. APIVersionResourceListResult } // AwsCredentialsClientCreateOrUpdateResponse contains the response from method AwsCredentialsClient.CreateOrUpdate. type AwsCredentialsClientCreateOrUpdateResponse struct { - // Concrete tracked resource types can be created by aliasing this type using a specific property type. +// Concrete tracked resource types can be created by aliasing this type using a specific property type. AwsCredentialResource } @@ -43,25 +40,25 @@ type AwsCredentialsClientDeleteResponse struct { // AwsCredentialsClientGetResponse contains the response from method AwsCredentialsClient.Get. type AwsCredentialsClientGetResponse struct { - // Concrete tracked resource types can be created by aliasing this type using a specific property type. +// Concrete tracked resource types can be created by aliasing this type using a specific property type. AwsCredentialResource } // AwsCredentialsClientListResponse contains the response from method AwsCredentialsClient.NewListPager. type AwsCredentialsClientListResponse struct { - // The response of a AwsCredentialResource list operation. +// The response of a AwsCredentialResource list operation. AwsCredentialResourceListResult } // AwsCredentialsClientUpdateResponse contains the response from method AwsCredentialsClient.Update. type AwsCredentialsClientUpdateResponse struct { - // Concrete tracked resource types can be created by aliasing this type using a specific property type. +// Concrete tracked resource types can be created by aliasing this type using a specific property type. AwsCredentialResource } // AwsPlanesClientCreateOrUpdateResponse contains the response from method AwsPlanesClient.BeginCreateOrUpdate. type AwsPlanesClientCreateOrUpdateResponse struct { - // The AWS plane resource +// The AWS plane resource AwsPlaneResource } @@ -72,25 +69,25 @@ type AwsPlanesClientDeleteResponse struct { // AwsPlanesClientGetResponse contains the response from method AwsPlanesClient.Get. type AwsPlanesClientGetResponse struct { - // The AWS plane resource +// The AWS plane resource AwsPlaneResource } // AwsPlanesClientListResponse contains the response from method AwsPlanesClient.NewListPager. type AwsPlanesClientListResponse struct { - // The response of a AwsPlaneResource list operation. +// The response of a AwsPlaneResource list operation. AwsPlaneResourceListResult } // AwsPlanesClientUpdateResponse contains the response from method AwsPlanesClient.BeginUpdate. type AwsPlanesClientUpdateResponse struct { - // The AWS plane resource +// The AWS plane resource AwsPlaneResource } // AzureCredentialsClientCreateOrUpdateResponse contains the response from method AzureCredentialsClient.CreateOrUpdate. type AzureCredentialsClientCreateOrUpdateResponse struct { - // Represents Azure Credential Resource +// Represents Azure Credential Resource AzureCredentialResource } @@ -101,25 +98,25 @@ type AzureCredentialsClientDeleteResponse struct { // AzureCredentialsClientGetResponse contains the response from method AzureCredentialsClient.Get. type AzureCredentialsClientGetResponse struct { - // Represents Azure Credential Resource +// Represents Azure Credential Resource AzureCredentialResource } // AzureCredentialsClientListResponse contains the response from method AzureCredentialsClient.NewListPager. type AzureCredentialsClientListResponse struct { - // The response of a AzureCredentialResource list operation. +// The response of a AzureCredentialResource list operation. AzureCredentialResourceListResult } // AzureCredentialsClientUpdateResponse contains the response from method AzureCredentialsClient.Update. type AzureCredentialsClientUpdateResponse struct { - // Represents Azure Credential Resource +// Represents Azure Credential Resource AzureCredentialResource } // AzurePlanesClientCreateOrUpdateResponse contains the response from method AzurePlanesClient.BeginCreateOrUpdate. type AzurePlanesClientCreateOrUpdateResponse struct { - // The Azure plane resource. +// The Azure plane resource. AzurePlaneResource } @@ -130,25 +127,25 @@ type AzurePlanesClientDeleteResponse struct { // AzurePlanesClientGetResponse contains the response from method AzurePlanesClient.Get. type AzurePlanesClientGetResponse struct { - // The Azure plane resource. +// The Azure plane resource. AzurePlaneResource } // AzurePlanesClientListResponse contains the response from method AzurePlanesClient.NewListPager. type AzurePlanesClientListResponse struct { - // The response of a AzurePlaneResource list operation. +// The response of a AzurePlaneResource list operation. AzurePlaneResourceListResult } // AzurePlanesClientUpdateResponse contains the response from method AzurePlanesClient.BeginUpdate. type AzurePlanesClientUpdateResponse struct { - // The Azure plane resource. +// The Azure plane resource. AzurePlaneResource } // LocationsClientCreateOrUpdateResponse contains the response from method LocationsClient.BeginCreateOrUpdate. type LocationsClientCreateOrUpdateResponse struct { - // The resource type for defining a location of the containing resource provider. The location resource represents a logical +// The resource type for defining a location of the containing resource provider. The location resource represents a logical // location where the resource provider operates. LocationResource } @@ -160,26 +157,26 @@ type LocationsClientDeleteResponse struct { // LocationsClientGetResponse contains the response from method LocationsClient.Get. type LocationsClientGetResponse struct { - // The resource type for defining a location of the containing resource provider. The location resource represents a logical +// The resource type for defining a location of the containing resource provider. The location resource represents a logical // location where the resource provider operates. LocationResource } // LocationsClientListResponse contains the response from method LocationsClient.NewListPager. type LocationsClientListResponse struct { - // The response of a LocationResource list operation. +// The response of a LocationResource list operation. LocationResourceListResult } // PlanesClientListPlanesResponse contains the response from method PlanesClient.NewListPlanesPager. type PlanesClientListPlanesResponse struct { - // The response of a GenericPlaneResource list operation. +// The response of a GenericPlaneResource list operation. GenericPlaneResourceListResult } // RadiusPlanesClientCreateOrUpdateResponse contains the response from method RadiusPlanesClient.BeginCreateOrUpdate. type RadiusPlanesClientCreateOrUpdateResponse struct { - // The Radius plane resource. +// The Radius plane resource. RadiusPlaneResource } @@ -190,25 +187,25 @@ type RadiusPlanesClientDeleteResponse struct { // RadiusPlanesClientGetResponse contains the response from method RadiusPlanesClient.Get. type RadiusPlanesClientGetResponse struct { - // The Radius plane resource. +// The Radius plane resource. RadiusPlaneResource } // RadiusPlanesClientListResponse contains the response from method RadiusPlanesClient.NewListPager. type RadiusPlanesClientListResponse struct { - // The response of a RadiusPlaneResource list operation. +// The response of a RadiusPlaneResource list operation. RadiusPlaneResourceListResult } // RadiusPlanesClientUpdateResponse contains the response from method RadiusPlanesClient.BeginUpdate. type RadiusPlanesClientUpdateResponse struct { - // The Radius plane resource. +// The Radius plane resource. RadiusPlaneResource } // ResourceGroupsClientCreateOrUpdateResponse contains the response from method ResourceGroupsClient.CreateOrUpdate. type ResourceGroupsClientCreateOrUpdateResponse struct { - // The resource group resource +// The resource group resource ResourceGroupResource } @@ -219,25 +216,25 @@ type ResourceGroupsClientDeleteResponse struct { // ResourceGroupsClientGetResponse contains the response from method ResourceGroupsClient.Get. type ResourceGroupsClientGetResponse struct { - // The resource group resource +// The resource group resource ResourceGroupResource } // ResourceGroupsClientListResponse contains the response from method ResourceGroupsClient.NewListPager. type ResourceGroupsClientListResponse struct { - // The response of a ResourceGroupResource list operation. +// The response of a ResourceGroupResource list operation. ResourceGroupResourceListResult } // ResourceGroupsClientUpdateResponse contains the response from method ResourceGroupsClient.Update. type ResourceGroupsClientUpdateResponse struct { - // The resource group resource +// The resource group resource ResourceGroupResource } // ResourceProvidersClientCreateOrUpdateResponse contains the response from method ResourceProvidersClient.BeginCreateOrUpdate. type ResourceProvidersClientCreateOrUpdateResponse struct { - // The resource type for defining a resource provider. +// The resource type for defining a resource provider. ResourceProviderResource } @@ -248,32 +245,32 @@ type ResourceProvidersClientDeleteResponse struct { // ResourceProvidersClientGetProviderSummaryResponse contains the response from method ResourceProvidersClient.GetProviderSummary. type ResourceProvidersClientGetProviderSummaryResponse struct { - // The summary of a resource provider configuration. This type is optimized for querying resource providers and supported +// The summary of a resource provider configuration. This type is optimized for querying resource providers and supported // types. ResourceProviderSummary } // ResourceProvidersClientGetResponse contains the response from method ResourceProvidersClient.Get. type ResourceProvidersClientGetResponse struct { - // The resource type for defining a resource provider. +// The resource type for defining a resource provider. ResourceProviderResource } // ResourceProvidersClientListProviderSummariesResponse contains the response from method ResourceProvidersClient.NewListProviderSummariesPager. type ResourceProvidersClientListProviderSummariesResponse struct { - // Paged collection of ResourceProviderSummary items +// Paged collection of ResourceProviderSummary items PagedResourceProviderSummary } // ResourceProvidersClientListResponse contains the response from method ResourceProvidersClient.NewListPager. type ResourceProvidersClientListResponse struct { - // The response of a ResourceProviderResource list operation. +// The response of a ResourceProviderResource list operation. ResourceProviderResourceListResult } // ResourceTypesClientCreateOrUpdateResponse contains the response from method ResourceTypesClient.BeginCreateOrUpdate. type ResourceTypesClientCreateOrUpdateResponse struct { - // The resource type for defining a resource type supported by the containing resource provider. +// The resource type for defining a resource type supported by the containing resource provider. ResourceTypeResource } @@ -284,19 +281,19 @@ type ResourceTypesClientDeleteResponse struct { // ResourceTypesClientGetResponse contains the response from method ResourceTypesClient.Get. type ResourceTypesClientGetResponse struct { - // The resource type for defining a resource type supported by the containing resource provider. +// The resource type for defining a resource type supported by the containing resource provider. ResourceTypeResource } // ResourceTypesClientListResponse contains the response from method ResourceTypesClient.NewListPager. type ResourceTypesClientListResponse struct { - // The response of a ResourceTypeResource list operation. +// The response of a ResourceTypeResource list operation. ResourceTypeResourceListResult } // ResourcesClientListResponse contains the response from method ResourcesClient.NewListPager. type ResourcesClientListResponse struct { - // The response of a GenericResource list operation. +// The response of a GenericResource list operation. GenericResourceListResult } diff --git a/pkg/ucp/api/v20231001preview/zz_generated_time_rfc3339.go b/pkg/ucp/api/v20231001preview/zz_generated_time_rfc3339.go index 948a6660cd..bbe5fcce12 100644 --- a/pkg/ucp/api/v20231001preview/zz_generated_time_rfc3339.go +++ b/pkg/ucp/api/v20231001preview/zz_generated_time_rfc3339.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -21,51 +18,78 @@ import ( +// 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+)*"*$`) + const ( - utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` - utcLayout = "2006-01-02T15:04:05.999999999" - rfc3339JSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) -// 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+)*"*$`) - -type timeRFC3339 time.Time +type dateTimeRFC3339 time.Time -func (t timeRFC3339) MarshalJSON() (json []byte, err error) { +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { tt := time.Time(t) return tt.MarshalJSON() } -func (t timeRFC3339) MarshalText() (text []byte, err error) { +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { tt := time.Time(t) return tt.MarshalText() } -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcLayoutJSON - if tzOffsetRegex.Match(data) { - layout = rfc3339JSON +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { - layout := utcLayout - if tzOffsetRegex.Match(data) { +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) Parse(layout, value string) error { +func (t *dateTimeRFC3339) Parse(layout, value string) error { p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) + *t = dateTimeRFC3339(p) return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { @@ -74,14 +98,14 @@ func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { } else if reflect.ValueOf(t).IsNil() { return } - m[k] = (*timeRFC3339)(t) + m[k] = (*dateTimeRFC3339)(t) } -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { return nil } - var aux timeRFC3339 + var aux dateTimeRFC3339 if err := json.Unmarshal(data, &aux); err != nil { return fmt.Errorf("struct field %s: %v", fn, err) } diff --git a/typespec/UCP/ucp-operations.tsp b/typespec/UCP/ucp-operations.tsp index 3b8692b17b..e2fa14abc7 100644 --- a/typespec/UCP/ucp-operations.tsp +++ b/typespec/UCP/ucp-operations.tsp @@ -30,11 +30,11 @@ using OpenAPI; // https://github.com/Azure/typespec-azure/blob/main/packages/typespec-azure-resource-manager/lib/operations.tsp #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" +@get @autoRoute @doc("List {name}", TResource) @segmentOf(TResource) @armResourceList(TResource) -@get op UcpResourceList( ...TBaseParameters, ...ParentKeysOf, @@ -44,6 +44,7 @@ op UcpResourceList( @autoRoute @doc("Get a {name}", TResource) @get +@armResourceRead(TResource) op UcpResourceRead( ...TBaseParameters, ): ArmResponse | ErrorResponse; From ea6f1309ecec84a5defd527fa57972f08747c20c Mon Sep 17 00:00:00 2001 From: lakshmimsft Date: Mon, 11 Nov 2024 10:06:43 -0800 Subject: [PATCH 9/9] upd client for messengerrp Signed-off-by: lakshmimsft --- build/generate.mk | 2 +- pkg/messagingrp/api/README.md | 3 +- .../fake/zz_generated_internal.go | 66 ++++ .../fake/zz_generated_operations_server.go | 118 ++++++ .../zz_generated_rabbitmqqueues_server.go | 353 ++++++++++++++++++ .../fake/zz_generated_server_factory.go | 80 ++++ .../fake/zz_generated_time_rfc3339.go | 114 ++++++ .../zz_generated_client_factory.go | 25 +- .../zz_generated_constants.go | 29 +- .../zz_generated_interfaces.go | 3 - .../v20231001preview/zz_generated_models.go | 191 +++++----- .../zz_generated_models_serde.go | 13 +- .../zz_generated_operations_client.go | 30 +- .../v20231001preview/zz_generated_options.go | 9 +- .../zz_generated_polymorphic_helpers.go | 5 +- .../zz_generated_rabbitmqqueues_client.go | 81 ++-- ...nse_types.go => zz_generated_responses.go} | 15 +- .../zz_generated_time_rfc3339.go | 76 ++-- 18 files changed, 981 insertions(+), 232 deletions(-) create mode 100644 pkg/messagingrp/api/v20231001preview/fake/zz_generated_internal.go create mode 100644 pkg/messagingrp/api/v20231001preview/fake/zz_generated_operations_server.go create mode 100644 pkg/messagingrp/api/v20231001preview/fake/zz_generated_rabbitmqqueues_server.go create mode 100644 pkg/messagingrp/api/v20231001preview/fake/zz_generated_server_factory.go create mode 100644 pkg/messagingrp/api/v20231001preview/fake/zz_generated_time_rfc3339.go rename pkg/messagingrp/api/v20231001preview/{zz_generated_response_types.go => zz_generated_responses.go} (80%) diff --git a/build/generate.mk b/build/generate.mk index 56b0655f9f..e0a969f997 100644 --- a/build/generate.mk +++ b/build/generate.mk @@ -89,7 +89,7 @@ generate-rad-datastoresrp-client: generate-node-installed generate-autorest-inst .PHONY: generate-rad-messagingrp-client generate-rad-messagingrp-client: generate-node-installed generate-autorest-installed generate-tsp-installed generate-openapi-spec ## Generates the messagingrp client SDK (Autorest). @echo "$(AUTOREST_MODULE_VERSION) is module version" - autorest pkg/messagingrp/api/README.md --tag=messaging-2023-10-01-preview + autorest pkg/messagingrp/api/README.md --tag=messaging-2023-10-01-preview && rm pkg/messagingrp/api/v20231001preview/go.mod .PHONY: generate-rad-daprrp-client generate-rad-daprrp-client: generate-node-installed generate-autorest-installed generate-tsp-installed generate-openapi-spec ## Generates the daprrp client SDK (Autorest). diff --git a/pkg/messagingrp/api/README.md b/pkg/messagingrp/api/README.md index 9ff2049dae..5aa7b1c409 100644 --- a/pkg/messagingrp/api/README.md +++ b/pkg/messagingrp/api/README.md @@ -44,7 +44,8 @@ The following configuration generates track2 go models and client. ```yaml $(tag) != '' version: 3.*.* -use: "@autorest/go@4.0.0-preview.55" +use: "@autorest/go@4.0.0-preview.69" +module: "github.com/radius-project/radius/pkg/messagingrp/api/v20231001preview" module-version: 0.0.1 file-prefix: zz_generated_ license-header: "Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information.\nCode generated by Microsoft (R) AutoRest Code Generator.\nChanges may cause incorrect behavior and will be lost if the code is regenerated." diff --git a/pkg/messagingrp/api/v20231001preview/fake/zz_generated_internal.go b/pkg/messagingrp/api/v20231001preview/fake/zz_generated_internal.go new file mode 100644 index 0000000000..0c62457a83 --- /dev/null +++ b/pkg/messagingrp/api/v20231001preview/fake/zz_generated_internal.go @@ -0,0 +1,66 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/pkg/messagingrp/api/v20231001preview/fake/zz_generated_operations_server.go b/pkg/messagingrp/api/v20231001preview/fake/zz_generated_operations_server.go new file mode 100644 index 0000000000..3c9ff3c46b --- /dev/null +++ b/pkg/messagingrp/api/v20231001preview/fake/zz_generated_operations_server.go @@ -0,0 +1,118 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + 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/radius-project/radius/pkg/messagingrp/api/v20231001preview" + "net/http" +) + +// OperationsServer is a fake server for instances of the v20231001preview.OperationsClient type. +type OperationsServer struct{ + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *v20231001preview.OperationsClientListOptions) (resp azfake.PagerResponder[v20231001preview.OperationsClientListResponse]) + +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of v20231001preview.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[v20231001preview.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of v20231001preview.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[v20231001preview.OperationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for OperationsServerTransport. +func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { +resp := o.srv.NewListPager(nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *v20231001preview.OperationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/messagingrp/api/v20231001preview/fake/zz_generated_rabbitmqqueues_server.go b/pkg/messagingrp/api/v20231001preview/fake/zz_generated_rabbitmqqueues_server.go new file mode 100644 index 0000000000..2d837bd0e1 --- /dev/null +++ b/pkg/messagingrp/api/v20231001preview/fake/zz_generated_rabbitmqqueues_server.go @@ -0,0 +1,353 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + 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/radius-project/radius/pkg/messagingrp/api/v20231001preview" + "net/http" + "net/url" + "regexp" +) + +// RabbitMqQueuesServer is a fake server for instances of the v20231001preview.RabbitMqQueuesClient type. +type RabbitMqQueuesServer struct{ + // BeginCreateOrUpdate is the fake for method RabbitMqQueuesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, rabbitMQQueueName string, resource v20231001preview.RabbitMQQueueResource, options *v20231001preview.RabbitMqQueuesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[v20231001preview.RabbitMqQueuesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method RabbitMqQueuesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, rabbitMQQueueName string, options *v20231001preview.RabbitMqQueuesClientBeginDeleteOptions) (resp azfake.PollerResponder[v20231001preview.RabbitMqQueuesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method RabbitMqQueuesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, rabbitMQQueueName string, options *v20231001preview.RabbitMqQueuesClientGetOptions) (resp azfake.Responder[v20231001preview.RabbitMqQueuesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByScopePager is the fake for method RabbitMqQueuesClient.NewListByScopePager + // HTTP status codes to indicate success: http.StatusOK + NewListByScopePager func(options *v20231001preview.RabbitMqQueuesClientListByScopeOptions) (resp azfake.PagerResponder[v20231001preview.RabbitMqQueuesClientListByScopeResponse]) + + // ListSecrets is the fake for method RabbitMqQueuesClient.ListSecrets + // HTTP status codes to indicate success: http.StatusOK + ListSecrets func(ctx context.Context, rabbitMQQueueName string, body map[string]any, options *v20231001preview.RabbitMqQueuesClientListSecretsOptions) (resp azfake.Responder[v20231001preview.RabbitMqQueuesClientListSecretsResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method RabbitMqQueuesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, rabbitMQQueueName string, properties v20231001preview.RabbitMQQueueResourceUpdate, options *v20231001preview.RabbitMqQueuesClientBeginUpdateOptions) (resp azfake.PollerResponder[v20231001preview.RabbitMqQueuesClientUpdateResponse], errResp azfake.ErrorResponder) + +} + +// NewRabbitMqQueuesServerTransport creates a new instance of RabbitMqQueuesServerTransport with the provided implementation. +// The returned RabbitMqQueuesServerTransport instance is connected to an instance of v20231001preview.RabbitMqQueuesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewRabbitMqQueuesServerTransport(srv *RabbitMqQueuesServer) *RabbitMqQueuesServerTransport { + return &RabbitMqQueuesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[v20231001preview.RabbitMqQueuesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[v20231001preview.RabbitMqQueuesClientDeleteResponse]](), + newListByScopePager: newTracker[azfake.PagerResponder[v20231001preview.RabbitMqQueuesClientListByScopeResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[v20231001preview.RabbitMqQueuesClientUpdateResponse]](), + } +} + +// RabbitMqQueuesServerTransport connects instances of v20231001preview.RabbitMqQueuesClient to instances of RabbitMqQueuesServer. +// Don't use this type directly, use NewRabbitMqQueuesServerTransport instead. +type RabbitMqQueuesServerTransport struct { + srv *RabbitMqQueuesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[v20231001preview.RabbitMqQueuesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[v20231001preview.RabbitMqQueuesClientDeleteResponse]] + newListByScopePager *tracker[azfake.PagerResponder[v20231001preview.RabbitMqQueuesClientListByScopeResponse]] + beginUpdate *tracker[azfake.PollerResponder[v20231001preview.RabbitMqQueuesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for RabbitMqQueuesServerTransport. +func (r *RabbitMqQueuesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return r.dispatchToMethodFake(req, method) +} + +func (r *RabbitMqQueuesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if rabbitMqQueuesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = rabbitMqQueuesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RabbitMqQueuesClient.BeginCreateOrUpdate": + res.resp, res.err = r.dispatchBeginCreateOrUpdate(req) + case "RabbitMqQueuesClient.BeginDelete": + res.resp, res.err = r.dispatchBeginDelete(req) + case "RabbitMqQueuesClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RabbitMqQueuesClient.NewListByScopePager": + res.resp, res.err = r.dispatchNewListByScopePager(req) + case "RabbitMqQueuesClient.ListSecrets": + res.resp, res.err = r.dispatchListSecrets(req) + case "RabbitMqQueuesClient.BeginUpdate": + res.resp, res.err = r.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (r *RabbitMqQueuesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := r.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Messaging/rabbitMQQueues/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.RabbitMQQueueResource](req) + if err != nil { + return nil, err + } + rabbitMQQueueNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("rabbitMQQueueName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginCreateOrUpdate(req.Context(), rabbitMQQueueNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + r.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + r.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + r.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (r *RabbitMqQueuesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if r.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := r.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Messaging/rabbitMQQueues/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + rabbitMQQueueNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("rabbitMQQueueName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginDelete(req.Context(), rabbitMQQueueNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + r.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + r.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + r.beginDelete.remove(req) + } + + return resp, nil +} + +func (r *RabbitMqQueuesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if r.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Messaging/rabbitMQQueues/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + rabbitMQQueueNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("rabbitMQQueueName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.Get(req.Context(), rabbitMQQueueNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RabbitMQQueueResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *RabbitMqQueuesServerTransport) dispatchNewListByScopePager(req *http.Request) (*http.Response, error) { + if r.srv.NewListByScopePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByScopePager not implemented")} + } + newListByScopePager := r.newListByScopePager.get(req) + if newListByScopePager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Messaging/rabbitMQQueues` + 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 := r.srv.NewListByScopePager(nil) + newListByScopePager = &resp + r.newListByScopePager.add(req, newListByScopePager) + server.PagerResponderInjectNextLinks(newListByScopePager, req, func(page *v20231001preview.RabbitMqQueuesClientListByScopeResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByScopePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + r.newListByScopePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByScopePager) { + r.newListByScopePager.remove(req) + } + return resp, nil +} + +func (r *RabbitMqQueuesServerTransport) dispatchListSecrets(req *http.Request) (*http.Response, error) { + if r.srv.ListSecrets == nil { + return nil, &nonRetriableError{errors.New("fake for method ListSecrets not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Messaging/rabbitMQQueues/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listSecrets` + 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) + } + body, err := server.UnmarshalRequestAsJSON[map[string]any](req) + if err != nil { + return nil, err + } + rabbitMQQueueNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("rabbitMQQueueName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.ListSecrets(req.Context(), rabbitMQQueueNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RabbitMQListSecretsResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (r *RabbitMqQueuesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if r.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := r.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Applications\.Messaging/rabbitMQQueues/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + 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) + } + body, err := server.UnmarshalRequestAsJSON[v20231001preview.RabbitMQQueueResourceUpdate](req) + if err != nil { + return nil, err + } + rabbitMQQueueNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("rabbitMQQueueName")]) + if err != nil { + return nil, err + } + respr, errRespr := r.srv.BeginUpdate(req.Context(), rabbitMQQueueNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + r.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + r.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + r.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to RabbitMqQueuesServerTransport +var rabbitMqQueuesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/pkg/messagingrp/api/v20231001preview/fake/zz_generated_server_factory.go b/pkg/messagingrp/api/v20231001preview/fake/zz_generated_server_factory.go new file mode 100644 index 0000000000..194a926e68 --- /dev/null +++ b/pkg/messagingrp/api/v20231001preview/fake/zz_generated_server_factory.go @@ -0,0 +1,80 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the v20231001preview.ClientFactory type. +type ServerFactory struct { + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // RabbitMqQueuesServer contains the fakes for client RabbitMqQueuesClient + RabbitMqQueuesServer RabbitMqQueuesServer + +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of v20231001preview.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of v20231001preview.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trOperationsServer *OperationsServerTransport + trRabbitMqQueuesServer *RabbitMqQueuesServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "RabbitMqQueuesClient": + initServer(s, &s.trRabbitMqQueuesServer, func() *RabbitMqQueuesServerTransport { return NewRabbitMqQueuesServerTransport(&s.srv.RabbitMqQueuesServer) }) + resp, err = s.trRabbitMqQueuesServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/pkg/messagingrp/api/v20231001preview/fake/zz_generated_time_rfc3339.go b/pkg/messagingrp/api/v20231001preview/fake/zz_generated_time_rfc3339.go new file mode 100644 index 0000000000..83c75cddc6 --- /dev/null +++ b/pkg/messagingrp/api/v20231001preview/fake/zz_generated_time_rfc3339.go @@ -0,0 +1,114 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + + + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "regexp" + "strings" + "time" +) + + + +// 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+)*"*$`) + +const ( + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` +) + +type dateTimeRFC3339 time.Time + +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalJSON() +} + +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { + tt := time.Time(t) + return tt.MarshalText() +} + +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT + } + return t.Parse(layout, string(data)) +} + +func (t *dateTimeRFC3339) Parse(layout, value string) error { + p, err := time.Parse(layout, strings.ToUpper(value)) + *t = dateTimeRFC3339(p) + return err +} + +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 + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateTimeRFC3339)(t) +} + +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux dateTimeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/pkg/messagingrp/api/v20231001preview/zz_generated_client_factory.go b/pkg/messagingrp/api/v20231001preview/zz_generated_client_factory.go index 4e82fbb875..dfd844bfcf 100644 --- a/pkg/messagingrp/api/v20231001preview/zz_generated_client_factory.go +++ b/pkg/messagingrp/api/v20231001preview/zz_generated_client_factory.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -16,8 +13,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { rootScope string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -28,23 +24,28 @@ type ClientFactory struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { - _, err := arm.NewClient(moduleName+".ClientFactory", moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - rootScope: rootScope, credential: credential, - options: options.Clone(), + rootScope: rootScope, + internal: internal, }, nil } +// NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } +// NewRabbitMqQueuesClient creates a new instance of RabbitMqQueuesClient. func (c *ClientFactory) NewRabbitMqQueuesClient() *RabbitMqQueuesClient { - subClient, _ := NewRabbitMqQueuesClient(c.rootScope, c.credential, c.options) - return subClient + return &RabbitMqQueuesClient{ + rootScope: c.rootScope, + internal: c.internal, + } } diff --git a/pkg/messagingrp/api/v20231001preview/zz_generated_constants.go b/pkg/messagingrp/api/v20231001preview/zz_generated_constants.go index dee57fba78..66a8629f03 100644 --- a/pkg/messagingrp/api/v20231001preview/zz_generated_constants.go +++ b/pkg/messagingrp/api/v20231001preview/zz_generated_constants.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -8,7 +5,7 @@ package v20231001preview const ( - moduleName = "v20231001preview" + moduleName = "github.com/radius-project/radius/pkg/messagingrp/api/v20231001preview" moduleVersion = "v0.0.1" ) @@ -50,9 +47,9 @@ func PossibleCreatedByTypeValues() []CreatedByType { type IdentitySettingKind string const ( - // IdentitySettingKindAzureComWorkload - azure ad workload identity +// IdentitySettingKindAzureComWorkload - azure ad workload identity IdentitySettingKindAzureComWorkload IdentitySettingKind = "azure.com.workload" - // IdentitySettingKindUndefined - undefined identity +// IdentitySettingKindUndefined - undefined identity IdentitySettingKindUndefined IdentitySettingKind = "undefined" ) @@ -87,21 +84,21 @@ func PossibleOriginValues() []Origin { type ProvisioningState string const ( - // ProvisioningStateAccepted - The resource create request has been accepted +// ProvisioningStateAccepted - The resource create request has been accepted ProvisioningStateAccepted ProvisioningState = "Accepted" - // ProvisioningStateCanceled - The resource provisioning has been canceled +// ProvisioningStateCanceled - The resource provisioning has been canceled ProvisioningStateCanceled ProvisioningState = "Canceled" - // ProvisioningStateCreating - The resource is being created +// ProvisioningStateCreating - The resource is being created ProvisioningStateCreating ProvisioningState = "Creating" - // ProvisioningStateDeleting - The resource is being deleted +// ProvisioningStateDeleting - The resource is being deleted ProvisioningStateDeleting ProvisioningState = "Deleting" - // ProvisioningStateFailed - The resource provisioning has failed +// ProvisioningStateFailed - The resource provisioning has failed ProvisioningStateFailed ProvisioningState = "Failed" - // ProvisioningStateProvisioning - The resource is being provisioned +// ProvisioningStateProvisioning - The resource is being provisioned ProvisioningStateProvisioning ProvisioningState = "Provisioning" - // ProvisioningStateSucceeded - The resource has been successfully provisioned +// ProvisioningStateSucceeded - The resource has been successfully provisioned ProvisioningStateSucceeded ProvisioningState = "Succeeded" - // ProvisioningStateUpdating - The resource is being updated +// ProvisioningStateUpdating - The resource is being updated ProvisioningStateUpdating ProvisioningState = "Updating" ) @@ -125,9 +122,9 @@ func PossibleProvisioningStateValues() []ProvisioningState { type ResourceProvisioning string const ( - // ResourceProvisioningManual - The resource lifecycle will be managed by the user +// ResourceProvisioningManual - The resource lifecycle will be managed by the user ResourceProvisioningManual ResourceProvisioning = "manual" - // ResourceProvisioningRecipe - The resource lifecycle will be managed by Radius +// ResourceProvisioningRecipe - The resource lifecycle will be managed by Radius ResourceProvisioningRecipe ResourceProvisioning = "recipe" ) diff --git a/pkg/messagingrp/api/v20231001preview/zz_generated_interfaces.go b/pkg/messagingrp/api/v20231001preview/zz_generated_interfaces.go index ff4b623cae..dd034e311a 100644 --- a/pkg/messagingrp/api/v20231001preview/zz_generated_interfaces.go +++ b/pkg/messagingrp/api/v20231001preview/zz_generated_interfaces.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. diff --git a/pkg/messagingrp/api/v20231001preview/zz_generated_models.go b/pkg/messagingrp/api/v20231001preview/zz_generated_models.go index a01b5879a5..878133dae5 100644 --- a/pkg/messagingrp/api/v20231001preview/zz_generated_models.go +++ b/pkg/messagingrp/api/v20231001preview/zz_generated_models.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -12,31 +9,31 @@ import "time" // AzureResourceManagerCommonTypesTrackedResourceUpdate - The resource model definition for an Azure Resource Manager tracked // top level resource which has 'tags' and a 'location' type AzureResourceManagerCommonTypesTrackedResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // EnvironmentCompute - Represents backing compute resource type EnvironmentCompute struct { - // REQUIRED; Discriminator property for EnvironmentCompute. +// REQUIRED; Discriminator property for EnvironmentCompute. Kind *string - // Configuration for supported external identity providers +// Configuration for supported external identity providers Identity *IdentitySettings - // The resource id of the compute resource for application environment. +// The resource id of the compute resource for application environment. ResourceID *string } @@ -45,62 +42,62 @@ func (e *EnvironmentCompute) GetEnvironmentCompute() *EnvironmentCompute { retur // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { - // READ-ONLY; The additional info. +// READ-ONLY; The additional info. Info map[string]any - // READ-ONLY; The additional info type. +// READ-ONLY; The additional info type. Type *string } // ErrorDetail - The error detail. type ErrorDetail struct { - // READ-ONLY; The error additional info. +// READ-ONLY; The error additional info. AdditionalInfo []*ErrorAdditionalInfo - // READ-ONLY; The error code. +// READ-ONLY; The error code. Code *string - // READ-ONLY; The error details. +// READ-ONLY; The error details. Details []*ErrorDetail - // READ-ONLY; The error message. +// READ-ONLY; The error message. Message *string - // READ-ONLY; The error target. +// READ-ONLY; The error target. Target *string } // ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. // (This also follows the OData error response format.). type ErrorResponse struct { - // The error object. +// The error object. Error *ErrorDetail } // IdentitySettings is the external identity setting. type IdentitySettings struct { - // REQUIRED; kind of identity setting +// REQUIRED; kind of identity setting Kind *IdentitySettingKind - // The URI for your compute platform's OIDC issuer +// The URI for your compute platform's OIDC issuer OidcIssuer *string - // The resource ID of the provisioned identity +// The resource ID of the provisioned identity Resource *string } // KubernetesCompute - The Kubernetes compute configuration type KubernetesCompute struct { - // REQUIRED; Discriminator property for EnvironmentCompute. +// REQUIRED; Discriminator property for EnvironmentCompute. Kind *string - // REQUIRED; The namespace to use for the environment. +// REQUIRED; The namespace to use for the environment. Namespace *string - // Configuration for supported external identity providers +// Configuration for supported external identity providers Identity *IdentitySettings - // The resource id of the compute resource for application environment. +// The resource id of the compute resource for application environment. ResourceID *string } @@ -115,39 +112,39 @@ func (k *KubernetesCompute) GetEnvironmentCompute() *EnvironmentCompute { // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // Localized display information for this particular operation. +// Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +// READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. ActionType *ActionType - // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane +// READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane // operations. IsDataAction *bool - // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", +// READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", // "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 +// READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default // value is "user,system" Origin *Origin } // OperationDisplay - Localized display information for this particular operation. type OperationDisplay struct { - // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. +// READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual +// READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual // Machine", "Restart Virtual Machine". Operation *string - // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft +// READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft // Compute". Provider *string - // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job +// READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job // Schedule Collections". Resource *string } @@ -155,237 +152,237 @@ type OperationDisplay struct { // OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to // get the next set of results. type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). +// READ-ONLY; URL to get the next set of operation list results (if there are any). NextLink *string - // READ-ONLY; List of operations supported by the resource provider +// READ-ONLY; List of operations supported by the resource provider Value []*Operation } // OutputResource - Properties of an output resource. type OutputResource struct { - // The UCP resource ID of the underlying resource. +// The UCP resource ID of the underlying resource. ID *string - // The logical identifier scoped to the owning Radius resource. This is only needed or used when a resource has a dependency +// The logical identifier scoped to the owning Radius resource. This is only needed or used when a resource has a dependency // relationship. LocalIDs do not have any particular format or meaning beyond // being compared to determine dependency relationships. LocalID *string - // Determines whether Radius manages the lifecycle of the underlying resource. +// Determines whether Radius manages the lifecycle of the underlying resource. RadiusManaged *bool } // RabbitMQListSecretsResult - The secret values for the given RabbitMQQueue resource type RabbitMQListSecretsResult struct { - // The password used to connect to the RabbitMQ instance +// The password used to connect to the RabbitMQ instance Password *string - // The connection URI of the RabbitMQ instance. Generated automatically from host, port, SSL, username, password, and vhost. +// The connection URI of the RabbitMQ instance. Generated automatically from host, port, SSL, username, password, and vhost. // Can be overridden with a custom value URI *string } // RabbitMQQueueProperties - RabbitMQQueue portable resource properties type RabbitMQQueueProperties struct { - // REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to +// REQUIRED; Fully qualified resource ID for the environment that the portable resource is linked to Environment *string - // Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) +// Fully qualified resource ID for the application that the portable resource is consumed by (if applicable) Application *string - // The hostname of the RabbitMQ instance +// The hostname of the RabbitMQ instance Host *string - // The port of the RabbitMQ instance. Defaults to 5672 +// The port of the RabbitMQ instance. Defaults to 5672 Port *int32 - // The name of the queue +// The name of the queue Queue *string - // The recipe used to automatically deploy underlying infrastructure for the resource +// The recipe used to automatically deploy underlying infrastructure for the resource Recipe *Recipe - // Specifies how the underlying service/resource is provisioned and managed. +// Specifies how the underlying service/resource is provisioned and managed. ResourceProvisioning *ResourceProvisioning - // List of the resource IDs that support the rabbitMQ resource +// List of the resource IDs that support the rabbitMQ resource Resources []*ResourceReference - // The secrets to connect to the RabbitMQ instance +// The secrets to connect to the RabbitMQ instance Secrets *RabbitMQSecrets - // Specifies whether to use SSL when connecting to the RabbitMQ instance +// Specifies whether to use SSL when connecting to the RabbitMQ instance TLS *bool - // The username to use when connecting to the RabbitMQ instance +// The username to use when connecting to the RabbitMQ instance Username *string - // The RabbitMQ virtual host (vHost) the client will connect to. Defaults to no vHost. +// The RabbitMQ virtual host (vHost) the client will connect to. Defaults to no vHost. VHost *string - // READ-ONLY; The status of the asynchronous operation. +// READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState - // READ-ONLY; Status of a resource. +// READ-ONLY; Status of a resource. Status *ResourceStatus } // RabbitMQQueueResource - RabbitMQQueue portable resource type RabbitMQQueueResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; The resource-specific properties for this resource. +// REQUIRED; The resource-specific properties for this resource. Properties *RabbitMQQueueProperties - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // RabbitMQQueueResourceListResult - The response of a RabbitMQQueueResource list operation. type RabbitMQQueueResourceListResult struct { - // REQUIRED; The RabbitMQQueueResource items on this page +// REQUIRED; The RabbitMQQueueResource items on this page Value []*RabbitMQQueueResource - // The link to the next page of items +// The link to the next page of items NextLink *string } // RabbitMQQueueResourceUpdate - RabbitMQQueue portable resource type RabbitMQQueueResourceUpdate struct { - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // RabbitMQSecrets - The connection secrets properties to the RabbitMQ instance type RabbitMQSecrets struct { - // The password used to connect to the RabbitMQ instance +// The password used to connect to the RabbitMQ instance Password *string - // The connection URI of the RabbitMQ instance. Generated automatically from host, port, SSL, username, password, and vhost. +// The connection URI of the RabbitMQ instance. Generated automatically from host, port, SSL, username, password, and vhost. // Can be overridden with a custom value URI *string } // Recipe - The recipe used to automatically deploy underlying infrastructure for a portable resource type Recipe struct { - // REQUIRED; The name of the recipe within the environment to use +// REQUIRED; The name of the recipe within the environment to use Name *string - // Key/value parameters to pass into the recipe at deployment +// Key/value parameters to pass into the recipe at deployment Parameters map[string]any } // RecipeStatus - Recipe status at deployment time for a resource. type RecipeStatus struct { - // REQUIRED; TemplateKind is the kind of the recipe template used by the portable resource upon deployment. +// REQUIRED; TemplateKind is the kind of the recipe template used by the portable resource upon deployment. TemplateKind *string - // REQUIRED; TemplatePath is the path of the recipe consumed by the portable resource upon deployment. +// REQUIRED; TemplatePath is the path of the recipe consumed by the portable resource upon deployment. TemplatePath *string - // TemplateVersion is the version number of the template. +// TemplateVersion is the version number of the template. TemplateVersion *string } // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ResourceReference - Describes a reference to an existing resource type ResourceReference struct { - // REQUIRED; Resource id of an existing resource +// REQUIRED; Resource id of an existing resource ID *string } // ResourceStatus - Status of a resource. type ResourceStatus struct { - // The compute resource associated with the resource. +// The compute resource associated with the resource. Compute EnvironmentComputeClassification - // Properties of an output resource +// Properties of an output resource OutputResources []*OutputResource - // READ-ONLY; The recipe data at the time of deployment +// READ-ONLY; The recipe data at the time of deployment Recipe *RecipeStatus } // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { - // The timestamp of resource creation (UTC). +// The timestamp of resource creation (UTC). CreatedAt *time.Time - // The identity that created the resource. +// The identity that created the resource. CreatedBy *string - // The type of identity that created the resource. +// The type of identity that created the resource. CreatedByType *CreatedByType - // The timestamp of resource last modification (UTC) +// The timestamp of resource last modification (UTC) LastModifiedAt *time.Time - // The identity that last modified the resource. +// The identity that last modified the resource. LastModifiedBy *string - // The type of identity that last modified the resource. +// The type of identity that last modified the resource. LastModifiedByType *CreatedByType } // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives +// REQUIRED; The geo-location where the resource lives Location *string - // Resource tags. +// Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} +// READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource +// READ-ONLY; The name of the resource Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. +// READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" +// READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } diff --git a/pkg/messagingrp/api/v20231001preview/zz_generated_models_serde.go b/pkg/messagingrp/api/v20231001preview/zz_generated_models_serde.go index d5be270882..f32de3ebbb 100644 --- a/pkg/messagingrp/api/v20231001preview/zz_generated_models_serde.go +++ b/pkg/messagingrp/api/v20231001preview/zz_generated_models_serde.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -851,10 +848,10 @@ func (r *ResourceStatus) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -870,7 +867,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) @@ -879,7 +876,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) @@ -953,7 +950,7 @@ func populate(m map[string]any, k string, v any) { } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/pkg/messagingrp/api/v20231001preview/zz_generated_operations_client.go b/pkg/messagingrp/api/v20231001preview/zz_generated_operations_client.go index a26b477ef5..ae77ab4586 100644 --- a/pkg/messagingrp/api/v20231001preview/zz_generated_operations_client.go +++ b/pkg/messagingrp/api/v20231001preview/zz_generated_operations_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -26,7 +23,7 @@ type OperationsClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { - cl, err := arm.NewClient(moduleName+".OperationsClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -46,30 +43,25 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return OperationsClientListResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) if err != nil { return OperationsClientListResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return OperationsClientListResponse{}, runtime.NewResponseError(resp) - } return client.listHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Applications.Messaging/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/pkg/messagingrp/api/v20231001preview/zz_generated_options.go b/pkg/messagingrp/api/v20231001preview/zz_generated_options.go index 1eaffef976..e5ec6f6b11 100644 --- a/pkg/messagingrp/api/v20231001preview/zz_generated_options.go +++ b/pkg/messagingrp/api/v20231001preview/zz_generated_options.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -15,19 +12,19 @@ type OperationsClientListOptions struct { // RabbitMqQueuesClientBeginCreateOrUpdateOptions contains the optional parameters for the RabbitMqQueuesClient.BeginCreateOrUpdate // method. type RabbitMqQueuesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // RabbitMqQueuesClientBeginDeleteOptions contains the optional parameters for the RabbitMqQueuesClient.BeginDelete method. type RabbitMqQueuesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } // RabbitMqQueuesClientBeginUpdateOptions contains the optional parameters for the RabbitMqQueuesClient.BeginUpdate method. type RabbitMqQueuesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. +// Resumes the long-running operation from the provided token. ResumeToken string } diff --git a/pkg/messagingrp/api/v20231001preview/zz_generated_polymorphic_helpers.go b/pkg/messagingrp/api/v20231001preview/zz_generated_polymorphic_helpers.go index c574dd5eea..7b008f3d80 100644 --- a/pkg/messagingrp/api/v20231001preview/zz_generated_polymorphic_helpers.go +++ b/pkg/messagingrp/api/v20231001preview/zz_generated_polymorphic_helpers.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -10,7 +7,7 @@ package v20231001preview import "encoding/json" func unmarshalEnvironmentComputeClassification(rawMsg json.RawMessage) (EnvironmentComputeClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any diff --git a/pkg/messagingrp/api/v20231001preview/zz_generated_rabbitmqqueues_client.go b/pkg/messagingrp/api/v20231001preview/zz_generated_rabbitmqqueues_client.go index bb5f152795..1d48fc4ab1 100644 --- a/pkg/messagingrp/api/v20231001preview/zz_generated_rabbitmqqueues_client.go +++ b/pkg/messagingrp/api/v20231001preview/zz_generated_rabbitmqqueues_client.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -33,7 +30,7 @@ type RabbitMqQueuesClient struct { // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewRabbitMqQueuesClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RabbitMqQueuesClient, error) { - cl, err := arm.NewClient(moduleName+".RabbitMqQueuesClient", moduleVersion, credential, options) + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } @@ -60,10 +57,13 @@ func (client *RabbitMqQueuesClient) BeginCreateOrUpdate(ctx context.Context, rab } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RabbitMqQueuesClientCreateOrUpdateResponse]{ FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[RabbitMqQueuesClientCreateOrUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RabbitMqQueuesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -73,6 +73,10 @@ func (client *RabbitMqQueuesClient) BeginCreateOrUpdate(ctx context.Context, rab // Generated from API version 2023-10-01-preview func (client *RabbitMqQueuesClient) createOrUpdate(ctx context.Context, rabbitMQQueueName string, resource RabbitMQQueueResource, options *RabbitMqQueuesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error + const operationName = "RabbitMqQueuesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.createOrUpdateCreateRequest(ctx, rabbitMQQueueName, resource, options) if err != nil { return nil, err @@ -89,7 +93,7 @@ func (client *RabbitMqQueuesClient) createOrUpdate(ctx context.Context, rabbitMQ } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *RabbitMqQueuesClient) createOrUpdateCreateRequest(ctx context.Context, rabbitMQQueueName string, resource RabbitMQQueueResource, options *RabbitMqQueuesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *RabbitMqQueuesClient) createOrUpdateCreateRequest(ctx context.Context, rabbitMQQueueName string, resource RabbitMQQueueResource, _ *RabbitMqQueuesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Messaging/rabbitMQQueues/{rabbitMQQueueName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if rabbitMQQueueName == "" { @@ -107,7 +111,7 @@ func (client *RabbitMqQueuesClient) createOrUpdateCreateRequest(ctx context.Cont if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } - return req, nil +; return req, nil } // BeginDelete - Delete a RabbitMQQueueResource @@ -125,10 +129,13 @@ func (client *RabbitMqQueuesClient) BeginDelete(ctx context.Context, rabbitMQQue } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RabbitMqQueuesClientDeleteResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[RabbitMqQueuesClientDeleteResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RabbitMqQueuesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -138,6 +145,10 @@ func (client *RabbitMqQueuesClient) BeginDelete(ctx context.Context, rabbitMQQue // Generated from API version 2023-10-01-preview func (client *RabbitMqQueuesClient) deleteOperation(ctx context.Context, rabbitMQQueueName string, options *RabbitMqQueuesClientBeginDeleteOptions) (*http.Response, error) { var err error + const operationName = "RabbitMqQueuesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.deleteCreateRequest(ctx, rabbitMQQueueName, options) if err != nil { return nil, err @@ -154,7 +165,7 @@ func (client *RabbitMqQueuesClient) deleteOperation(ctx context.Context, rabbitM } // deleteCreateRequest creates the Delete request. -func (client *RabbitMqQueuesClient) deleteCreateRequest(ctx context.Context, rabbitMQQueueName string, options *RabbitMqQueuesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *RabbitMqQueuesClient) deleteCreateRequest(ctx context.Context, rabbitMQQueueName string, _ *RabbitMqQueuesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Messaging/rabbitMQQueues/{rabbitMQQueueName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if rabbitMQQueueName == "" { @@ -180,6 +191,10 @@ func (client *RabbitMqQueuesClient) deleteCreateRequest(ctx context.Context, rab // - options - RabbitMqQueuesClientGetOptions contains the optional parameters for the RabbitMqQueuesClient.Get method. func (client *RabbitMqQueuesClient) Get(ctx context.Context, rabbitMQQueueName string, options *RabbitMqQueuesClientGetOptions) (RabbitMqQueuesClientGetResponse, error) { var err error + const operationName = "RabbitMqQueuesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.getCreateRequest(ctx, rabbitMQQueueName, options) if err != nil { return RabbitMqQueuesClientGetResponse{}, err @@ -197,7 +212,7 @@ func (client *RabbitMqQueuesClient) Get(ctx context.Context, rabbitMQQueueName s } // getCreateRequest creates the Get request. -func (client *RabbitMqQueuesClient) getCreateRequest(ctx context.Context, rabbitMQQueueName string, options *RabbitMqQueuesClientGetOptions) (*policy.Request, error) { +func (client *RabbitMqQueuesClient) getCreateRequest(ctx context.Context, rabbitMQQueueName string, _ *RabbitMqQueuesClientGetOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Messaging/rabbitMQQueues/{rabbitMQQueueName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if rabbitMQQueueName == "" { @@ -235,30 +250,25 @@ func (client *RabbitMqQueuesClient) NewListByScopePager(options *RabbitMqQueuesC return page.NextLink != nil && len(*page.NextLink) > 0 }, Fetcher: func(ctx context.Context, page *RabbitMqQueuesClientListByScopeResponse) (RabbitMqQueuesClientListByScopeResponse, error) { - var req *policy.Request - var err error - if page == nil { - req, err = client.listByScopeCreateRequest(ctx, options) - } else { - req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) - } - if err != nil { - return RabbitMqQueuesClientListByScopeResponse{}, err + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RabbitMqQueuesClient.NewListByScopePager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink } - resp, err := client.internal.Pipeline().Do(req) + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) if err != nil { return RabbitMqQueuesClientListByScopeResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return RabbitMqQueuesClientListByScopeResponse{}, runtime.NewResponseError(resp) - } return client.listByScopeHandleResponse(resp) - }, + }, + Tracer: client.internal.Tracer(), }) } // listByScopeCreateRequest creates the ListByScope request. -func (client *RabbitMqQueuesClient) listByScopeCreateRequest(ctx context.Context, options *RabbitMqQueuesClientListByScopeOptions) (*policy.Request, error) { +func (client *RabbitMqQueuesClient) listByScopeCreateRequest(ctx context.Context, _ *RabbitMqQueuesClientListByScopeOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Messaging/rabbitMQQueues" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -291,6 +301,10 @@ func (client *RabbitMqQueuesClient) listByScopeHandleResponse(resp *http.Respons // method. func (client *RabbitMqQueuesClient) ListSecrets(ctx context.Context, rabbitMQQueueName string, body map[string]any, options *RabbitMqQueuesClientListSecretsOptions) (RabbitMqQueuesClientListSecretsResponse, error) { var err error + const operationName = "RabbitMqQueuesClient.ListSecrets" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.listSecretsCreateRequest(ctx, rabbitMQQueueName, body, options) if err != nil { return RabbitMqQueuesClientListSecretsResponse{}, err @@ -308,7 +322,7 @@ func (client *RabbitMqQueuesClient) ListSecrets(ctx context.Context, rabbitMQQue } // listSecretsCreateRequest creates the ListSecrets request. -func (client *RabbitMqQueuesClient) listSecretsCreateRequest(ctx context.Context, rabbitMQQueueName string, body map[string]any, options *RabbitMqQueuesClientListSecretsOptions) (*policy.Request, error) { +func (client *RabbitMqQueuesClient) listSecretsCreateRequest(ctx context.Context, rabbitMQQueueName string, body map[string]any, _ *RabbitMqQueuesClientListSecretsOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Messaging/rabbitMQQueues/{rabbitMQQueueName}/listSecrets" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if rabbitMQQueueName == "" { @@ -326,7 +340,7 @@ func (client *RabbitMqQueuesClient) listSecretsCreateRequest(ctx context.Context if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err } - return req, nil +; return req, nil } // listSecretsHandleResponse handles the ListSecrets response. @@ -354,10 +368,13 @@ func (client *RabbitMqQueuesClient) BeginUpdate(ctx context.Context, rabbitMQQue } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[RabbitMqQueuesClientUpdateResponse]{ FinalStateVia: runtime.FinalStateViaLocation, + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken[RabbitMqQueuesClientUpdateResponse](options.ResumeToken, client.internal.Pipeline(), nil) + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[RabbitMqQueuesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) } } @@ -367,6 +384,10 @@ func (client *RabbitMqQueuesClient) BeginUpdate(ctx context.Context, rabbitMQQue // Generated from API version 2023-10-01-preview func (client *RabbitMqQueuesClient) update(ctx context.Context, rabbitMQQueueName string, properties RabbitMQQueueResourceUpdate, options *RabbitMqQueuesClientBeginUpdateOptions) (*http.Response, error) { var err error + const operationName = "RabbitMqQueuesClient.BeginUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() req, err := client.updateCreateRequest(ctx, rabbitMQQueueName, properties, options) if err != nil { return nil, err @@ -383,7 +404,7 @@ func (client *RabbitMqQueuesClient) update(ctx context.Context, rabbitMQQueueNam } // updateCreateRequest creates the Update request. -func (client *RabbitMqQueuesClient) updateCreateRequest(ctx context.Context, rabbitMQQueueName string, properties RabbitMQQueueResourceUpdate, options *RabbitMqQueuesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *RabbitMqQueuesClient) updateCreateRequest(ctx context.Context, rabbitMQQueueName string, properties RabbitMQQueueResourceUpdate, _ *RabbitMqQueuesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{rootScope}/providers/Applications.Messaging/rabbitMQQueues/{rabbitMQQueueName}" urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) if rabbitMQQueueName == "" { @@ -401,6 +422,6 @@ func (client *RabbitMqQueuesClient) updateCreateRequest(ctx context.Context, rab if err := runtime.MarshalAsJSON(req, properties); err != nil { return nil, err } - return req, nil +; return req, nil } diff --git a/pkg/messagingrp/api/v20231001preview/zz_generated_response_types.go b/pkg/messagingrp/api/v20231001preview/zz_generated_responses.go similarity index 80% rename from pkg/messagingrp/api/v20231001preview/zz_generated_response_types.go rename to pkg/messagingrp/api/v20231001preview/zz_generated_responses.go index a038e0d808..d97790328b 100644 --- a/pkg/messagingrp/api/v20231001preview/zz_generated_response_types.go +++ b/pkg/messagingrp/api/v20231001preview/zz_generated_responses.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -9,13 +6,13 @@ package v20231001preview // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. 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. +// 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 } // RabbitMqQueuesClientCreateOrUpdateResponse contains the response from method RabbitMqQueuesClient.BeginCreateOrUpdate. type RabbitMqQueuesClientCreateOrUpdateResponse struct { - // RabbitMQQueue portable resource +// RabbitMQQueue portable resource RabbitMQQueueResource } @@ -26,25 +23,25 @@ type RabbitMqQueuesClientDeleteResponse struct { // RabbitMqQueuesClientGetResponse contains the response from method RabbitMqQueuesClient.Get. type RabbitMqQueuesClientGetResponse struct { - // RabbitMQQueue portable resource +// RabbitMQQueue portable resource RabbitMQQueueResource } // RabbitMqQueuesClientListByScopeResponse contains the response from method RabbitMqQueuesClient.NewListByScopePager. type RabbitMqQueuesClientListByScopeResponse struct { - // The response of a RabbitMQQueueResource list operation. +// The response of a RabbitMQQueueResource list operation. RabbitMQQueueResourceListResult } // RabbitMqQueuesClientListSecretsResponse contains the response from method RabbitMqQueuesClient.ListSecrets. type RabbitMqQueuesClientListSecretsResponse struct { - // The secret values for the given RabbitMQQueue resource +// The secret values for the given RabbitMQQueue resource RabbitMQListSecretsResult } // RabbitMqQueuesClientUpdateResponse contains the response from method RabbitMqQueuesClient.BeginUpdate. type RabbitMqQueuesClientUpdateResponse struct { - // RabbitMQQueue portable resource +// RabbitMQQueue portable resource RabbitMQQueueResource } diff --git a/pkg/messagingrp/api/v20231001preview/zz_generated_time_rfc3339.go b/pkg/messagingrp/api/v20231001preview/zz_generated_time_rfc3339.go index 948a6660cd..bbe5fcce12 100644 --- a/pkg/messagingrp/api/v20231001preview/zz_generated_time_rfc3339.go +++ b/pkg/messagingrp/api/v20231001preview/zz_generated_time_rfc3339.go @@ -1,6 +1,3 @@ -//go:build go1.18 -// +build go1.18 - // Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. // Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. // Changes may cause incorrect behavior and will be lost if the code is regenerated. @@ -21,51 +18,78 @@ import ( +// 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+)*"*$`) + const ( - utcLayoutJSON = `"2006-01-02T15:04:05.999999999"` - utcLayout = "2006-01-02T15:04:05.999999999" - rfc3339JSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) -// 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+)*"*$`) - -type timeRFC3339 time.Time +type dateTimeRFC3339 time.Time -func (t timeRFC3339) MarshalJSON() (json []byte, err error) { +func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { tt := time.Time(t) return tt.MarshalJSON() } -func (t timeRFC3339) MarshalText() (text []byte, err error) { +func (t dateTimeRFC3339) MarshalText() ([]byte, error) { tt := time.Time(t) return tt.MarshalText() } -func (t *timeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcLayoutJSON - if tzOffsetRegex.Match(data) { - layout = rfc3339JSON +func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { + layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) UnmarshalText(data []byte) (err error) { - layout := utcLayout - if tzOffsetRegex.Match(data) { +func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } -func (t *timeRFC3339) Parse(layout, value string) error { +func (t *dateTimeRFC3339) Parse(layout, value string) error { p, err := time.Parse(layout, strings.ToUpper(value)) - *t = timeRFC3339(p) + *t = dateTimeRFC3339(p) return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + -func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { +func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return } else if azcore.IsNullValue(t) { @@ -74,14 +98,14 @@ func populateTimeRFC3339(m map[string]any, k string, t *time.Time) { } else if reflect.ValueOf(t).IsNil() { return } - m[k] = (*timeRFC3339)(t) + m[k] = (*dateTimeRFC3339)(t) } -func unpopulateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { +func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { return nil } - var aux timeRFC3339 + var aux dateTimeRFC3339 if err := json.Unmarshal(data, &aux); err != nil { return fmt.Errorf("struct field %s: %v", fn, err) }