From 7b021aac223f03162154eee311d17cfcea08f043 Mon Sep 17 00:00:00 2001 From: jliusan Date: Tue, 13 May 2025 13:42:30 +0800 Subject: [PATCH 1/3] [Release] sdk/resourcemanager/neonpostgres/armneonpostgres/2.0.0 generation from spec commit: c269b7b78cac2808d7acc55124a9653b2e904e4b --- .../neonpostgres/armneonpostgres/CHANGELOG.md | 23 + .../neonpostgres/armneonpostgres/README.md | 2 +- .../armneonpostgres/branches_client.go | 90 ---- .../branches_client_example_test.go | 222 ++-------- .../armneonpostgres/computes_client.go | 339 --------------- .../computes_client_example_test.go | 216 +--------- .../neonpostgres/armneonpostgres/constants.go | 2 +- .../armneonpostgres/endpoints_client.go | 339 --------------- .../endpoints_client_example_test.go | 211 +-------- .../armneonpostgres/fake/branches_server.go | 74 +--- .../armneonpostgres/fake/computes_server.go | 251 +---------- .../armneonpostgres/fake/endpoints_server.go | 251 +---------- .../fake/neondatabases_server.go | 251 +---------- .../armneonpostgres/fake/neonroles_server.go | 251 +---------- .../armneonpostgres/fake/operations_server.go | 2 +- .../fake/organizations_server.go | 16 +- .../armneonpostgres/fake/projects_server.go | 72 +--- .../armneonpostgres/fake/time_rfc3339.go | 109 ----- .../neonpostgres/armneonpostgres/go.mod | 2 +- .../neonpostgres/armneonpostgres/models.go | 4 +- .../armneonpostgres/neondatabases_client.go | 340 --------------- .../neondatabases_client_example_test.go | 206 +-------- .../armneonpostgres/neonpostgres_live_test.go | 2 +- .../armneonpostgres/neonroles_client.go | 339 --------------- .../neonroles_client_example_test.go | 221 +--------- .../operations_client_example_test.go | 8 +- .../neonpostgres/armneonpostgres/options.go | 103 ----- .../organizations_client_example_test.go | 289 ++++++++----- .../armneonpostgres/projects_client.go | 85 ---- .../projects_client_example_test.go | 408 +++--------------- .../neonpostgres/armneonpostgres/responses.go | 104 ----- .../armneonpostgres/tsp-location.yaml | 2 +- 32 files changed, 353 insertions(+), 4481 deletions(-) delete mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/CHANGELOG.md b/sdk/resourcemanager/neonpostgres/armneonpostgres/CHANGELOG.md index a460778170ed..f8025204acb5 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/CHANGELOG.md +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/CHANGELOG.md @@ -1,5 +1,28 @@ # Release History +## 2.0.0 (2025-05-13) +### Breaking Changes + +- Function `*BranchesClient.BeginUpdate` has been removed +- Function `*ComputesClient.BeginCreateOrUpdate` has been removed +- Function `*ComputesClient.Delete` has been removed +- Function `*ComputesClient.Get` has been removed +- Function `*ComputesClient.BeginUpdate` has been removed +- Function `*EndpointsClient.BeginCreateOrUpdate` has been removed +- Function `*EndpointsClient.Delete` has been removed +- Function `*EndpointsClient.Get` has been removed +- Function `*EndpointsClient.BeginUpdate` has been removed +- Function `*ProjectsClient.BeginUpdate` has been removed +- Function `*NeonDatabasesClient.BeginCreateOrUpdate` has been removed +- Function `*NeonDatabasesClient.Delete` has been removed +- Function `*NeonDatabasesClient.Get` has been removed +- Function `*NeonDatabasesClient.BeginUpdate` has been removed +- Function `*NeonRolesClient.BeginCreateOrUpdate` has been removed +- Function `*NeonRolesClient.Delete` has been removed +- Function `*NeonRolesClient.Get` has been removed +- Function `*NeonRolesClient.BeginUpdate` has been removed + + ## 1.0.0 (2025-04-07) ### Features Added diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/README.md b/sdk/resourcemanager/neonpostgres/armneonpostgres/README.md index 6cfc1c475d34..3445ffe3a746 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/README.md +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Neon Postgres module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client.go index ad2d810cb2a4..d8625291e76c 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client.go @@ -336,93 +336,3 @@ func (client *BranchesClient) listHandleResponse(resp *http.Response) (BranchesC } return result, nil } - -// BeginUpdate - Update a Branch -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - properties - The resource properties to be updated. -// - options - BranchesClientBeginUpdateOptions contains the optional parameters for the BranchesClient.BeginUpdate method. -func (client *BranchesClient) BeginUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, properties Branch, options *BranchesClientBeginUpdateOptions) (*runtime.Poller[BranchesClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, organizationName, projectName, branchName, properties, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BranchesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BranchesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Update a Branch -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *BranchesClient) update(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, properties Branch, options *BranchesClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "BranchesClient.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, resourceGroupName, organizationName, projectName, branchName, properties, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// updateCreateRequest creates the Update request. -func (client *BranchesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, properties Branch, _ *BranchesClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, properties); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client_example_test.go index 68b151174101..d1908c40c322 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client_example_test.go @@ -8,7 +8,7 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) @@ -23,7 +23,7 @@ func ExampleBranchesClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewBranchesClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", "test-entity", "test-entity", armneonpostgres.Branch{ + poller, err := clientFactory.NewBranchesClient().BeginCreateOrUpdate(ctx, "rgneon", "contoso-org", "sample-resource", "sample-resource", armneonpostgres.Branch{ Properties: &armneonpostgres.BranchProperties{ EntityName: to.Ptr("entity-name"), Attributes: []*armneonpostgres.Attributes{ @@ -94,10 +94,7 @@ func ExampleBranchesClient_BeginCreateOrUpdate() { // res = armneonpostgres.BranchesClientCreateOrUpdateResponse{ // Branch: &armneonpostgres.Branch{ // Properties: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -110,10 +107,7 @@ func ExampleBranchesClient_BeginCreateOrUpdate() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -125,14 +119,14 @@ func ExampleBranchesClient_BeginCreateOrUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -141,14 +135,14 @@ func ExampleBranchesClient_BeginCreateOrUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -158,8 +152,14 @@ func ExampleBranchesClient_BeginCreateOrUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/test-entity/branches/test-entity"), // Name: to.Ptr("qdyblgfrtcnffzvm"), @@ -187,7 +187,7 @@ func ExampleBranchesClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewBranchesClient().Delete(ctx, "rgneon", "test-org", "entity-name", "entity-name", nil) + res, err := clientFactory.NewBranchesClient().Delete(ctx, "rgneon", "contoso-org", "sample-resource", "sample-resource", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -209,7 +209,7 @@ func ExampleBranchesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewBranchesClient().Get(ctx, "rgneon", "test-org", "entity-name", "entity-name", nil) + res, err := clientFactory.NewBranchesClient().Get(ctx, "rgneon", "contoso-org", "sample-resource", "sample-resource", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -219,10 +219,7 @@ func ExampleBranchesClient_Get() { // res = armneonpostgres.BranchesClientGetResponse{ // Branch: &armneonpostgres.Branch{ // Properties: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -235,10 +232,7 @@ func ExampleBranchesClient_Get() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -250,14 +244,14 @@ func ExampleBranchesClient_Get() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -266,14 +260,14 @@ func ExampleBranchesClient_Get() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -283,8 +277,14 @@ func ExampleBranchesClient_Get() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/test-entity/branches/test-entity"), // Name: to.Ptr("qdyblgfrtcnffzvm"), @@ -312,7 +312,7 @@ func ExampleBranchesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewBranchesClient().NewListPager("rgneon", "test-org", "entity-name", nil) + pager := clientFactory.NewBranchesClient().NewListPager("rgneon", "contoso-org", "sample-resource", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -413,167 +413,3 @@ func ExampleBranchesClient_NewListPager() { // } } } - -// Generated from example definition: 2025-03-01/Branches_Update_MaximumSet_Gen.json -func ExampleBranchesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBranchesClient().BeginUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", armneonpostgres.Branch{ - Properties: &armneonpostgres.BranchProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("oik"), - ParentID: to.Ptr("entity-id"), - RoleName: to.Ptr("qrrairsupyosxnqotdwhbpc"), - DatabaseName: to.Ptr("duhxebzhd"), - Roles: []*armneonpostgres.NeonRoleProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - Permissions: []*string{ - to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - }, - IsSuperUser: to.Ptr(true), - }, - }, - Databases: []*armneonpostgres.NeonDatabaseProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - OwnerName: to.Ptr("odmbeg"), - }, - }, - Endpoints: []*armneonpostgres.EndpointProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.BranchesClientUpdateResponse{ - // Branch: &armneonpostgres.Branch{ - // Properties: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("oik"), - // ParentID: to.Ptr("entity-id"), - // RoleName: to.Ptr("qrrairsupyosxnqotdwhbpc"), - // DatabaseName: to.Ptr("duhxebzhd"), - // Roles: []*armneonpostgres.NeonRoleProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - // Permissions: []*string{ - // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - // }, - // IsSuperUser: to.Ptr(true), - // }, - // }, - // Databases: []*armneonpostgres.NeonDatabaseProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - // OwnerName: to.Ptr("odmbeg"), - // }, - // }, - // Endpoints: []*armneonpostgres.EndpointProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - // }, - // }, - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/test-entity/branches/test-entity"), - // Name: to.Ptr("qdyblgfrtcnffzvm"), - // Type: to.Ptr("kciaergnu"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client.go index 5b75da4a0c5c..3e255f644cb8 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client.go @@ -39,250 +39,6 @@ func NewComputesClient(subscriptionID string, credential azcore.TokenCredential, return client, nil } -// BeginCreateOrUpdate - Create a Compute -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - computeName - The name of the Compute -// - resource - Resource create parameters. -// - options - ComputesClientBeginCreateOrUpdateOptions contains the optional parameters for the ComputesClient.BeginCreateOrUpdate -// method. -func (client *ComputesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, resource Compute, options *ComputesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ComputesClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, organizationName, projectName, branchName, computeName, resource, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ComputesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ComputesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Create a Compute -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *ComputesClient) createOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, resource Compute, options *ComputesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "ComputesClient.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, resourceGroupName, organizationName, projectName, branchName, computeName, resource, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ComputesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, resource Compute, _ *ComputesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/computes/{computeName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if computeName == "" { - return nil, errors.New("parameter computeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, resource); err != nil { - return nil, err - } - return req, nil -} - -// Delete - Delete a Compute -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - computeName - The name of the Compute -// - options - ComputesClientDeleteOptions contains the optional parameters for the ComputesClient.Delete method. -func (client *ComputesClient) Delete(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, options *ComputesClientDeleteOptions) (ComputesClientDeleteResponse, error) { - var err error - const operationName = "ComputesClient.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, resourceGroupName, organizationName, projectName, branchName, computeName, options) - if err != nil { - return ComputesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ComputesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ComputesClientDeleteResponse{}, err - } - return ComputesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ComputesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, _ *ComputesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/computes/{computeName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if computeName == "" { - return nil, errors.New("parameter computeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get a Compute -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - computeName - The name of the Compute -// - options - ComputesClientGetOptions contains the optional parameters for the ComputesClient.Get method. -func (client *ComputesClient) Get(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, options *ComputesClientGetOptions) (ComputesClientGetResponse, error) { - var err error - const operationName = "ComputesClient.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, resourceGroupName, organizationName, projectName, branchName, computeName, options) - if err != nil { - return ComputesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ComputesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ComputesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ComputesClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, _ *ComputesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/computes/{computeName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if computeName == "" { - return nil, errors.New("parameter computeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ComputesClient) getHandleResponse(resp *http.Response) (ComputesClientGetResponse, error) { - result := ComputesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Compute); err != nil { - return ComputesClientGetResponse{}, err - } - return result, nil -} - // NewListPager - List Compute resources by Branch // // Generated from API version 2025-03-01 @@ -356,98 +112,3 @@ func (client *ComputesClient) listHandleResponse(resp *http.Response) (ComputesC } return result, nil } - -// BeginUpdate - Update a Compute -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - computeName - The name of the Compute -// - properties - The resource properties to be updated. -// - options - ComputesClientBeginUpdateOptions contains the optional parameters for the ComputesClient.BeginUpdate method. -func (client *ComputesClient) BeginUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, properties Compute, options *ComputesClientBeginUpdateOptions) (*runtime.Poller[ComputesClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, organizationName, projectName, branchName, computeName, properties, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ComputesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ComputesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Update a Compute -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *ComputesClient) update(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, properties Compute, options *ComputesClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "ComputesClient.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, resourceGroupName, organizationName, projectName, branchName, computeName, properties, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// updateCreateRequest creates the Update request. -func (client *ComputesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, properties Compute, _ *ComputesClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/computes/{computeName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if computeName == "" { - return nil, errors.New("parameter computeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, properties); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client_example_test.go index 287cccfd223b..a8adb8182fde 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client_example_test.go @@ -6,154 +6,11 @@ package armneonpostgres_test import ( "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) -// Generated from example definition: 2025-03-01/Computes_CreateOrUpdate_MaximumSet_Gen.json -func ExampleComputesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewComputesClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.Compute{ - Properties: &armneonpostgres.ComputeProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - Region: to.Ptr("mcfyojzptdliawyuxyxzqxif"), - CPUCores: to.Ptr[int32](29), - Memory: to.Ptr[int32](2), - Status: to.Ptr("upwdpznysuwt"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.ComputesClientCreateOrUpdateResponse{ - // Compute: &armneonpostgres.Compute{ - // Properties: &armneonpostgres.ComputeProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("fbxqppwovhddxpc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // Region: to.Ptr("mcfyojzptdliawyuxyxzqxif"), - // CPUCores: to.Ptr[int32](29), - // Memory: to.Ptr[int32](2), - // Status: to.Ptr("upwdpznysuwt"), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/computes/entity-name"), - // Name: to.Ptr("xwrkuiwarigqtxumarfxrnfizsir"), - // Type: to.Ptr("jijglysxkpqbduahmqtwokmefgrk"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: 2025-03-01/Computes_Delete_MaximumSet_Gen.json -func ExampleComputesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComputesClient().Delete(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.ComputesClientDeleteResponse{ - // } -} - -// Generated from example definition: 2025-03-01/Computes_Get_MaximumSet_Gen.json -func ExampleComputesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComputesClient().Get(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.ComputesClientGetResponse{ - // Compute: &armneonpostgres.Compute{ - // Properties: &armneonpostgres.ComputeProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("fbxqppwovhddxpc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // Region: to.Ptr("mcfyojzptdliawyuxyxzqxif"), - // CPUCores: to.Ptr[int32](29), - // Memory: to.Ptr[int32](2), - // Status: to.Ptr("upwdpznysuwt"), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/computes/entity-name"), - // Name: to.Ptr("xwrkuiwarigqtxumarfxrnfizsir"), - // Type: to.Ptr("jijglysxkpqbduahmqtwokmefgrk"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - // Generated from example definition: 2025-03-01/Computes_List_MaximumSet_Gen.json func ExampleComputesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -165,7 +22,7 @@ func ExampleComputesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewComputesClient().NewListPager("rgneon", "test-org", "entity-name", "entity-name", nil) + pager := clientFactory.NewComputesClient().NewListPager("rgneon", "contoso-org", "sample-resource", "sample-resource", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -214,72 +71,3 @@ func ExampleComputesClient_NewListPager() { // } } } - -// Generated from example definition: 2025-03-01/Computes_Update_MaximumSet_Gen.json -func ExampleComputesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewComputesClient().BeginUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.Compute{ - Properties: &armneonpostgres.ComputeProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - Region: to.Ptr("mcfyojzptdliawyuxyxzqxif"), - CPUCores: to.Ptr[int32](29), - Memory: to.Ptr[int32](2), - Status: to.Ptr("upwdpznysuwt"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.ComputesClientUpdateResponse{ - // Compute: &armneonpostgres.Compute{ - // Properties: &armneonpostgres.ComputeProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("fbxqppwovhddxpc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // Region: to.Ptr("mcfyojzptdliawyuxyxzqxif"), - // CPUCores: to.Ptr[int32](29), - // Memory: to.Ptr[int32](2), - // Status: to.Ptr("upwdpznysuwt"), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/computes/entity-name"), - // Name: to.Ptr("xwrkuiwarigqtxumarfxrnfizsir"), - // Type: to.Ptr("jijglysxkpqbduahmqtwokmefgrk"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go index 971d13a2a83c..0cc2a1e6bbc4 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go @@ -6,7 +6,7 @@ package armneonpostgres const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client.go index 3aa39277f240..ee5c649c40f0 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client.go @@ -39,250 +39,6 @@ func NewEndpointsClient(subscriptionID string, credential azcore.TokenCredential return client, nil } -// BeginCreateOrUpdate - Create a Endpoint -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - endpointName - The name of the Endpoint -// - resource - Resource create parameters. -// - options - EndpointsClientBeginCreateOrUpdateOptions contains the optional parameters for the EndpointsClient.BeginCreateOrUpdate -// method. -func (client *EndpointsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, resource Endpoint, options *EndpointsClientBeginCreateOrUpdateOptions) (*runtime.Poller[EndpointsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, organizationName, projectName, branchName, endpointName, resource, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EndpointsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EndpointsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Create a Endpoint -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *EndpointsClient) createOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, resource Endpoint, options *EndpointsClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "EndpointsClient.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, resourceGroupName, organizationName, projectName, branchName, endpointName, resource, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *EndpointsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, resource Endpoint, _ *EndpointsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/endpoints/{endpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if endpointName == "" { - return nil, errors.New("parameter endpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", url.PathEscape(endpointName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, resource); err != nil { - return nil, err - } - return req, nil -} - -// Delete - Delete a Endpoint -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - endpointName - The name of the Endpoint -// - options - EndpointsClientDeleteOptions contains the optional parameters for the EndpointsClient.Delete method. -func (client *EndpointsClient) Delete(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, options *EndpointsClientDeleteOptions) (EndpointsClientDeleteResponse, error) { - var err error - const operationName = "EndpointsClient.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, resourceGroupName, organizationName, projectName, branchName, endpointName, options) - if err != nil { - return EndpointsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientDeleteResponse{}, err - } - return EndpointsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *EndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, _ *EndpointsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/endpoints/{endpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if endpointName == "" { - return nil, errors.New("parameter endpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", url.PathEscape(endpointName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get a Endpoint -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - endpointName - The name of the Endpoint -// - options - EndpointsClientGetOptions contains the optional parameters for the EndpointsClient.Get method. -func (client *EndpointsClient) Get(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, options *EndpointsClientGetOptions) (EndpointsClientGetResponse, error) { - var err error - const operationName = "EndpointsClient.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, resourceGroupName, organizationName, projectName, branchName, endpointName, options) - if err != nil { - return EndpointsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *EndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, _ *EndpointsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/endpoints/{endpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if endpointName == "" { - return nil, errors.New("parameter endpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", url.PathEscape(endpointName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *EndpointsClient) getHandleResponse(resp *http.Response) (EndpointsClientGetResponse, error) { - result := EndpointsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Endpoint); err != nil { - return EndpointsClientGetResponse{}, err - } - return result, nil -} - // NewListPager - List Endpoint resources by Branch // // Generated from API version 2025-03-01 @@ -356,98 +112,3 @@ func (client *EndpointsClient) listHandleResponse(resp *http.Response) (Endpoint } return result, nil } - -// BeginUpdate - Update a Endpoint -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - endpointName - The name of the Endpoint -// - properties - The resource properties to be updated. -// - options - EndpointsClientBeginUpdateOptions contains the optional parameters for the EndpointsClient.BeginUpdate method. -func (client *EndpointsClient) BeginUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, properties Endpoint, options *EndpointsClientBeginUpdateOptions) (*runtime.Poller[EndpointsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, organizationName, projectName, branchName, endpointName, properties, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EndpointsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EndpointsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Update a Endpoint -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *EndpointsClient) update(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, properties Endpoint, options *EndpointsClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "EndpointsClient.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, resourceGroupName, organizationName, projectName, branchName, endpointName, properties, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// updateCreateRequest creates the Update request. -func (client *EndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, properties Endpoint, _ *EndpointsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/endpoints/{endpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if endpointName == "" { - return nil, errors.New("parameter endpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", url.PathEscape(endpointName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, properties); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client_example_test.go index 25711eedf910..a40769a15f51 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client_example_test.go @@ -6,151 +6,11 @@ package armneonpostgres_test import ( "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) -// Generated from example definition: 2025-03-01/Endpoints_CreateOrUpdate_MaximumSet_Gen.json -func ExampleEndpointsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewEndpointsClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.Endpoint{ - Properties: &armneonpostgres.EndpointProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.EndpointsClientCreateOrUpdateResponse{ - // Endpoint: &armneonpostgres.Endpoint{ - // Properties: &armneonpostgres.EndpointProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/endpoints/entity-name"), - // Name: to.Ptr("btfgrpluxpodftoy"), - // Type: to.Ptr("ldmicxcfahaewxfelpamtgb"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: 2025-03-01/Endpoints_Delete_MaximumSet_Gen.json -func ExampleEndpointsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().Delete(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.EndpointsClientDeleteResponse{ - // } -} - -// Generated from example definition: 2025-03-01/Endpoints_Get_MaximumSet_Gen.json -func ExampleEndpointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().Get(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.EndpointsClientGetResponse{ - // Endpoint: &armneonpostgres.Endpoint{ - // Properties: &armneonpostgres.EndpointProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/endpoints/entity-name"), - // Name: to.Ptr("btfgrpluxpodftoy"), - // Type: to.Ptr("ldmicxcfahaewxfelpamtgb"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - // Generated from example definition: 2025-03-01/Endpoints_List_MaximumSet_Gen.json func ExampleEndpointsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -162,7 +22,7 @@ func ExampleEndpointsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewEndpointsClient().NewListPager("rgneon", "test-org", "entity-name", "entity-name", nil) + pager := clientFactory.NewEndpointsClient().NewListPager("rgneon", "contoso-org", "sample-resource", "sample-resource", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -210,70 +70,3 @@ func ExampleEndpointsClient_NewListPager() { // } } } - -// Generated from example definition: 2025-03-01/Endpoints_Update_MaximumSet_Gen.json -func ExampleEndpointsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewEndpointsClient().BeginUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.Endpoint{ - Properties: &armneonpostgres.EndpointProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.EndpointsClientUpdateResponse{ - // Endpoint: &armneonpostgres.Endpoint{ - // Properties: &armneonpostgres.EndpointProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/endpoints/entity-name"), - // Name: to.Ptr("btfgrpluxpodftoy"), - // Type: to.Ptr("ldmicxcfahaewxfelpamtgb"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/branches_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/branches_server.go index 99f8ab877d24..57440ad33ee7 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/branches_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/branches_server.go @@ -12,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "regexp" @@ -35,10 +35,6 @@ type BranchesServer struct { // NewListPager is the fake for method BranchesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, organizationName string, projectName string, options *armneonpostgres.BranchesClientListOptions) (resp azfake.PagerResponder[armneonpostgres.BranchesClientListResponse]) - - // BeginUpdate is the fake for method BranchesClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, properties armneonpostgres.Branch, options *armneonpostgres.BranchesClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.BranchesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewBranchesServerTransport creates a new instance of BranchesServerTransport with the provided implementation. @@ -49,7 +45,6 @@ func NewBranchesServerTransport(srv *BranchesServer) *BranchesServerTransport { srv: srv, beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.BranchesClientCreateOrUpdateResponse]](), newListPager: newTracker[azfake.PagerResponder[armneonpostgres.BranchesClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.BranchesClientUpdateResponse]](), } } @@ -59,7 +54,6 @@ type BranchesServerTransport struct { srv *BranchesServer beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.BranchesClientCreateOrUpdateResponse]] newListPager *tracker[azfake.PagerResponder[armneonpostgres.BranchesClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.BranchesClientUpdateResponse]] } // Do implements the policy.Transporter interface for BranchesServerTransport. @@ -93,8 +87,6 @@ func (b *BranchesServerTransport) dispatchToMethodFake(req *http.Request, method res.resp, res.err = b.dispatchGet(req) case "BranchesClient.NewListPager": res.resp, res.err = b.dispatchNewListPager(req) - case "BranchesClient.BeginUpdate": - res.resp, res.err = b.dispatchBeginUpdate(req) default: res.err = fmt.Errorf("unhandled API %s", method) } @@ -123,7 +115,7 @@ func (b *BranchesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armneonpostgres.Branch](req) @@ -177,7 +169,7 @@ func (b *BranchesServerTransport) dispatchDelete(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -218,7 +210,7 @@ func (b *BranchesServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -261,7 +253,7 @@ func (b *BranchesServerTransport) dispatchNewListPager(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -297,62 +289,6 @@ func (b *BranchesServerTransport) dispatchNewListPager(req *http.Request) (*http return resp, nil } -func (b *BranchesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if b.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := b.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.Branch](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - b.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) { - b.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) { - b.beginUpdate.remove(req) - } - - return resp, nil -} - // set this to conditionally intercept incoming requests to BranchesServerTransport var branchesServerTransportInterceptor interface { // Do returns true if the server transport should use the returned response/error diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/computes_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/computes_server.go index fdfbe51b7b3f..f53742bb540a 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/computes_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/computes_server.go @@ -5,14 +5,13 @@ 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/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "regexp" @@ -20,25 +19,9 @@ import ( // ComputesServer is a fake server for instances of the armneonpostgres.ComputesClient type. type ComputesServer struct { - // BeginCreateOrUpdate is the fake for method ComputesClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, resource armneonpostgres.Compute, options *armneonpostgres.ComputesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.ComputesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ComputesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, options *armneonpostgres.ComputesClientDeleteOptions) (resp azfake.Responder[armneonpostgres.ComputesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ComputesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, options *armneonpostgres.ComputesClientGetOptions) (resp azfake.Responder[armneonpostgres.ComputesClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method ComputesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, organizationName string, projectName string, branchName string, options *armneonpostgres.ComputesClientListOptions) (resp azfake.PagerResponder[armneonpostgres.ComputesClientListResponse]) - - // BeginUpdate is the fake for method ComputesClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, properties armneonpostgres.Compute, options *armneonpostgres.ComputesClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.ComputesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewComputesServerTransport creates a new instance of ComputesServerTransport with the provided implementation. @@ -46,20 +29,16 @@ type ComputesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewComputesServerTransport(srv *ComputesServer) *ComputesServerTransport { return &ComputesServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.ComputesClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armneonpostgres.ComputesClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.ComputesClientUpdateResponse]](), + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armneonpostgres.ComputesClientListResponse]](), } } // ComputesServerTransport connects instances of armneonpostgres.ComputesClient to instances of ComputesServer. // Don't use this type directly, use NewComputesServerTransport instead. type ComputesServerTransport struct { - srv *ComputesServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.ComputesClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armneonpostgres.ComputesClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.ComputesClientUpdateResponse]] + srv *ComputesServer + newListPager *tracker[azfake.PagerResponder[armneonpostgres.ComputesClientListResponse]] } // Do implements the policy.Transporter interface for ComputesServerTransport. @@ -85,16 +64,8 @@ func (c *ComputesServerTransport) dispatchToMethodFake(req *http.Request, method } if !intercepted { switch method { - case "ComputesClient.BeginCreateOrUpdate": - res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) - case "ComputesClient.Delete": - res.resp, res.err = c.dispatchDelete(req) - case "ComputesClient.Get": - res.resp, res.err = c.dispatchGet(req) case "ComputesClient.NewListPager": res.resp, res.err = c.dispatchNewListPager(req) - case "ComputesClient.BeginUpdate": - res.resp, res.err = c.dispatchBeginUpdate(req) default: res.err = fmt.Errorf("unhandled API %s", method) } @@ -114,156 +85,6 @@ func (c *ComputesServerTransport) dispatchToMethodFake(req *http.Request, method } } -func (c *ComputesServerTransport) 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 = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.Compute](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, computeNameParam, 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 *ComputesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if c.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, computeNameParam, 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 (c *ComputesServerTransport) 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 = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, computeNameParam, 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).Compute, req) - if err != nil { - return nil, err - } - return resp, nil -} - func (c *ComputesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if c.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} @@ -273,7 +94,7 @@ func (c *ComputesServerTransport) dispatchNewListPager(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computes` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -313,66 +134,6 @@ func (c *ComputesServerTransport) dispatchNewListPager(req *http.Request) (*http return resp, nil } -func (c *ComputesServerTransport) 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 = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.Compute](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, computeNameParam, 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 ComputesServerTransport var computesServerTransportInterceptor interface { // Do returns true if the server transport should use the returned response/error diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/endpoints_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/endpoints_server.go index 03379f54df51..40c72cf7e457 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/endpoints_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/endpoints_server.go @@ -5,14 +5,13 @@ 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/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "regexp" @@ -20,25 +19,9 @@ import ( // EndpointsServer is a fake server for instances of the armneonpostgres.EndpointsClient type. type EndpointsServer struct { - // BeginCreateOrUpdate is the fake for method EndpointsClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, resource armneonpostgres.Endpoint, options *armneonpostgres.EndpointsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.EndpointsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method EndpointsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, options *armneonpostgres.EndpointsClientDeleteOptions) (resp azfake.Responder[armneonpostgres.EndpointsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method EndpointsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, options *armneonpostgres.EndpointsClientGetOptions) (resp azfake.Responder[armneonpostgres.EndpointsClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method EndpointsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, organizationName string, projectName string, branchName string, options *armneonpostgres.EndpointsClientListOptions) (resp azfake.PagerResponder[armneonpostgres.EndpointsClientListResponse]) - - // BeginUpdate is the fake for method EndpointsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, properties armneonpostgres.Endpoint, options *armneonpostgres.EndpointsClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.EndpointsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewEndpointsServerTransport creates a new instance of EndpointsServerTransport with the provided implementation. @@ -46,20 +29,16 @@ type EndpointsServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewEndpointsServerTransport(srv *EndpointsServer) *EndpointsServerTransport { return &EndpointsServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.EndpointsClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armneonpostgres.EndpointsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.EndpointsClientUpdateResponse]](), + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armneonpostgres.EndpointsClientListResponse]](), } } // EndpointsServerTransport connects instances of armneonpostgres.EndpointsClient to instances of EndpointsServer. // Don't use this type directly, use NewEndpointsServerTransport instead. type EndpointsServerTransport struct { - srv *EndpointsServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.EndpointsClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armneonpostgres.EndpointsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.EndpointsClientUpdateResponse]] + srv *EndpointsServer + newListPager *tracker[azfake.PagerResponder[armneonpostgres.EndpointsClientListResponse]] } // Do implements the policy.Transporter interface for EndpointsServerTransport. @@ -85,16 +64,8 @@ func (e *EndpointsServerTransport) dispatchToMethodFake(req *http.Request, metho } if !intercepted { switch method { - case "EndpointsClient.BeginCreateOrUpdate": - res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) - case "EndpointsClient.Delete": - res.resp, res.err = e.dispatchDelete(req) - case "EndpointsClient.Get": - res.resp, res.err = e.dispatchGet(req) case "EndpointsClient.NewListPager": res.resp, res.err = e.dispatchNewListPager(req) - case "EndpointsClient.BeginUpdate": - res.resp, res.err = e.dispatchBeginUpdate(req) default: res.err = fmt.Errorf("unhandled API %s", method) } @@ -114,156 +85,6 @@ func (e *EndpointsServerTransport) dispatchToMethodFake(req *http.Request, metho } } -func (e *EndpointsServerTransport) 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 = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.Endpoint](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, endpointNameParam, 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 *EndpointsServerTransport) 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 = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Delete(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, endpointNameParam, 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 *EndpointsServerTransport) 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 = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, endpointNameParam, 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).Endpoint, req) - if err != nil { - return nil, err - } - return resp, nil -} - func (e *EndpointsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if e.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} @@ -273,7 +94,7 @@ func (e *EndpointsServerTransport) dispatchNewListPager(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/endpoints` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -313,66 +134,6 @@ func (e *EndpointsServerTransport) dispatchNewListPager(req *http.Request) (*htt return resp, nil } -func (e *EndpointsServerTransport) 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 = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.Endpoint](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, endpointNameParam, 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 EndpointsServerTransport var endpointsServerTransportInterceptor interface { // Do returns true if the server transport should use the returned response/error diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neondatabases_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neondatabases_server.go index d8919dcffe8a..d2452f37ed1c 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neondatabases_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neondatabases_server.go @@ -5,14 +5,13 @@ 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/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "regexp" @@ -20,25 +19,9 @@ import ( // NeonDatabasesServer is a fake server for instances of the armneonpostgres.NeonDatabasesClient type. type NeonDatabasesServer struct { - // BeginCreateOrUpdate is the fake for method NeonDatabasesClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, resource armneonpostgres.NeonDatabase, options *armneonpostgres.NeonDatabasesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.NeonDatabasesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method NeonDatabasesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, options *armneonpostgres.NeonDatabasesClientDeleteOptions) (resp azfake.Responder[armneonpostgres.NeonDatabasesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method NeonDatabasesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, options *armneonpostgres.NeonDatabasesClientGetOptions) (resp azfake.Responder[armneonpostgres.NeonDatabasesClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method NeonDatabasesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, organizationName string, projectName string, branchName string, options *armneonpostgres.NeonDatabasesClientListOptions) (resp azfake.PagerResponder[armneonpostgres.NeonDatabasesClientListResponse]) - - // BeginUpdate is the fake for method NeonDatabasesClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, properties armneonpostgres.NeonDatabase, options *armneonpostgres.NeonDatabasesClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.NeonDatabasesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewNeonDatabasesServerTransport creates a new instance of NeonDatabasesServerTransport with the provided implementation. @@ -46,20 +29,16 @@ type NeonDatabasesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewNeonDatabasesServerTransport(srv *NeonDatabasesServer) *NeonDatabasesServerTransport { return &NeonDatabasesServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.NeonDatabasesClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armneonpostgres.NeonDatabasesClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.NeonDatabasesClientUpdateResponse]](), + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armneonpostgres.NeonDatabasesClientListResponse]](), } } // NeonDatabasesServerTransport connects instances of armneonpostgres.NeonDatabasesClient to instances of NeonDatabasesServer. // Don't use this type directly, use NewNeonDatabasesServerTransport instead. type NeonDatabasesServerTransport struct { - srv *NeonDatabasesServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.NeonDatabasesClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armneonpostgres.NeonDatabasesClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.NeonDatabasesClientUpdateResponse]] + srv *NeonDatabasesServer + newListPager *tracker[azfake.PagerResponder[armneonpostgres.NeonDatabasesClientListResponse]] } // Do implements the policy.Transporter interface for NeonDatabasesServerTransport. @@ -85,16 +64,8 @@ func (n *NeonDatabasesServerTransport) dispatchToMethodFake(req *http.Request, m } if !intercepted { switch method { - case "NeonDatabasesClient.BeginCreateOrUpdate": - res.resp, res.err = n.dispatchBeginCreateOrUpdate(req) - case "NeonDatabasesClient.Delete": - res.resp, res.err = n.dispatchDelete(req) - case "NeonDatabasesClient.Get": - res.resp, res.err = n.dispatchGet(req) case "NeonDatabasesClient.NewListPager": res.resp, res.err = n.dispatchNewListPager(req) - case "NeonDatabasesClient.BeginUpdate": - res.resp, res.err = n.dispatchBeginUpdate(req) default: res.err = fmt.Errorf("unhandled API %s", method) } @@ -114,156 +85,6 @@ func (n *NeonDatabasesServerTransport) dispatchToMethodFake(req *http.Request, m } } -func (n *NeonDatabasesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if n.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := n.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.NeonDatabase](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonDatabaseName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonDatabaseNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - n.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) { - n.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) { - n.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (n *NeonDatabasesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if n.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonDatabaseName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.Delete(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonDatabaseNameParam, 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 (n *NeonDatabasesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if n.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonDatabaseName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.Get(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonDatabaseNameParam, 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).NeonDatabase, req) - if err != nil { - return nil, err - } - return resp, nil -} - func (n *NeonDatabasesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if n.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} @@ -273,7 +94,7 @@ func (n *NeonDatabasesServerTransport) dispatchNewListPager(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonDatabases` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -313,66 +134,6 @@ func (n *NeonDatabasesServerTransport) dispatchNewListPager(req *http.Request) ( return resp, nil } -func (n *NeonDatabasesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if n.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := n.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.NeonDatabase](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonDatabaseName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonDatabaseNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - n.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) { - n.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) { - n.beginUpdate.remove(req) - } - - return resp, nil -} - // set this to conditionally intercept incoming requests to NeonDatabasesServerTransport var neonDatabasesServerTransportInterceptor interface { // Do returns true if the server transport should use the returned response/error diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neonroles_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neonroles_server.go index f76f706577a4..6f003c9985f7 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neonroles_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neonroles_server.go @@ -5,14 +5,13 @@ 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/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "regexp" @@ -20,25 +19,9 @@ import ( // NeonRolesServer is a fake server for instances of the armneonpostgres.NeonRolesClient type. type NeonRolesServer struct { - // BeginCreateOrUpdate is the fake for method NeonRolesClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, resource armneonpostgres.NeonRole, options *armneonpostgres.NeonRolesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.NeonRolesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method NeonRolesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, options *armneonpostgres.NeonRolesClientDeleteOptions) (resp azfake.Responder[armneonpostgres.NeonRolesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method NeonRolesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, options *armneonpostgres.NeonRolesClientGetOptions) (resp azfake.Responder[armneonpostgres.NeonRolesClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method NeonRolesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, organizationName string, projectName string, branchName string, options *armneonpostgres.NeonRolesClientListOptions) (resp azfake.PagerResponder[armneonpostgres.NeonRolesClientListResponse]) - - // BeginUpdate is the fake for method NeonRolesClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, properties armneonpostgres.NeonRole, options *armneonpostgres.NeonRolesClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.NeonRolesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewNeonRolesServerTransport creates a new instance of NeonRolesServerTransport with the provided implementation. @@ -46,20 +29,16 @@ type NeonRolesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewNeonRolesServerTransport(srv *NeonRolesServer) *NeonRolesServerTransport { return &NeonRolesServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.NeonRolesClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armneonpostgres.NeonRolesClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.NeonRolesClientUpdateResponse]](), + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armneonpostgres.NeonRolesClientListResponse]](), } } // NeonRolesServerTransport connects instances of armneonpostgres.NeonRolesClient to instances of NeonRolesServer. // Don't use this type directly, use NewNeonRolesServerTransport instead. type NeonRolesServerTransport struct { - srv *NeonRolesServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.NeonRolesClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armneonpostgres.NeonRolesClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.NeonRolesClientUpdateResponse]] + srv *NeonRolesServer + newListPager *tracker[azfake.PagerResponder[armneonpostgres.NeonRolesClientListResponse]] } // Do implements the policy.Transporter interface for NeonRolesServerTransport. @@ -85,16 +64,8 @@ func (n *NeonRolesServerTransport) dispatchToMethodFake(req *http.Request, metho } if !intercepted { switch method { - case "NeonRolesClient.BeginCreateOrUpdate": - res.resp, res.err = n.dispatchBeginCreateOrUpdate(req) - case "NeonRolesClient.Delete": - res.resp, res.err = n.dispatchDelete(req) - case "NeonRolesClient.Get": - res.resp, res.err = n.dispatchGet(req) case "NeonRolesClient.NewListPager": res.resp, res.err = n.dispatchNewListPager(req) - case "NeonRolesClient.BeginUpdate": - res.resp, res.err = n.dispatchBeginUpdate(req) default: res.err = fmt.Errorf("unhandled API %s", method) } @@ -114,156 +85,6 @@ func (n *NeonRolesServerTransport) dispatchToMethodFake(req *http.Request, metho } } -func (n *NeonRolesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if n.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := n.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonRoles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.NeonRole](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonRoleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonRoleName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonRoleNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - n.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) { - n.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) { - n.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (n *NeonRolesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if n.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonRoles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonRoleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonRoleName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.Delete(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonRoleNameParam, 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 (n *NeonRolesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if n.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonRoles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonRoleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonRoleName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.Get(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonRoleNameParam, 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).NeonRole, req) - if err != nil { - return nil, err - } - return resp, nil -} - func (n *NeonRolesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if n.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} @@ -273,7 +94,7 @@ func (n *NeonRolesServerTransport) dispatchNewListPager(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonRoles` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -313,66 +134,6 @@ func (n *NeonRolesServerTransport) dispatchNewListPager(req *http.Request) (*htt return resp, nil } -func (n *NeonRolesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if n.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := n.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonRoles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.NeonRole](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonRoleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonRoleName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonRoleNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - n.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) { - n.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) { - n.beginUpdate.remove(req) - } - - return resp, nil -} - // set this to conditionally intercept incoming requests to NeonRolesServerTransport var neonRolesServerTransportInterceptor interface { // Do returns true if the server transport should use the returned response/error diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go index c30b0623a4d2..10e64ce0133c 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go @@ -11,7 +11,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" ) diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go index ee08557db4b2..3253c730b008 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go @@ -12,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "reflect" @@ -140,7 +140,7 @@ func (o *OrganizationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armneonpostgres.OrganizationResource](req) @@ -188,7 +188,7 @@ func (o *OrganizationsServerTransport) dispatchBeginDelete(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -230,7 +230,7 @@ func (o *OrganizationsServerTransport) dispatchGet(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -263,7 +263,7 @@ func (o *OrganizationsServerTransport) dispatchGetPostgresVersions(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/getPostgresVersions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armneonpostgres.PgVersion](req) @@ -304,7 +304,7 @@ func (o *OrganizationsServerTransport) dispatchNewListByResourceGroupPager(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -341,7 +341,7 @@ func (o *OrganizationsServerTransport) dispatchNewListBySubscriptionPager(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := o.srv.NewListBySubscriptionPager(nil) @@ -374,7 +374,7 @@ func (o *OrganizationsServerTransport) dispatchBeginUpdate(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armneonpostgres.OrganizationResource](req) diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/projects_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/projects_server.go index 4b2096504e8b..d6a03c7d9131 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/projects_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/projects_server.go @@ -12,7 +12,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "regexp" @@ -39,10 +39,6 @@ type ProjectsServer struct { // NewListPager is the fake for method ProjectsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, organizationName string, options *armneonpostgres.ProjectsClientListOptions) (resp azfake.PagerResponder[armneonpostgres.ProjectsClientListResponse]) - - // BeginUpdate is the fake for method ProjectsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, properties armneonpostgres.Project, options *armneonpostgres.ProjectsClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.ProjectsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewProjectsServerTransport creates a new instance of ProjectsServerTransport with the provided implementation. @@ -53,7 +49,6 @@ func NewProjectsServerTransport(srv *ProjectsServer) *ProjectsServerTransport { srv: srv, beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.ProjectsClientCreateOrUpdateResponse]](), newListPager: newTracker[azfake.PagerResponder[armneonpostgres.ProjectsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.ProjectsClientUpdateResponse]](), } } @@ -63,7 +58,6 @@ type ProjectsServerTransport struct { srv *ProjectsServer beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.ProjectsClientCreateOrUpdateResponse]] newListPager *tracker[azfake.PagerResponder[armneonpostgres.ProjectsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.ProjectsClientUpdateResponse]] } // Do implements the policy.Transporter interface for ProjectsServerTransport. @@ -99,8 +93,6 @@ func (p *ProjectsServerTransport) dispatchToMethodFake(req *http.Request, method res.resp, res.err = p.dispatchGetConnectionURI(req) case "ProjectsClient.NewListPager": res.resp, res.err = p.dispatchNewListPager(req) - case "ProjectsClient.BeginUpdate": - res.resp, res.err = p.dispatchBeginUpdate(req) default: res.err = fmt.Errorf("unhandled API %s", method) } @@ -129,7 +121,7 @@ func (p *ProjectsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armneonpostgres.Project](req) @@ -179,7 +171,7 @@ func (p *ProjectsServerTransport) dispatchDelete(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -216,7 +208,7 @@ func (p *ProjectsServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -253,7 +245,7 @@ func (p *ProjectsServerTransport) dispatchGetConnectionURI(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getConnectionUri` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armneonpostgres.ConnectionURIProperties](req) @@ -296,7 +288,7 @@ func (p *ProjectsServerTransport) dispatchNewListPager(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -328,58 +320,6 @@ func (p *ProjectsServerTransport) dispatchNewListPager(req *http.Request) (*http return resp, nil } -func (p *ProjectsServerTransport) 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 = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?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[armneonpostgres.Project](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, 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 ProjectsServerTransport var projectsServerTransportInterceptor interface { // Do returns true if the server transport should use the returned response/error diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. - -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/sdk/resourcemanager/neonpostgres/armneonpostgres/go.mod b/sdk/resourcemanager/neonpostgres/armneonpostgres/go.mod index 54bd1fda7f73..0a72882497fb 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/go.mod +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2 go 1.23.0 diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go index f5d951dafd42..bcfb72ba8570 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go @@ -384,7 +384,9 @@ type OfferDetails struct { TermUnit *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API Operation +// +// Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. Display *OperationDisplay diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client.go index eb299b5af83d..a744a8ee42fb 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client.go @@ -39,250 +39,6 @@ func NewNeonDatabasesClient(subscriptionID string, credential azcore.TokenCreden return client, nil } -// BeginCreateOrUpdate - Create a NeonDatabase -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonDatabaseName - The name of the NeonDatabase -// - resource - Resource create parameters. -// - options - NeonDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the NeonDatabasesClient.BeginCreateOrUpdate -// method. -func (client *NeonDatabasesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, resource NeonDatabase, options *NeonDatabasesClientBeginCreateOrUpdateOptions) (*runtime.Poller[NeonDatabasesClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, organizationName, projectName, branchName, neonDatabaseName, resource, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NeonDatabasesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NeonDatabasesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Create a NeonDatabase -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *NeonDatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, resource NeonDatabase, options *NeonDatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "NeonDatabasesClient.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, resourceGroupName, organizationName, projectName, branchName, neonDatabaseName, resource, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *NeonDatabasesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, resource NeonDatabase, _ *NeonDatabasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonDatabases/{neonDatabaseName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonDatabaseName == "" { - return nil, errors.New("parameter neonDatabaseName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonDatabaseName}", url.PathEscape(neonDatabaseName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, resource); err != nil { - return nil, err - } - return req, nil -} - -// Delete - Delete a NeonDatabase -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonDatabaseName - The name of the NeonDatabase -// - options - NeonDatabasesClientDeleteOptions contains the optional parameters for the NeonDatabasesClient.Delete method. -func (client *NeonDatabasesClient) Delete(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, options *NeonDatabasesClientDeleteOptions) (NeonDatabasesClientDeleteResponse, error) { - var err error - const operationName = "NeonDatabasesClient.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, resourceGroupName, organizationName, projectName, branchName, neonDatabaseName, options) - if err != nil { - return NeonDatabasesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NeonDatabasesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return NeonDatabasesClientDeleteResponse{}, err - } - return NeonDatabasesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *NeonDatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, _ *NeonDatabasesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonDatabases/{neonDatabaseName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonDatabaseName == "" { - return nil, errors.New("parameter neonDatabaseName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonDatabaseName}", url.PathEscape(neonDatabaseName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get a NeonDatabase -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonDatabaseName - The name of the NeonDatabase -// - options - NeonDatabasesClientGetOptions contains the optional parameters for the NeonDatabasesClient.Get method. -func (client *NeonDatabasesClient) Get(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, options *NeonDatabasesClientGetOptions) (NeonDatabasesClientGetResponse, error) { - var err error - const operationName = "NeonDatabasesClient.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, resourceGroupName, organizationName, projectName, branchName, neonDatabaseName, options) - if err != nil { - return NeonDatabasesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NeonDatabasesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return NeonDatabasesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *NeonDatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, _ *NeonDatabasesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonDatabases/{neonDatabaseName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonDatabaseName == "" { - return nil, errors.New("parameter neonDatabaseName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonDatabaseName}", url.PathEscape(neonDatabaseName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *NeonDatabasesClient) getHandleResponse(resp *http.Response) (NeonDatabasesClientGetResponse, error) { - result := NeonDatabasesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.NeonDatabase); err != nil { - return NeonDatabasesClientGetResponse{}, err - } - return result, nil -} - // NewListPager - List NeonDatabase resources by Branch // // Generated from API version 2025-03-01 @@ -356,99 +112,3 @@ func (client *NeonDatabasesClient) listHandleResponse(resp *http.Response) (Neon } return result, nil } - -// BeginUpdate - Update a NeonDatabase -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonDatabaseName - The name of the NeonDatabase -// - properties - The resource properties to be updated. -// - options - NeonDatabasesClientBeginUpdateOptions contains the optional parameters for the NeonDatabasesClient.BeginUpdate -// method. -func (client *NeonDatabasesClient) BeginUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, properties NeonDatabase, options *NeonDatabasesClientBeginUpdateOptions) (*runtime.Poller[NeonDatabasesClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, organizationName, projectName, branchName, neonDatabaseName, properties, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NeonDatabasesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NeonDatabasesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Update a NeonDatabase -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *NeonDatabasesClient) update(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, properties NeonDatabase, options *NeonDatabasesClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "NeonDatabasesClient.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, resourceGroupName, organizationName, projectName, branchName, neonDatabaseName, properties, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// updateCreateRequest creates the Update request. -func (client *NeonDatabasesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, properties NeonDatabase, _ *NeonDatabasesClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonDatabases/{neonDatabaseName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonDatabaseName == "" { - return nil, errors.New("parameter neonDatabaseName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonDatabaseName}", url.PathEscape(neonDatabaseName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, properties); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client_example_test.go index b50201a22b47..84272e6b1893 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client_example_test.go @@ -6,148 +6,11 @@ package armneonpostgres_test import ( "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) -// Generated from example definition: 2025-03-01/NeonDatabases_CreateOrUpdate_MaximumSet_Gen.json -func ExampleNeonDatabasesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNeonDatabasesClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.NeonDatabase{ - Properties: &armneonpostgres.NeonDatabaseProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - OwnerName: to.Ptr("odmbeg"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonDatabasesClientCreateOrUpdateResponse{ - // NeonDatabase: &armneonpostgres.NeonDatabase{ - // Properties: &armneonpostgres.NeonDatabaseProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - // OwnerName: to.Ptr("odmbeg"), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/neonDatabases/entity-name"), - // Name: to.Ptr("awzpsbzkfarwnmi"), - // Type: to.Ptr("eltqxh"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: 2025-03-01/NeonDatabases_Delete_MaximumSet_Gen.json -func ExampleNeonDatabasesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNeonDatabasesClient().Delete(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonDatabasesClientDeleteResponse{ - // } -} - -// Generated from example definition: 2025-03-01/NeonDatabases_Get_MaximumSet_Gen.json -func ExampleNeonDatabasesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNeonDatabasesClient().Get(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonDatabasesClientGetResponse{ - // NeonDatabase: &armneonpostgres.NeonDatabase{ - // Properties: &armneonpostgres.NeonDatabaseProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - // OwnerName: to.Ptr("odmbeg"), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/neonDatabases/entity-name"), - // Name: to.Ptr("awzpsbzkfarwnmi"), - // Type: to.Ptr("eltqxh"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - // Generated from example definition: 2025-03-01/NeonDatabases_List_MaximumSet_Gen.json func ExampleNeonDatabasesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -159,7 +22,7 @@ func ExampleNeonDatabasesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewNeonDatabasesClient().NewListPager("rgneon", "test-org", "entity-name", "entity-name", nil) + pager := clientFactory.NewNeonDatabasesClient().NewListPager("rgneon", "contoso-org", "sample-resource", "sample-resource", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -206,68 +69,3 @@ func ExampleNeonDatabasesClient_NewListPager() { // } } } - -// Generated from example definition: 2025-03-01/NeonDatabases_Update_MaximumSet_Gen.json -func ExampleNeonDatabasesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNeonDatabasesClient().BeginUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.NeonDatabase{ - Properties: &armneonpostgres.NeonDatabaseProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - OwnerName: to.Ptr("odmbeg"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonDatabasesClientUpdateResponse{ - // NeonDatabase: &armneonpostgres.NeonDatabase{ - // Properties: &armneonpostgres.NeonDatabaseProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - // OwnerName: to.Ptr("odmbeg"), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/neonDatabases/entity-name"), - // Name: to.Ptr("awzpsbzkfarwnmi"), - // Type: to.Ptr("eltqxh"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/neonpostgres_live_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/neonpostgres_live_test.go index 292b645b5a96..6cf0b3db88ce 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/neonpostgres_live_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/neonpostgres_live_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client.go index 9dff5352591a..75ef59a1dd9e 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client.go @@ -39,250 +39,6 @@ func NewNeonRolesClient(subscriptionID string, credential azcore.TokenCredential return client, nil } -// BeginCreateOrUpdate - Create a NeonRole -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonRoleName - The name of the NeonRole -// - resource - Resource create parameters. -// - options - NeonRolesClientBeginCreateOrUpdateOptions contains the optional parameters for the NeonRolesClient.BeginCreateOrUpdate -// method. -func (client *NeonRolesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, resource NeonRole, options *NeonRolesClientBeginCreateOrUpdateOptions) (*runtime.Poller[NeonRolesClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, organizationName, projectName, branchName, neonRoleName, resource, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NeonRolesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NeonRolesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Create a NeonRole -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *NeonRolesClient) createOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, resource NeonRole, options *NeonRolesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "NeonRolesClient.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, resourceGroupName, organizationName, projectName, branchName, neonRoleName, resource, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *NeonRolesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, resource NeonRole, _ *NeonRolesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonRoles/{neonRoleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonRoleName == "" { - return nil, errors.New("parameter neonRoleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonRoleName}", url.PathEscape(neonRoleName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, resource); err != nil { - return nil, err - } - return req, nil -} - -// Delete - Delete a NeonRole -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonRoleName - The name of the NeonRole -// - options - NeonRolesClientDeleteOptions contains the optional parameters for the NeonRolesClient.Delete method. -func (client *NeonRolesClient) Delete(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, options *NeonRolesClientDeleteOptions) (NeonRolesClientDeleteResponse, error) { - var err error - const operationName = "NeonRolesClient.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, resourceGroupName, organizationName, projectName, branchName, neonRoleName, options) - if err != nil { - return NeonRolesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NeonRolesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return NeonRolesClientDeleteResponse{}, err - } - return NeonRolesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *NeonRolesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, _ *NeonRolesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonRoles/{neonRoleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonRoleName == "" { - return nil, errors.New("parameter neonRoleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonRoleName}", url.PathEscape(neonRoleName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get a NeonRole -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonRoleName - The name of the NeonRole -// - options - NeonRolesClientGetOptions contains the optional parameters for the NeonRolesClient.Get method. -func (client *NeonRolesClient) Get(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, options *NeonRolesClientGetOptions) (NeonRolesClientGetResponse, error) { - var err error - const operationName = "NeonRolesClient.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, resourceGroupName, organizationName, projectName, branchName, neonRoleName, options) - if err != nil { - return NeonRolesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NeonRolesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return NeonRolesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *NeonRolesClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, _ *NeonRolesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonRoles/{neonRoleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonRoleName == "" { - return nil, errors.New("parameter neonRoleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonRoleName}", url.PathEscape(neonRoleName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *NeonRolesClient) getHandleResponse(resp *http.Response) (NeonRolesClientGetResponse, error) { - result := NeonRolesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.NeonRole); err != nil { - return NeonRolesClientGetResponse{}, err - } - return result, nil -} - // NewListPager - List NeonRole resources by Branch // // Generated from API version 2025-03-01 @@ -356,98 +112,3 @@ func (client *NeonRolesClient) listHandleResponse(resp *http.Response) (NeonRole } return result, nil } - -// BeginUpdate - Update a NeonRole -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonRoleName - The name of the NeonRole -// - properties - The resource properties to be updated. -// - options - NeonRolesClientBeginUpdateOptions contains the optional parameters for the NeonRolesClient.BeginUpdate method. -func (client *NeonRolesClient) BeginUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, properties NeonRole, options *NeonRolesClientBeginUpdateOptions) (*runtime.Poller[NeonRolesClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, organizationName, projectName, branchName, neonRoleName, properties, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NeonRolesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NeonRolesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Update a NeonRole -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *NeonRolesClient) update(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, properties NeonRole, options *NeonRolesClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "NeonRolesClient.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, resourceGroupName, organizationName, projectName, branchName, neonRoleName, properties, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// updateCreateRequest creates the Update request. -func (client *NeonRolesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, properties NeonRole, _ *NeonRolesClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonRoles/{neonRoleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonRoleName == "" { - return nil, errors.New("parameter neonRoleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonRoleName}", url.PathEscape(neonRoleName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, properties); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client_example_test.go index 1fe5f120fee2..8a5f299c490e 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client_example_test.go @@ -6,157 +6,11 @@ package armneonpostgres_test import ( "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) -// Generated from example definition: 2025-03-01/NeonRoles_CreateOrUpdate_MaximumSet_Gen.json -func ExampleNeonRolesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNeonRolesClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.NeonRole{ - Properties: &armneonpostgres.NeonRoleProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - Permissions: []*string{ - to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - }, - IsSuperUser: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonRolesClientCreateOrUpdateResponse{ - // NeonRole: &armneonpostgres.NeonRole{ - // Properties: &armneonpostgres.NeonRoleProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - // Permissions: []*string{ - // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - // }, - // IsSuperUser: to.Ptr(true), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/neonRoles/entity-name"), - // Name: to.Ptr("tpbnco"), - // Type: to.Ptr("vqfmoiwt"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: 2025-03-01/NeonRoles_Delete_MaximumSet_Gen.json -func ExampleNeonRolesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNeonRolesClient().Delete(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonRolesClientDeleteResponse{ - // } -} - -// Generated from example definition: 2025-03-01/NeonRoles_Get_MaximumSet_Gen.json -func ExampleNeonRolesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNeonRolesClient().Get(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonRolesClientGetResponse{ - // NeonRole: &armneonpostgres.NeonRole{ - // Properties: &armneonpostgres.NeonRoleProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - // Permissions: []*string{ - // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - // }, - // IsSuperUser: to.Ptr(true), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/neonRoles/entity-name"), - // Name: to.Ptr("tpbnco"), - // Type: to.Ptr("vqfmoiwt"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - // Generated from example definition: 2025-03-01/NeonRoles_List_MaximumSet_Gen.json func ExampleNeonRolesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -168,7 +22,7 @@ func ExampleNeonRolesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewNeonRolesClient().NewListPager("rgneon", "test-org", "entity-name", "entity-name", nil) + pager := clientFactory.NewNeonRolesClient().NewListPager("rgneon", "contoso-org", "sample-resource", "sample-resource", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -218,74 +72,3 @@ func ExampleNeonRolesClient_NewListPager() { // } } } - -// Generated from example definition: 2025-03-01/NeonRoles_Update_MaximumSet_Gen.json -func ExampleNeonRolesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNeonRolesClient().BeginUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.NeonRole{ - Properties: &armneonpostgres.NeonRoleProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - Permissions: []*string{ - to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - }, - IsSuperUser: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonRolesClientUpdateResponse{ - // NeonRole: &armneonpostgres.NeonRole{ - // Properties: &armneonpostgres.NeonRoleProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - // Permissions: []*string{ - // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - // }, - // IsSuperUser: to.Ptr(true), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/neonRoles/entity-name"), - // Name: to.Ptr("tpbnco"), - // Type: to.Ptr("vqfmoiwt"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go index c4e36be86624..bf1ee864237d 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go @@ -7,12 +7,12 @@ package armneonpostgres_test import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) // Generated from example definition: 2025-03-01/Operations_List_MaximumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMaximumSet() { +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -43,7 +43,7 @@ func ExampleOperationsClient_NewListPager_operationsListMaximumSet() { // Provider: to.Ptr("lottcde"), // Resource: to.Ptr("lchjffakidtthnuaa"), // Operation: to.Ptr("ipqvheuesyujwjqhnmg"), - // Description: to.Ptr("gicugbypsgqayjlfyrxvnietwzx"), + // Description: to.Ptr("xjijlfawuqufbocpw"), // }, // Origin: to.Ptr(armneonpostgres.OriginUser), // ActionType: to.Ptr(armneonpostgres.ActionTypeInternal), @@ -56,7 +56,7 @@ func ExampleOperationsClient_NewListPager_operationsListMaximumSet() { } // Generated from example definition: 2025-03-01/Operations_List_MinimumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMinimumSet() { +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go index c912af7e4d4b..02071058a7ab 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go @@ -10,12 +10,6 @@ type BranchesClientBeginCreateOrUpdateOptions struct { ResumeToken string } -// BranchesClientBeginUpdateOptions contains the optional parameters for the BranchesClient.BeginUpdate method. -type BranchesClientBeginUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - // BranchesClientDeleteOptions contains the optional parameters for the BranchesClient.Delete method. type BranchesClientDeleteOptions struct { // placeholder for future optional parameters @@ -31,112 +25,21 @@ type BranchesClientListOptions struct { // placeholder for future optional parameters } -// ComputesClientBeginCreateOrUpdateOptions contains the optional parameters for the ComputesClient.BeginCreateOrUpdate method. -type ComputesClientBeginCreateOrUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// ComputesClientBeginUpdateOptions contains the optional parameters for the ComputesClient.BeginUpdate method. -type ComputesClientBeginUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// ComputesClientDeleteOptions contains the optional parameters for the ComputesClient.Delete method. -type ComputesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ComputesClientGetOptions contains the optional parameters for the ComputesClient.Get method. -type ComputesClientGetOptions struct { - // placeholder for future optional parameters -} - // ComputesClientListOptions contains the optional parameters for the ComputesClient.NewListPager method. type ComputesClientListOptions struct { // placeholder for future optional parameters } -// EndpointsClientBeginCreateOrUpdateOptions contains the optional parameters for the EndpointsClient.BeginCreateOrUpdate -// method. -type EndpointsClientBeginCreateOrUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// EndpointsClientBeginUpdateOptions contains the optional parameters for the EndpointsClient.BeginUpdate method. -type EndpointsClientBeginUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// EndpointsClientDeleteOptions contains the optional parameters for the EndpointsClient.Delete method. -type EndpointsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// EndpointsClientGetOptions contains the optional parameters for the EndpointsClient.Get method. -type EndpointsClientGetOptions struct { - // placeholder for future optional parameters -} - // EndpointsClientListOptions contains the optional parameters for the EndpointsClient.NewListPager method. type EndpointsClientListOptions struct { // placeholder for future optional parameters } -// NeonDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the NeonDatabasesClient.BeginCreateOrUpdate -// method. -type NeonDatabasesClientBeginCreateOrUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// NeonDatabasesClientBeginUpdateOptions contains the optional parameters for the NeonDatabasesClient.BeginUpdate method. -type NeonDatabasesClientBeginUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// NeonDatabasesClientDeleteOptions contains the optional parameters for the NeonDatabasesClient.Delete method. -type NeonDatabasesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// NeonDatabasesClientGetOptions contains the optional parameters for the NeonDatabasesClient.Get method. -type NeonDatabasesClientGetOptions struct { - // placeholder for future optional parameters -} - // NeonDatabasesClientListOptions contains the optional parameters for the NeonDatabasesClient.NewListPager method. type NeonDatabasesClientListOptions struct { // placeholder for future optional parameters } -// NeonRolesClientBeginCreateOrUpdateOptions contains the optional parameters for the NeonRolesClient.BeginCreateOrUpdate -// method. -type NeonRolesClientBeginCreateOrUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// NeonRolesClientBeginUpdateOptions contains the optional parameters for the NeonRolesClient.BeginUpdate method. -type NeonRolesClientBeginUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// NeonRolesClientDeleteOptions contains the optional parameters for the NeonRolesClient.Delete method. -type NeonRolesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// NeonRolesClientGetOptions contains the optional parameters for the NeonRolesClient.Get method. -type NeonRolesClientGetOptions struct { - // placeholder for future optional parameters -} - // NeonRolesClientListOptions contains the optional parameters for the NeonRolesClient.NewListPager method. type NeonRolesClientListOptions struct { // placeholder for future optional parameters @@ -196,12 +99,6 @@ type ProjectsClientBeginCreateOrUpdateOptions struct { ResumeToken string } -// ProjectsClientBeginUpdateOptions contains the optional parameters for the ProjectsClient.BeginUpdate method. -type ProjectsClientBeginUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - // ProjectsClientDeleteOptions contains the optional parameters for the ProjectsClient.Delete method. type ProjectsClientDeleteOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go index ddafbffd5bf3..b1bc36fc185a 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go @@ -8,7 +8,7 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) @@ -23,7 +23,7 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewOrganizationsClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", armneonpostgres.OrganizationResource{ + poller, err := clientFactory.NewOrganizationsClient().BeginCreateOrUpdate(ctx, "rgneon", "contoso-org", armneonpostgres.OrganizationResource{ Properties: &armneonpostgres.OrganizationProperties{ MarketplaceDetails: &armneonpostgres.MarketplaceDetails{ SubscriptionID: to.Ptr("xfahbbbzwlcwhhjbxarnwfcy"), @@ -181,9 +181,7 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { }, }, }, - Tags: map[string]*string{ - "key8832": to.Ptr("rvukepuxkykdtqjtwk"), - }, + Tags: map[string]*string{}, Location: to.Ptr("kcdph"), }, nil) if err != nil { @@ -226,7 +224,6 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // Domain: to.Ptr("snoshqumfsthyofpnrsgyjhszvgtj"), // NumberOfEmployees: to.Ptr[int64](12), // }, - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ // OrganizationID: to.Ptr("hzejhmftwsruhwspvtwoy"), // OrganizationName: to.Ptr("entity-name"), @@ -240,10 +237,7 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // }, // }, // ProjectProperties: &armneonpostgres.ProjectProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -259,10 +253,7 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // AutoscalingLimitMaxCu: to.Ptr[float32](20), // }, // Branch: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -275,10 +266,7 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -290,14 +278,14 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -306,14 +294,14 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -323,15 +311,18 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -343,14 +334,14 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -359,14 +350,14 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -376,15 +367,21 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Tags: map[string]*string{ - // "key8832": to.Ptr("rvukepuxkykdtqjtwk"), // }, // Location: to.Ptr("kcdph"), - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org"), + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rg/providers/Microsoft.Neon/organizations/organizationId"), // Name: to.Ptr("aocvhndykwhgolfixbqhwtmhiriu"), // Type: to.Ptr("bvtwhithilvtizpde"), // SystemData: &armneonpostgres.SystemData{ @@ -410,7 +407,7 @@ func ExampleOrganizationsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewOrganizationsClient().BeginDelete(ctx, "rgneon", "test-org", nil) + poller, err := clientFactory.NewOrganizationsClient().BeginDelete(ctx, "rgneon", "contoso-org", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -431,7 +428,7 @@ func ExampleOrganizationsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewOrganizationsClient().Get(ctx, "rgneon", "test-org", nil) + res, err := clientFactory.NewOrganizationsClient().Get(ctx, "rgneon", "contoso-org", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -468,7 +465,6 @@ func ExampleOrganizationsClient_Get() { // Domain: to.Ptr("snoshqumfsthyofpnrsgyjhszvgtj"), // NumberOfEmployees: to.Ptr[int64](12), // }, - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ // OrganizationID: to.Ptr("hzejhmftwsruhwspvtwoy"), // OrganizationName: to.Ptr("entity-name"), @@ -482,10 +478,7 @@ func ExampleOrganizationsClient_Get() { // }, // }, // ProjectProperties: &armneonpostgres.ProjectProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -501,10 +494,7 @@ func ExampleOrganizationsClient_Get() { // AutoscalingLimitMaxCu: to.Ptr[float32](20), // }, // Branch: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -517,10 +507,7 @@ func ExampleOrganizationsClient_Get() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -532,14 +519,14 @@ func ExampleOrganizationsClient_Get() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -548,14 +535,14 @@ func ExampleOrganizationsClient_Get() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -565,15 +552,18 @@ func ExampleOrganizationsClient_Get() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -585,14 +575,14 @@ func ExampleOrganizationsClient_Get() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -601,14 +591,14 @@ func ExampleOrganizationsClient_Get() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -618,15 +608,21 @@ func ExampleOrganizationsClient_Get() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Tags: map[string]*string{ - // "key8832": to.Ptr("rvukepuxkykdtqjtwk"), // }, // Location: to.Ptr("kcdph"), - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org"), + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rg/providers/Microsoft.Neon/organizations/organizationId"), // Name: to.Ptr("aocvhndykwhgolfixbqhwtmhiriu"), // Type: to.Ptr("bvtwhithilvtizpde"), // SystemData: &armneonpostgres.SystemData{ @@ -642,7 +638,7 @@ func ExampleOrganizationsClient_Get() { } // Generated from example definition: 2025-03-01/Organizations_GetPostgresVersions_MaximumSet_Gen.json -func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVersionsMaximumSet() { +func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVersionsMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -652,8 +648,8 @@ func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVers if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewOrganizationsClient().GetPostgresVersions(ctx, "rgneon", &armneonpostgres.OrganizationsClientGetPostgresVersionsOptions{ - Parameters: &armneonpostgres.PgVersion{ + res, err := clientFactory.NewOrganizationsClient().GetPostgresVersions(ctx, "rgneon", &OrganizationsClientGetPostgresVersionsOptions{ + parameters: &armneonpostgres.PgVersion{ Version: to.Ptr[int32](7), }}) if err != nil { @@ -674,7 +670,7 @@ func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVers } // Generated from example definition: 2025-03-01/Organizations_GetPostgresVersions_MinimumSet_Gen.json -func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVersionsMinimumSet() { +func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVersionsMaximumSetGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -702,7 +698,7 @@ func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVers } // Generated from example definition: 2025-03-01/Organizations_ListByResourceGroup_MaximumSet_Gen.json -func ExampleOrganizationsClient_NewListByResourceGroupPager() { +func ExampleOrganizationsClient_NewListByResourceGroupPager_organizationsListByResourceGroupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -910,10 +906,9 @@ func ExampleOrganizationsClient_NewListByResourceGroupPager() { // }, // }, // Tags: map[string]*string{ - // "key8832": to.Ptr("rvukepuxkykdtqjtwk"), // }, // Location: to.Ptr("kcdph"), - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/organization-name"), + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rg/providers/Microsoft.Neon/organizations/organizationId"), // Name: to.Ptr("aocvhndykwhgolfixbqhwtmhiriu"), // Type: to.Ptr("bvtwhithilvtizpde"), // SystemData: &armneonpostgres.SystemData{ @@ -932,8 +927,43 @@ func ExampleOrganizationsClient_NewListByResourceGroupPager() { } } +// Generated from example definition: 2025-03-01/Organizations_ListByResourceGroup_MinimumSet_Gen.json +func ExampleOrganizationsClient_NewListByResourceGroupPager_organizationsListByResourceGroupMaximumSetGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOrganizationsClient().NewListByResourceGroupPager("rgneon", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armneonpostgres.OrganizationsClientListByResourceGroupResponse{ + // OrganizationResourceListResult: armneonpostgres.OrganizationResourceListResult{ + // Value: []*armneonpostgres.OrganizationResource{ + // { + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/contoso-org"), + // Location: to.Ptr("kcdph"), + // }, + // }, + // }, + // } + } +} + // Generated from example definition: 2025-03-01/Organizations_ListBySubscription_MaximumSet_Gen.json -func ExampleOrganizationsClient_NewListBySubscriptionPager() { +func ExampleOrganizationsClient_NewListBySubscriptionPager_organizationsListBySubscriptionMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -1141,7 +1171,6 @@ func ExampleOrganizationsClient_NewListBySubscriptionPager() { // }, // }, // Tags: map[string]*string{ - // "key8832": to.Ptr("rvukepuxkykdtqjtwk"), // }, // Location: to.Ptr("kcdph"), // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rg/providers/Microsoft.Neon/organizations/organizationId"), @@ -1163,6 +1192,41 @@ func ExampleOrganizationsClient_NewListBySubscriptionPager() { } } +// Generated from example definition: 2025-03-01/Organizations_ListBySubscription_MinimumSet_Gen.json +func ExampleOrganizationsClient_NewListBySubscriptionPager_organizationsListBySubscriptionMaximumSetGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOrganizationsClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armneonpostgres.OrganizationsClientListBySubscriptionResponse{ + // OrganizationResourceListResult: armneonpostgres.OrganizationResourceListResult{ + // Value: []*armneonpostgres.OrganizationResource{ + // { + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/contoso-org"), + // Location: to.Ptr("kcdph"), + // }, + // }, + // }, + // } + } +} + // Generated from example definition: 2025-03-01/Organizations_Update_MaximumSet_Gen.json func ExampleOrganizationsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -1174,8 +1238,20 @@ func ExampleOrganizationsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewOrganizationsClient().BeginUpdate(ctx, "rgneon", "test-org", armneonpostgres.OrganizationResource{ + poller, err := clientFactory.NewOrganizationsClient().BeginUpdate(ctx, "rgneon", "contoso-org", armneonpostgres.OrganizationResource{ Properties: &armneonpostgres.OrganizationProperties{ + MarketplaceDetails: &armneonpostgres.MarketplaceDetails{ + SubscriptionID: to.Ptr("yxmkfivp"), + SubscriptionStatus: to.Ptr(armneonpostgres.MarketplaceSubscriptionStatusPendingFulfillmentStart), + OfferDetails: &armneonpostgres.OfferDetails{ + PublisherID: to.Ptr("hporaxnopmolttlnkbarw"), + OfferID: to.Ptr("bunyeeupoedueofwrzej"), + PlanID: to.Ptr("nlbfiwtslenfwek"), + PlanName: to.Ptr("ljbmgpkfqklaufacbpml"), + TermUnit: to.Ptr("qbcq"), + TermID: to.Ptr("aedlchikwqckuploswthvshe"), + }, + }, UserDetails: &armneonpostgres.UserDetails{ FirstName: to.Ptr("zhelh"), LastName: to.Ptr("zbdhouyeozylnerrc"), @@ -1320,9 +1396,7 @@ func ExampleOrganizationsClient_BeginUpdate() { }, }, }, - Tags: map[string]*string{ - "key609": to.Ptr("qyosjypklxtiamqebd"), - }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -1338,15 +1412,15 @@ func ExampleOrganizationsClient_BeginUpdate() { // OrganizationResource: &armneonpostgres.OrganizationResource{ // Properties: &armneonpostgres.OrganizationProperties{ // MarketplaceDetails: &armneonpostgres.MarketplaceDetails{ - // SubscriptionID: to.Ptr("xfahbbbzwlcwhhjbxarnwfcy"), + // SubscriptionID: to.Ptr("yxmkfivp"), // SubscriptionStatus: to.Ptr(armneonpostgres.MarketplaceSubscriptionStatusPendingFulfillmentStart), // OfferDetails: &armneonpostgres.OfferDetails{ - // PublisherID: to.Ptr("eibghzuyqsksouwlgqphhmuxeqeigf"), - // OfferID: to.Ptr("qscggwfdnippiwrrnmuscg"), - // PlanID: to.Ptr("sveqoxtdwxutxmtniuufyrdu"), - // PlanName: to.Ptr("t"), - // TermUnit: to.Ptr("jnxhyql"), - // TermID: to.Ptr("uptombvymytfonj"), + // PublisherID: to.Ptr("hporaxnopmolttlnkbarw"), + // OfferID: to.Ptr("bunyeeupoedueofwrzej"), + // PlanID: to.Ptr("nlbfiwtslenfwek"), + // PlanName: to.Ptr("ljbmgpkfqklaufacbpml"), + // TermUnit: to.Ptr("qbcq"), + // TermID: to.Ptr("aedlchikwqckuploswthvshe"), // }, // }, // UserDetails: &armneonpostgres.UserDetails{ @@ -1364,7 +1438,6 @@ func ExampleOrganizationsClient_BeginUpdate() { // Domain: to.Ptr("snoshqumfsthyofpnrsgyjhszvgtj"), // NumberOfEmployees: to.Ptr[int64](12), // }, - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ // OrganizationID: to.Ptr("fynmpcbivqkwqdfhrmsyusjd"), // OrganizationName: to.Ptr("entity-name"), @@ -1378,10 +1451,7 @@ func ExampleOrganizationsClient_BeginUpdate() { // }, // }, // ProjectProperties: &armneonpostgres.ProjectProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1397,10 +1467,7 @@ func ExampleOrganizationsClient_BeginUpdate() { // AutoscalingLimitMaxCu: to.Ptr[float32](4), // }, // Branch: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1413,10 +1480,7 @@ func ExampleOrganizationsClient_BeginUpdate() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1428,14 +1492,14 @@ func ExampleOrganizationsClient_BeginUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1444,14 +1508,14 @@ func ExampleOrganizationsClient_BeginUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1461,15 +1525,18 @@ func ExampleOrganizationsClient_BeginUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1481,14 +1548,14 @@ func ExampleOrganizationsClient_BeginUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1497,14 +1564,14 @@ func ExampleOrganizationsClient_BeginUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1514,15 +1581,21 @@ func ExampleOrganizationsClient_BeginUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Tags: map[string]*string{ - // "key8832": to.Ptr("rvukepuxkykdtqjtwk"), // }, // Location: to.Ptr("kcdph"), - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org"), + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rg/providers/Microsoft.Neon/organizations/organizationId"), // Name: to.Ptr("aocvhndykwhgolfixbqhwtmhiriu"), // Type: to.Ptr("bvtwhithilvtizpde"), // SystemData: &armneonpostgres.SystemData{ diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client.go index 6a5e5e0cd8df..b2113f2fefea 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client.go @@ -391,88 +391,3 @@ func (client *ProjectsClient) listHandleResponse(resp *http.Response) (ProjectsC } return result, nil } - -// BeginUpdate - Update a Project -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - properties - The resource properties to be updated. -// - options - ProjectsClientBeginUpdateOptions contains the optional parameters for the ProjectsClient.BeginUpdate method. -func (client *ProjectsClient) BeginUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, properties Project, options *ProjectsClientBeginUpdateOptions) (*runtime.Poller[ProjectsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, organizationName, projectName, properties, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProjectsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Update a Project -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *ProjectsClient) update(ctx context.Context, resourceGroupName string, organizationName string, projectName string, properties Project, options *ProjectsClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "ProjectsClient.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, resourceGroupName, organizationName, projectName, properties, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// updateCreateRequest creates the Update request. -func (client *ProjectsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, properties Project, _ *ProjectsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, properties); err != nil { - return nil, err - } - return req, nil -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client_example_test.go index 7ce43b7d046c..08190f3cdd98 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client_example_test.go @@ -8,7 +8,7 @@ import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) @@ -23,7 +23,7 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewProjectsClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", "entity-name", armneonpostgres.Project{ + poller, err := clientFactory.NewProjectsClient().BeginCreateOrUpdate(ctx, "rgneon", "contoso-org", "sample-resource", armneonpostgres.Project{ Properties: &armneonpostgres.ProjectProperties{ EntityName: to.Ptr("entity-name"), Attributes: []*armneonpostgres.Attributes{ @@ -154,10 +154,7 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // res = armneonpostgres.ProjectsClientCreateOrUpdateResponse{ // Project: &armneonpostgres.Project{ // Properties: &armneonpostgres.ProjectProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -173,10 +170,7 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // AutoscalingLimitMaxCu: to.Ptr[float32](20), // }, // Branch: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -189,10 +183,7 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -204,14 +195,14 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -220,14 +211,14 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -237,15 +228,18 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -257,14 +251,14 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -273,14 +267,14 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -290,10 +284,16 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name"), + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/cajluydhtylhjatsexnmxmxhwfs"), // Name: to.Ptr("cajluydhtylhjatsexnmxmxhwfs"), // Type: to.Ptr("voaddrcrqtyqae"), // SystemData: &armneonpostgres.SystemData{ @@ -319,7 +319,7 @@ func ExampleProjectsClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewProjectsClient().Delete(ctx, "rgneon", "test-org", "entity-name", nil) + res, err := clientFactory.NewProjectsClient().Delete(ctx, "rgneon", "contoso-org", "sample-resource", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -341,7 +341,7 @@ func ExampleProjectsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewProjectsClient().Get(ctx, "rgneon", "test-org", "entity-name", nil) + res, err := clientFactory.NewProjectsClient().Get(ctx, "rgneon", "contoso-org", "sample-resource", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -351,10 +351,7 @@ func ExampleProjectsClient_Get() { // res = armneonpostgres.ProjectsClientGetResponse{ // Project: &armneonpostgres.Project{ // Properties: &armneonpostgres.ProjectProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -370,10 +367,7 @@ func ExampleProjectsClient_Get() { // AutoscalingLimitMaxCu: to.Ptr[float32](20), // }, // Branch: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -386,10 +380,7 @@ func ExampleProjectsClient_Get() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -401,14 +392,14 @@ func ExampleProjectsClient_Get() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -417,14 +408,14 @@ func ExampleProjectsClient_Get() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -434,15 +425,18 @@ func ExampleProjectsClient_Get() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -454,14 +448,14 @@ func ExampleProjectsClient_Get() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -470,14 +464,14 @@ func ExampleProjectsClient_Get() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -487,10 +481,16 @@ func ExampleProjectsClient_Get() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name"), + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/cajluydhtylhjatsexnmxmxhwfs"), // Name: to.Ptr("cajluydhtylhjatsexnmxmxhwfs"), // Type: to.Ptr("voaddrcrqtyqae"), // SystemData: &armneonpostgres.SystemData{ @@ -516,7 +516,7 @@ func ExampleProjectsClient_GetConnectionURI() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewProjectsClient().GetConnectionURI(ctx, "rgneon", "test-org", "entity-name", armneonpostgres.ConnectionURIProperties{ + res, err := clientFactory.NewProjectsClient().GetConnectionURI(ctx, "rgneon", "contoso-org", "sample-resource", armneonpostgres.ConnectionURIProperties{ ProjectID: to.Ptr("riuifmoqtorrcffgksvfcobia"), BranchID: to.Ptr("iimmlbqv"), DatabaseName: to.Ptr("xc"), @@ -553,7 +553,7 @@ func ExampleProjectsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewProjectsClient().NewListPager("rgneon", "test-org", nil) + pager := clientFactory.NewProjectsClient().NewListPager("rgneon", "contoso-org", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -726,299 +726,3 @@ func ExampleProjectsClient_NewListPager() { // } } } - -// Generated from example definition: 2025-03-01/Projects_Update_MaximumSet_Gen.json -func ExampleProjectsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProjectsClient().BeginUpdate(ctx, "rgneon", "test-org", "test-project", armneonpostgres.Project{ - Properties: &armneonpostgres.ProjectProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - RegionID: to.Ptr("vxvmjwuttpiakirzdf"), - Storage: to.Ptr[int64](23), - PgVersion: to.Ptr[int32](16), - HistoryRetention: to.Ptr[int32](16), - DefaultEndpointSettings: &armneonpostgres.DefaultEndpointSettings{ - AutoscalingLimitMinCu: to.Ptr[float32](8), - AutoscalingLimitMaxCu: to.Ptr[float32](4), - }, - Branch: &armneonpostgres.BranchProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("oik"), - ParentID: to.Ptr("entity-id"), - RoleName: to.Ptr("qrrairsupyosxnqotdwhbpc"), - DatabaseName: to.Ptr("duhxebzhd"), - Roles: []*armneonpostgres.NeonRoleProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - Permissions: []*string{ - to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - }, - IsSuperUser: to.Ptr(true), - }, - }, - Databases: []*armneonpostgres.NeonDatabaseProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - OwnerName: to.Ptr("odmbeg"), - }, - }, - Endpoints: []*armneonpostgres.EndpointProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - }, - }, - }, - Roles: []*armneonpostgres.NeonRoleProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - Permissions: []*string{ - to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - }, - IsSuperUser: to.Ptr(true), - }, - }, - Databases: []*armneonpostgres.NeonDatabaseProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - OwnerName: to.Ptr("odmbeg"), - }, - }, - Endpoints: []*armneonpostgres.EndpointProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.ProjectsClientUpdateResponse{ - // Project: &armneonpostgres.Project{ - // Properties: &armneonpostgres.ProjectProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // RegionID: to.Ptr("tlcltldfrnxh"), - // Storage: to.Ptr[int64](7), - // PgVersion: to.Ptr[int32](10), - // HistoryRetention: to.Ptr[int32](7), - // DefaultEndpointSettings: &armneonpostgres.DefaultEndpointSettings{ - // AutoscalingLimitMinCu: to.Ptr[float32](8), - // AutoscalingLimitMaxCu: to.Ptr[float32](4), - // }, - // Branch: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("oik"), - // ParentID: to.Ptr("entity-id"), - // RoleName: to.Ptr("qrrairsupyosxnqotdwhbpc"), - // DatabaseName: to.Ptr("duhxebzhd"), - // Roles: []*armneonpostgres.NeonRoleProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - // Permissions: []*string{ - // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - // }, - // IsSuperUser: to.Ptr(true), - // }, - // }, - // Databases: []*armneonpostgres.NeonDatabaseProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - // OwnerName: to.Ptr("odmbeg"), - // }, - // }, - // Endpoints: []*armneonpostgres.EndpointProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - // }, - // }, - // }, - // Roles: []*armneonpostgres.NeonRoleProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - // Permissions: []*string{ - // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - // }, - // IsSuperUser: to.Ptr(true), - // }, - // }, - // Databases: []*armneonpostgres.NeonDatabaseProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - // OwnerName: to.Ptr("odmbeg"), - // }, - // }, - // Endpoints: []*armneonpostgres.EndpointProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - // }, - // }, - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/cajluydhtylhjatsexnmxmxhwfs"), - // Name: to.Ptr("cajluydhtylhjatsexnmxmxhwfs"), - // Type: to.Ptr("voaddrcrqtyqae"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go index bf74ca89e06a..7da3a304b2f3 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go @@ -27,128 +27,30 @@ type BranchesClientListResponse struct { BranchListResult } -// BranchesClientUpdateResponse contains the response from method BranchesClient.BeginUpdate. -type BranchesClientUpdateResponse struct { - // The Branch resource type. - Branch -} - -// ComputesClientCreateOrUpdateResponse contains the response from method ComputesClient.BeginCreateOrUpdate. -type ComputesClientCreateOrUpdateResponse struct { - // The Compute resource type. - Compute -} - -// ComputesClientDeleteResponse contains the response from method ComputesClient.Delete. -type ComputesClientDeleteResponse struct { - // placeholder for future response values -} - -// ComputesClientGetResponse contains the response from method ComputesClient.Get. -type ComputesClientGetResponse struct { - // The Compute resource type. - Compute -} - // ComputesClientListResponse contains the response from method ComputesClient.NewListPager. type ComputesClientListResponse struct { // The response of a Compute list operation. ComputeListResult } -// ComputesClientUpdateResponse contains the response from method ComputesClient.BeginUpdate. -type ComputesClientUpdateResponse struct { - // The Compute resource type. - Compute -} - -// EndpointsClientCreateOrUpdateResponse contains the response from method EndpointsClient.BeginCreateOrUpdate. -type EndpointsClientCreateOrUpdateResponse struct { - // The Neon compute endpoint resource type. - Endpoint -} - -// EndpointsClientDeleteResponse contains the response from method EndpointsClient.Delete. -type EndpointsClientDeleteResponse struct { - // placeholder for future response values -} - -// EndpointsClientGetResponse contains the response from method EndpointsClient.Get. -type EndpointsClientGetResponse struct { - // The Neon compute endpoint resource type. - Endpoint -} - // EndpointsClientListResponse contains the response from method EndpointsClient.NewListPager. type EndpointsClientListResponse struct { // The response of a Endpoint list operation. EndpointListResult } -// EndpointsClientUpdateResponse contains the response from method EndpointsClient.BeginUpdate. -type EndpointsClientUpdateResponse struct { - // The Neon compute endpoint resource type. - Endpoint -} - -// NeonDatabasesClientCreateOrUpdateResponse contains the response from method NeonDatabasesClient.BeginCreateOrUpdate. -type NeonDatabasesClientCreateOrUpdateResponse struct { - // The Neon Database resource type. - NeonDatabase -} - -// NeonDatabasesClientDeleteResponse contains the response from method NeonDatabasesClient.Delete. -type NeonDatabasesClientDeleteResponse struct { - // placeholder for future response values -} - -// NeonDatabasesClientGetResponse contains the response from method NeonDatabasesClient.Get. -type NeonDatabasesClientGetResponse struct { - // The Neon Database resource type. - NeonDatabase -} - // NeonDatabasesClientListResponse contains the response from method NeonDatabasesClient.NewListPager. type NeonDatabasesClientListResponse struct { // The response of a NeonDatabase list operation. NeonDatabaseListResult } -// NeonDatabasesClientUpdateResponse contains the response from method NeonDatabasesClient.BeginUpdate. -type NeonDatabasesClientUpdateResponse struct { - // The Neon Database resource type. - NeonDatabase -} - -// NeonRolesClientCreateOrUpdateResponse contains the response from method NeonRolesClient.BeginCreateOrUpdate. -type NeonRolesClientCreateOrUpdateResponse struct { - // The Neon Role resource type. - NeonRole -} - -// NeonRolesClientDeleteResponse contains the response from method NeonRolesClient.Delete. -type NeonRolesClientDeleteResponse struct { - // placeholder for future response values -} - -// NeonRolesClientGetResponse contains the response from method NeonRolesClient.Get. -type NeonRolesClientGetResponse struct { - // The Neon Role resource type. - NeonRole -} - // NeonRolesClientListResponse contains the response from method NeonRolesClient.NewListPager. type NeonRolesClientListResponse struct { // The response of a NeonRole list operation. NeonRoleListResult } -// NeonRolesClientUpdateResponse contains the response from method NeonRolesClient.BeginUpdate. -type NeonRolesClientUpdateResponse struct { - // The Neon Role resource type. - NeonRole -} - // 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. @@ -224,9 +126,3 @@ type ProjectsClientListResponse struct { // The response of a Project list operation. ProjectListResult } - -// ProjectsClientUpdateResponse contains the response from method ProjectsClient.BeginUpdate. -type ProjectsClientUpdateResponse struct { - // The Project resource type. - Project -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml b/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml index 73c9b12920db..13c70b34107f 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/liftrneon/Neon.Postgres.Management -commit: 3db6867b8e524ea6d1bc7a3bbb989fe50dd2f184 +commit: c269b7b78cac2808d7acc55124a9653b2e904e4b repo: Azure/azure-rest-api-specs additionalDirectories: \ No newline at end of file From 6c10b567124aa12e1a259c16a6922a1f73c25a23 Mon Sep 17 00:00:00 2001 From: jliusan Date: Thu, 15 May 2025 10:25:18 +0800 Subject: [PATCH 2/3] fix test --- .../armneonpostgres/organizations_client_example_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go index b1bc36fc185a..61b6741956fa 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go @@ -648,7 +648,7 @@ func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVers if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewOrganizationsClient().GetPostgresVersions(ctx, "rgneon", &OrganizationsClientGetPostgresVersionsOptions{ + res, err := clientFactory.NewOrganizationsClient().GetPostgresVersions(ctx, "rgneon", &armneonpostgres.OrganizationsClientGetPostgresVersionsOptions{ parameters: &armneonpostgres.PgVersion{ Version: to.Ptr[int32](7), }}) From ecaf44a53a489c94f3951366310cd051ad901aae Mon Sep 17 00:00:00 2001 From: jliusan Date: Thu, 15 May 2025 10:50:39 +0800 Subject: [PATCH 3/3] fix test --- .../armneonpostgres/organizations_client_example_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go index 61b6741956fa..b0f0023cc5c5 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go @@ -649,7 +649,7 @@ func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVers log.Fatalf("failed to create client: %v", err) } res, err := clientFactory.NewOrganizationsClient().GetPostgresVersions(ctx, "rgneon", &armneonpostgres.OrganizationsClientGetPostgresVersionsOptions{ - parameters: &armneonpostgres.PgVersion{ + Parameters: &armneonpostgres.PgVersion{ Version: to.Ptr[int32](7), }}) if err != nil {